Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/lucasgelfond/zerobrew/llms.txt

Use this file to discover all available pages before exploring further.

zerobrew provides shell completion scripts that enable tab completion for commands, subcommands, and options in your shell.

Supported Shells

Completion is available for:
  • bash
  • zsh
  • fish
  • powershell (Windows)
  • elvish

Installing Completion

Use the zb completion command to generate completion scripts for your shell.

Bash

1

Generate completion script

zb completion bash > ~/.local/share/bash-completion/completions/zb
If the directory doesn’t exist:
mkdir -p ~/.local/share/bash-completion/completions
zb completion bash > ~/.local/share/bash-completion/completions/zb
2

Reload your shell

source ~/.bashrc
# or start a new terminal session
3

Test completion

zb ins<TAB>        # Completes to: zb install
zb install --<TAB> # Shows: --build-from-source --no-link

Alternative: Source directly in .bashrc

Add to your ~/.bashrc:
eval "$(zb completion bash)"
Then reload:
source ~/.bashrc

Zsh

1

Generate completion script

Create completions directory if needed:
mkdir -p ~/.zsh/completion
Generate the script:
zb completion zsh > ~/.zsh/completion/_zb
2

Update .zshrc

Add the completion directory to your fpath before compinit in ~/.zshrc:
# Add before compinit
fpath=(~/.zsh/completion $fpath)
autoload -Uz compinit
compinit
If you don’t have compinit yet, add:
autoload -Uz compinit
compinit
3

Reload your shell

source ~/.zshrc
# or
exec zsh
4

Test completion

zb bun<TAB>        # Completes to: zb bundle
zb bundle <TAB>    # Shows: dump install

Alternative: Oh My Zsh users

If you use Oh My Zsh:
zb completion zsh > ~/.oh-my-zsh/completions/_zb
Then reload:
exec zsh

Fish

1

Generate completion script

zb completion fish > ~/.config/fish/completions/zb.fish
Create the directory if needed:
mkdir -p ~/.config/fish/completions
zb completion fish > ~/.config/fish/completions/zb.fish
2

Reload completions

Fish automatically loads completions from ~/.config/fish/completions/. Start a new shell or run:
source ~/.config/fish/completions/zb.fish
3

Test completion

zb mig<TAB>         # Completes to: zb migrate
zb migrate --<TAB>  # Shows: --force --yes

PowerShell (Windows)

Add to your PowerShell profile:
zb completion powershell | Out-String | Invoke-Expression
To find your profile location:
$PROFILE

Elvish

Add to your ~/.elvish/rc.elv:
eval (zb completion elvish)

What Gets Completed

The completion scripts provide suggestions for:

Commands

zb <TAB>
Shows:
bundle      gc          info        list        reset
completion  help        init        migrate     run
install     outdated    uninstall   update

Subcommands

zb bundle <TAB>
Shows:
dump     install

Flags and options

zb install --<TAB>
Shows:
--build-from-source  -s    Build from source instead of bottle
--no-link                  Install without linking
zb migrate --<TAB>
Shows:
--yes     -y    Skip confirmation prompts
--force         Force uninstall from Homebrew

File paths

zb bundle install --file <TAB>
Completes file paths in the current directory.

Updating Completions

When you update zerobrew, regenerate completion scripts to get completions for new commands:
# Bash
zb completion bash > ~/.local/share/bash-completion/completions/zb

# Zsh
zb completion zsh > ~/.zsh/completion/_zb

# Fish
zb completion fish > ~/.config/fish/completions/zb.fish
Then reload your shell.

Troubleshooting

Completions not working in bash

Ensure bash-completion is installed:
# macOS
brew install bash-completion@2

# Ubuntu/Debian
sudo apt-get install bash-completion

# Fedora
sudo dnf install bash-completion
Then verify ~/.bashrc sources it:
# Add to ~/.bashrc if missing
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

Completions not working in zsh

Verify compinit is being called:
grep compinit ~/.zshrc
It should appear after your fpath modifications:
fpath=(~/.zsh/completion $fpath)
autoload -Uz compinit
compinit
If you still have issues, rebuild the completion cache:
rm ~/.zcompdump
exec zsh

Completions not working in fish

Verify the file exists:
ls ~/.config/fish/completions/zb.fish
Check for syntax errors:
fish -n ~/.config/fish/completions/zb.fish
Reload fish config:
source ~/.config/fish/config.fish

Completion file permissions

Ensure completion files are readable:
chmod 644 ~/.local/share/bash-completion/completions/zb
chmod 644 ~/.zsh/completion/_zb
chmod 644 ~/.config/fish/completions/zb.fish

Manual Completion

If you prefer not to install completions permanently, you can source them temporarily:
# Bash
source <(zb completion bash)

# Zsh
source <(zb completion zsh)

# Fish
zb completion fish | source
This enables completions for the current session only.
  • zb --help - View all available commands
  • zb <command> --help - View help for a specific command