README
This commit is contained in:
parent
634084e592
commit
280a2a0016
1 changed files with 21 additions and 7 deletions
28
README.md
28
README.md
|
|
@ -785,14 +785,28 @@ bb '(-> *input* first :name (subs 1))'
|
|||
"0.0.4"
|
||||
```
|
||||
|
||||
### Get latest OS-specific download url from Github
|
||||
### Generate deps.edn entry for a gitlib
|
||||
|
||||
``` shellsession
|
||||
$ curl -s https://api.github.com/repos/borkdude/babashka/releases |
|
||||
jet --from json --keywordize |
|
||||
bb '(-> *input* first :assets)' |
|
||||
bb '(some #(re-find #".*linux.*" (:browser_download_url %)) *input*)'
|
||||
"https://github.com/borkdude/babashka/releases/download/v0.0.4/babashka-0.0.4-linux-amd64.zip"
|
||||
``` clojure
|
||||
#!/usr/bin/env bb
|
||||
|
||||
(require '[clojure.java.shell :refer [sh]]
|
||||
'[clojure.string :as str])
|
||||
|
||||
(let [[username project branch] *command-line-args*
|
||||
branch (or branch "master")
|
||||
url (str "https://github.com/" username "/" project)
|
||||
sha (-> (sh "git" "ls-remote" url branch)
|
||||
:out
|
||||
(str/split #"\s")
|
||||
first)]
|
||||
{:git/url url
|
||||
:sha sha})
|
||||
```
|
||||
|
||||
``` shell
|
||||
$ gitlib.clj nate fs
|
||||
{:git/url "https://github.com/nate/fs", :sha "75b9fcd399ac37cb4f9752a4c7a6755f3fbbc000"}
|
||||
```
|
||||
|
||||
### View download statistics from Clojars
|
||||
|
|
|
|||
Loading…
Reference in a new issue