Skip to content

Commit 4e4a6bf

Browse files
committed
Add support for Clojars
1 parent 6054caa commit 4e4a6bf

4 files changed

Lines changed: 26 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Supported package repositories:
1515
- [Arch Linux](https://archlinux.org/packages/)
1616
- [AUR](https://aur.archlinux.org/)
1717
- [Chocolatey](https://chocolatey.org/)
18+
- [Clojars](https://clojars.org/)
1819
- [CRAN](https://cran.r-project.org/)
1920
- [crates.io](https://crates.io/)
2021
- [Debian](https://www.debian.org/distrib/packages)

internal/clojars/client.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package clojars
2+
3+
import (
4+
"fmt"
5+
"net/http"
6+
7+
"github.com/skewb1k/pkgrep/internal/httputil"
8+
)
9+
10+
type Client struct {
11+
HTTPClient *http.Client
12+
}
13+
14+
func (c Client) Name() string {
15+
return "Clojars"
16+
}
17+
18+
func (c Client) Query(query string) (bool, error) {
19+
url := fmt.Sprintf("https://clojars.org/%s", query)
20+
return httputil.GetCheckOK(c.HTTPClient, url)
21+
}

pkgrep.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/skewb1k/pkgrep/internal/archlinux"
1818
"github.com/skewb1k/pkgrep/internal/aur"
1919
"github.com/skewb1k/pkgrep/internal/chocolatey"
20+
"github.com/skewb1k/pkgrep/internal/clojars"
2021
"github.com/skewb1k/pkgrep/internal/cran"
2122
"github.com/skewb1k/pkgrep/internal/cratesio"
2223
"github.com/skewb1k/pkgrep/internal/debian"
@@ -111,6 +112,7 @@ func main() {
111112
archlinux.Client{httpClient},
112113
aur.Client{httpClient},
113114
chocolatey.Client{httpClient},
115+
clojars.Client{httpClient},
114116
cran.Client{httpClient},
115117
cratesio.Client{httpClient},
116118
debian.Client{httpClient},

pkgrep_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/skewb1k/pkgrep/internal/archlinux"
1313
"github.com/skewb1k/pkgrep/internal/aur"
1414
"github.com/skewb1k/pkgrep/internal/chocolatey"
15+
"github.com/skewb1k/pkgrep/internal/clojars"
1516
"github.com/skewb1k/pkgrep/internal/cran"
1617
"github.com/skewb1k/pkgrep/internal/cratesio"
1718
"github.com/skewb1k/pkgrep/internal/debian"
@@ -63,6 +64,7 @@ var tests = []testcase{
6364
{archlinux.Client{testHTTPClient}, "linux"},
6465
{aur.Client{testHTTPClient}, "google-chrome"},
6566
{chocolatey.Client{testHTTPClient}, "go"},
67+
{clojars.Client{testHTTPClient}, "core.typed"},
6668
{cran.Client{testHTTPClient}, "ggplot2"},
6769
{cratesio.Client{testHTTPClient}, "chroma-ls"},
6870
{debian.Client{testHTTPClient}, "linux-base"},

0 commit comments

Comments
 (0)