Shell completion
Analog Attach can complete commands, options and values when you press
Tab. For example, it completes command names, the options of a command,
the devices of add, the nodes and properties of update, and the values
of config settings. Candidates come from the project’s configuration and
workfile, so they are current.
Supported shells: bash, zsh and fish.
Completion calls analog-attach on your PATH each time you press
Tab, so the package must be installed first (see Installation).
Install the completion
Run:
analog-attach completion --install
The shell is taken from the SHELL environment variable. To choose one
explicitly:
analog-attach completion bash --install
analog-attach completion zsh --install
analog-attach completion fish --install
--install writes one file in your home directory, where the shell loads
completions from. It never edits a shell startup file such as ~/.bashrc or
~/.zshrc. Installing again replaces the earlier file.
Shell |
File written |
What else to do |
|---|---|---|
bash |
|
Needs the |
zsh |
|
Add the directory to |
fish |
|
Open a new shell. |
If XDG_DATA_HOME or XDG_CONFIG_HOME is set to an absolute path, it is
used instead of ~/.local/share or ~/.config.
zsh
Add this line to ~/.zshrc before the call to compinit:
fpath=(~/.local/share/zsh/site-functions $fpath)
bash
If completion doesn’t load in a new shell, check that the bash-completion
package is installed. On Debian and Ubuntu:
sudo apt install bash-completion
Try it without installing
To enable completion in the current shell only, source the script instead:
source <(analog-attach completion bash) # bash
source <(analog-attach completion zsh) # zsh
analog-attach completion fish | source # fish
To keep it, add the line to your shell’s startup file.
Check that it works
Type analog-attach followed by a space and press Tab twice. The list
of commands should appear. Then try analog-attach config <Tab>.
Remove the completion
analog-attach completion --uninstall
This removes the file that --install wrote. If you added an fpath line
to ~/.zshrc, remove it by hand.