X-Git-Url: https://njoseph.me/gitweb/babashka-scripts.git/blobdiff_plain/ead73d37568631a52a3759179a8fde48939d4afa..HEAD:/README.md diff --git a/README.md b/README.md index a5c24b4..fb44973 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,60 @@ # Babashka Scripts -Miscellaneous [babashka](https://babashka.org "babashka website") scripts I wrote for my own personal use. +Miscellaneous [babashka](https://babashka.org "babashka website") scripts written for my own personal use. ## Requirements -babashka (>= 0.2.9) +babashka (>= 0.4.0) ## Usage Clone this repository. ``` sh -cd ~/dev git clone https://njoseph.me/gitweb/babashka-scripts.git ``` -Add the following lines to your shell configuration file. +The list of available commands can be found by running `bb tasks` in the directory where the file `bb.edn` is present. ``` sh -export BABASHKA_PRELOADS='(run! load-file (map #(str (System/getProperty "user.home") "/dev/babashka-scripts/" %) ["lib.clj" "utils.clj"]))' -export BABASHKA_PRELOADS=$BABASHKA_PRELOADS" (require '[utils :refer :all])" -export PATH=$PATH:$HOME/dev/babashka-scripts +The following tasks are available: + +gup Do a git pull and rebase branch with master in a given directory. +gpa Runs `git pull` on all the git repositories in a given directory. +ebook-to-audiobook A utility to listen to your ebooks using TTS programs. Only tested on macOS with epub files. +install-deb Install a Debian package given a direct URL to the .deb file. +install-deb-gh Install a Debian package given a GitHub URL. +``` + +Some tasks can also take arguments. + +``` sh +bb ebook-to-audiobook the-great-gatsby.epub ``` -Some useful aliases and functions. +## Shell aliases ``` sh -alias gup="bb -e '(git-pull-rebase-branch)'" -alias bbr="rlwrap bb --repl" +# bash, zsh +source /path/to/babashka-scripts/bb-aliases.sh +alias task = bb --config ~/dev/babashka-scripts/bb.edn -function bb-wrap { - expr="($1 \"$2\")" - bb -e $expr -} +# nu +source /path/to/babashka-scripts/bb-aliases.nu +alias task = bb --config ~/dev/babashka-scripts/bb.edn +``` + +*Example:* To pull all the repositories in a directory, run -alias install-deb="bb-wrap install-deb" -alias install-deb-gh="bb-wrap install-deb-from-GitHub" +``` sh +task gpa . ``` -## Organization +There is a utility `bbe` to run tasks in the current working directory in `bb-aliases.sh`. -`lib.clj` contains functions that the other scripts might use. It must be loaded -first. -`utils.clj` contains standalone utilities that can be executed directly. These are -convenient to use through shell aliases. +*Example:* To pull all the repositories in a directory, run -The remaining Clojure files are executable scripts. +``` sh +bbe gpa +```