Yerbacon/scripts/completions/bash-completion.sh

24 lines
631 B
Bash
Raw Normal View History

# Bash autocomplete script for yerbacon
2021-02-27 14:19:45 +01:00
function YCompReply() { mapfile -t COMPREPLY <<< "$1"; }
_ybconAutoComplete() {
2021-02-27 14:19:45 +01:00
compopt +o default
local current previous options
COMPREPLY=()
current="${COMP_WORDS[COMP_CWORD]}"
previous="${COMP_WORDS[COMP_CWORD-1]}"
options='-h -p --help --parallel --target= --printresult --version'
if [[ "${current}" == -* ]]; then
2021-02-27 14:19:45 +01:00
YCompReply "$(compgen -W "$options" -- "$current")"
return 0
2021-02-27 14:19:45 +01:00
else
case "${previous}" in
-h | --help | --version )
return 0 ;;
2021-02-27 14:19:45 +01:00
esac
complete -f -o plusdirs -X '!*.ybcon' ybcon
fi
}
2021-02-27 14:19:45 +01:00
complete -F _ybconAutoComplete ybcon