Bash Completion

Tab completion for the shell


Completions for the command-line is provided via the bash-completion package which is available for most linux distros and macOS.

On macOS you can install it with brew:

$ brew install bash-completion

on linux use the package manager of your distro.

Then add the completion file cmd/net to:

  • macOS: /usr/local/etc/bash_completion.d/

  • Linux: /etc/bash_completion.d/

and source it with:

  • macOS: . /usr/local/etc/bash_completion.d/net

  • Linux: . /etc/bash_completion.d/net

If you use zeus, simply execute the following in the project root to install the completion script:

$ zeus install-completions

or move and source the file manually from the project root:

$ cp cmd/net /usr/local/etc/bash_completion.d/net && . /usr/local/etc/bash_completion.d/net

Afterwards you should receive predictions when hitting tab in the shell, for subcommands and flags. For flags that expect a path on the filesystem, path completion is available and will only display files with the expected datatype (based on the file extension).

To use completion with zsh run the following:

autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit
cp cmd/net /usr/local/etc/bash_completion.d/net && . /usr/local/etc/bash_completion.d/net

Last updated