How to Set Up Shell Completions#

Barecat provides tab completion for bash and zsh shells.

Bash#

Add to your ~/.bashrc:

source $(barecat completion-script bash)

Or install system-wide:

sudo cp $(barecat completion-script bash) /etc/bash_completion.d/barecat

Reload your shell:

source ~/.bashrc

Zsh#

Add to your ~/.zshrc:

source $(barecat completion-script zsh)

Or install to your completions directory:

cp $(barecat completion-script zsh) ~/.zsh/completions/_barecat

Make sure your .zshrc includes:

fpath=(~/.zsh/completions $fpath)
autoload -Uz compinit && compinit

Reload your shell:

source ~/.zshrc

What Gets Completed#

Commands and aliases:

barecat <TAB>
# create  add  extract  list  ls  cat  shell  browse  du  verify  ...

Options:

barecat create -<TAB>
# -C  --directory  -T  --files-from  -0  --null  ...

Arguments:

barecat create myarchive.barecat <TAB>
# [shows files and directories]

barecat completion-script <TAB>
# bash  zsh

Verifying Installation#

# Should show completion options
barecat <TAB><TAB>

# Should complete to "create"
barecat cre<TAB>

Troubleshooting#

Completions not working#

  1. Check the script exists:

    barecat completion-script bash
    # Should print a path
    
  2. Verify it’s being sourced:

    type _barecat
    # Should show "_barecat is a function"
    
  3. Make sure bash-completion is installed:

    # Debian/Ubuntu
    sudo apt install bash-completion
    
    # macOS
    brew install bash-completion
    

See Also#