Shell Completion¶
Pipes includes a helper --_completion
flag which can be
used by terminals to provide autocomplete options.
Below are instructions for setting up autocompletion
for Bash, Zsh, Fish, and pdksh.
If you have ideas for improving these please share them with use over at the Pipes repo
Warning
Pipes cannot activate an pipenv shell when one is already active, thefore the autocompletion helper does not run either. Make sure you are not inside a Pipenv Shell when trying to use the autocomplete helper.
Fish¶
Add a new file pipes.fish
to your Fish config folder
(eg. ~/.config/fish/completions/pipes.fish
).
complete --command pipes --arguments '(pipes --_completion (commandline -cp))' --no-files
Bash + Zsh¶
Original code kindly provided by jonatasbaldin here
Add the code below to your .bashrc:
# .bashrc
export BASE_SHELL=$(basename $SHELL)
if [[ "$BASE_SHELL" == "zsh" ]] ; then
autoload bashcompinit && bashcompinit
fi
_pipenv-pipes_completions() {
COMPREPLY=($(compgen -W "$(pipes --_completion)" -- "${COMP_WORDS[1]}"))
}
complete -F _pipenv-pipes_completions pipes
pdksh¶
pdksh is native shell on OpenBSD.
To have a shell completion, write into your personal ~/.profile
, after the call of exported environments variables for your Python, as WORKON_HOME:
set -A complete_pipes -- $(pipes --_completion)
Restart your session or a new terminal ;)