Last active
February 4, 2022 13:04
-
-
Save mikeananev/1b78729e9f7e624254c9b99816df372f to your computer and use it in GitHub Desktop.
Babashka global task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir ~/btasks | |
ltedit ~/btasks/gbb ;; add gbb content to a file | |
chmod +x ~/btasks/gbb | |
ltedit ~/.zshrc | |
;;add content zshrc to the end of .zshrc | |
ltedit ~/btasks/bb.edn ;; add bb.edn content to a file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
:tasks | |
{ | |
:requires ([babashka.process :refer [process check]]) | |
prompt-password {:doc "Prompt password form console" | |
:task (let [console (System/console) | |
chars (.readPassword console "%s" (into-array ["Enter password:"]))] | |
(def password (apply str chars)) | |
password)} | |
example {:depends [prompt-password] | |
:task (println "entered password:" password)} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
bb --config ~/btasks/bb.edn $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH="$HOME/btasks:$PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment