shitbox/pkg/usr/share/bash-completion/completion/base64.bash

55 lines
1.5 KiB
Bash

_base64() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="base64"
;;
*)
;;
esac
done
case "${cmd}" in
base64)
opts="-d -i -w -c -v -q -h --decode --ignore-space --wrap --color --verbose --quiet --help [FILE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--wrap)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-w)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--color)
COMPREPLY=($(compgen -W "always ansi auto never" -- "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -W "always ansi auto never" -- "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _base64 -o bashdefault -o default base64