Shell Completions
Jake provides tab completion for recipe names and flags in bash, zsh, and fish.
Quick Install
Section titled “Quick Install”The easiest way to set up completions:
jake --completions --installThis automatically detects your shell and installs completions to the appropriate location.
Auto-detection reads $SHELL and also recognizes Windows-style shell paths such as C:\Program Files\Git\bin\bash.exe when you invoke Jake from PowerShell or other Windows terminals.
Manual Installation
Section titled “Manual Installation”Generate the completion script and save it:
jake --completions bash > ~/.local/share/bash-completion/completions/jakejake --completions zsh > ~/.zsh/completions/_jakeYou may need to add the completions directory to your fpath in ~/.zshrc:
fpath=(~/.zsh/completions $fpath)autoload -Uz compinit && compinitjake --completions fish > ~/.config/fish/completions/jake.fishEnvironment Detection
Section titled “Environment Detection”The --install command automatically detects your zsh environment:
| Environment | Install Location | Configuration |
|---|---|---|
| Oh-My-Zsh | ~/.oh-my-zsh/custom/completions/_jake | None needed |
| Homebrew zsh | /opt/homebrew/share/zsh/site-functions/_jake | None needed |
| Vanilla zsh | ~/.zsh/completions/_jake | Auto-patches ~/.zshrc |
| Bash | ~/.local/share/bash-completion/completions/jake | None needed |
| Fish | ~/.config/fish/completions/jake.fish | None needed |
For vanilla zsh, the installer adds a configuration block to ~/.zshrc:
# >>> jake completion >>># This block is managed by jake. Do not edit manually.fpath=(~/.zsh/completions $fpath)autoload -Uz compinit && compinit -u# <<< jake completion <<<Uninstalling
Section titled “Uninstalling”Remove completions and configuration:
jake --completions --uninstallThis removes the completion file and cleans up any .zshrc modifications.
What Gets Completed
Section titled “What Gets Completed”Tab completion works for:
- Recipe names - Dynamically loaded from your Jakefile
- CLI flags - All options like
--list,--dry-run,--verbose - Flag values - File paths for
-f/--jakefile, shell names for--completions, group names for--group, and type values for--type
Using Completions
Section titled “Using Completions”After installation, restart your shell (or source your config file):
# Complete recipe namesjake bu<TAB> # → jake build
# Complete flagsjake --<TAB> # Shows all available flags
# Complete flag valuesjake --completions <TAB> # → bash, zsh, fishjake -f <TAB> # → file completionjake --group <TAB> # → groups from the current Jakefilejake --type <TAB> # → task, file, simple, externalMachine-Readable Output
Section titled “Machine-Readable Output”For scripting and integration with other tools:
# Space-separated list of recipe namesjake --summary# Output: build test deploy clean lint
# One recipe per linejake -l --short
# Use in scriptsfor recipe in $(jake --summary); do echo "Found recipe: $recipe"doneTroubleshooting
Section titled “Troubleshooting”Completions Not Working
Section titled “Completions Not Working”- Restart your shell after installation
- Verify the completion file exists:
Terminal window ls ~/.zsh/completions/_jake # zshls ~/.config/fish/completions/jake.fish # fish - For zsh, ensure
compinitis called in your config
Wrong Recipes Showing
Section titled “Wrong Recipes Showing”Completions load recipes from the nearest Jakefile Jake discovers in the current directory or one of its parent directories. Make sure you’re in the right project, or pass -f/--jakefile to point completions at a specific file.
Slow Completions
Section titled “Slow Completions”Recipe names are loaded dynamically. If you have a very large Jakefile with many imports, completions might be slightly delayed.