Simple bash tab completion for Clojure CLI commands. Fast startup with Babashka.
bbin install io.github.chaploud/cljtabgit clone https://github.com/chaploud/cljtab.git
cd cljtab
bbin install .git clone https://github.com/chaploud/cljtab.git
cd cljtab
chmod +x cljtab
./cljtab setupOr add to PATH:
ln -s "$(pwd)/cljtab" ~/.local/bin/cljtabNote: If you encounter classpath errors with bbin installation, use this method instead.
Install shell completion (auto-detects your shell):
cljtab setupOr specify shell explicitly:
# For bash
cljtab setup bash
source ~/.bashrc
# For zsh
cljtab setup zsh
source ~/.zshrc
# For both shells
cljtab setup bothGenerate completion candidates for current directory (must be run in a directory with deps.edn):
cljtab generateRemove all cache files and shell configuration:
cljtab cleanOnce installed, tab completion works automatically:
clj -A<TAB> # Shows available aliases: :deps :test :build
clj -X:deps <TAB> # Shows :deps functions: list tree find-versions prep
clj -Ttools <TAB> # Shows tools functions: install install-latest listThe completion system automatically searches for the nearest cache file in parent directories, allowing you to work in subdirectories of your project.
- Completion script:
~/.local/share/bash-completion/completions/clj - Changes to .bashrc: Sources the completion file
- Completion script:
~/.local/share/zsh/site-functions/_clj - Changes to .zshrc: Adds completion directory to fpath and enables completion
- Cache:
~/.cache/cljtab/<full-project-path>/candidates.edn- Cache files are stored using the full directory path structure
- Completion searches for the nearest cache file in parent directories
# Clojure CLI tab completion (cljtab)
[[ -f "$HOME/.local/share/bash-completion/completions/clj" ]] && source "$HOME/.local/share/bash-completion/completions/clj"# Clojure CLI tab completion (cljtab)
fpath=("$HOME/.local/share/zsh/site-functions" $fpath)
autoload -U compinit
compinitThe actual completion functions are stored in separate files following shell conventions.