Skip to content

Instantly share code, notes, and snippets.

@mikeananev
Last active February 4, 2022 13:04
Show Gist options
  • Save mikeananev/1b78729e9f7e624254c9b99816df372f to your computer and use it in GitHub Desktop.
Save mikeananev/1b78729e9f7e624254c9b99816df372f to your computer and use it in GitHub Desktop.
Babashka global task
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
{
: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)}
}
}
#!/usr/bin/env bash
bb --config ~/btasks/bb.edn $@
export PATH="$HOME/btasks:$PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment