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

39 lines
909 B
Bash
Raw Normal View History

2023-02-13 10:30:46 -05:00
_sha1sum() {
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="sha1sum"
;;
*)
;;
esac
done
case "${cmd}" in
sha1sum)
opts="-c -h -V --check --help --version [FILE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _sha1sum -o bashdefault -o default sha1sum