15 lines
451 B
Bash
15 lines
451 B
Bash
__punch_complete() {
|
|
local cmd=$1
|
|
local cur=$2
|
|
local prev=$3
|
|
if [ $COMP_CWORD -eq 1 ]; then
|
|
COMPREPLY=( $(compgen -W "$(punch|grep '^ '|sed 's/^ //'|cut -d' ' -f1)" -- $cur) )
|
|
else
|
|
case "${COMP_WORDS[1]}" in
|
|
start) [ $COMP_CWORD -eq 2 ] && COMPREPLY=( $(compgen -W "$(punch ls)" -- $cur) ) ;;
|
|
today|week|cat|rm) COMPREPLY=( $(compgen -W "$(punch ls)" -- $cur) ) ;;
|
|
esac
|
|
fi
|
|
} &&
|
|
complete -F __punch_complete punch
|