2021-02-25 22:02:27 +01:00
|
|
|
# Bash autocomplete script for yerbacon
|
2021-02-25 22:49:26 +01:00
|
|
|
|
2021-02-27 14:19:45 +01:00
|
|
|
function YCompReply() { mapfile -t COMPREPLY <<< "$1"; }
|
|
|
|
|
2021-02-25 22:49:26 +01:00
|
|
|
_ybconAutoComplete() {
|
2021-02-27 14:19:45 +01:00
|
|
|
compopt +o default
|
2021-02-25 22:49:26 +01:00
|
|
|
local current previous options
|
|
|
|
COMPREPLY=()
|
|
|
|
current="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
previous="${COMP_WORDS[COMP_CWORD-1]}"
|
2023-06-12 21:31:46 +02:00
|
|
|
options='-h -p -t -o --help --parallel --target= --newlines= --printresult --text --output --version --buildInfo'
|
2021-02-26 12:32:18 +01:00
|
|
|
if [[ "${current}" == -* ]]; then
|
2021-02-27 14:19:45 +01:00
|
|
|
YCompReply "$(compgen -W "$options" -- "$current")"
|
2021-02-25 22:49:26 +01:00
|
|
|
return 0
|
2021-02-27 14:19:45 +01:00
|
|
|
else
|
|
|
|
case "${previous}" in
|
|
|
|
-h | --help | --version )
|
2021-03-24 11:59:29 +01:00
|
|
|
return 0 ;;
|
2021-02-27 14:19:45 +01:00
|
|
|
esac
|
|
|
|
complete -f -o plusdirs -X '!*.ybcon' ybcon
|
2021-02-25 22:49:26 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-02-27 14:19:45 +01:00
|
|
|
complete -F _ybconAutoComplete ybcon
|