The following adds support for the tab completion of standard Stack arguments to the following shell programs: Bash, Zsh (the Z shell) and fish. Completion of file names and executables within Stack is still lacking. For further information, see issue #823.
Info
Stack's completion library provides hidden options for Bash, Zsh, and fish which output commands used for shell auto-completion. For example:
$ stack --bash-completion-script stack
_stack()
{
local CMDLINE
local IFS=$'\n'
CMDLINE=(--bash-completion-index $COMP_CWORD)
for arg in ${COMP_WORDS[@]}; do
CMDLINE=(${CMDLINE[@]} --bash-completion-word $arg)
done
COMPREPLY=( $(stack "${CMDLINE[@]}") )
}
complete -o filenames -F _stack stack
BashZshfish
Add the output of the following command to your preferred completions file (e.g. ~/.config/bash_completions.d/stack
).
stack --bash-completion-script $(which stack)
You may need to source
this.
Add the output of the following command to your preferred completions file (e.g. ~/.config/zsh/completions/_stack
).
stack --zsh-completion-script $(which stack)
You will not need to source
this, but do update your fpath
:
fpath=($HOME/.config/zsh/completions $fpath)
autoload -U compinit && compinit
Add the output of the following command to your preferred completions file (e.g. ~/.config/fish/completions/stack.fish
).
stack --fish-completion-script $(which stack)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4