43 lines
1.2 KiB
Text
43 lines
1.2 KiB
Text
|
#compdef ctt
|
||
|
|
||
|
_ctt()
|
||
|
{
|
||
|
local curcontext="$curcontext" state line
|
||
|
typeset -A opt_args
|
||
|
|
||
|
_arguments \
|
||
|
'1: :->opts_cmds'\
|
||
|
'*: :->opts'
|
||
|
|
||
|
case $state in
|
||
|
opts_cmds)
|
||
|
_arguments '1:Options and commands:(listprojects track report -h --help -d --debug -v --verbose)'
|
||
|
;;
|
||
|
*)
|
||
|
case $words[2] in
|
||
|
track|report)
|
||
|
projects=($(ls ~/.ctt))
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
case $words[2] in
|
||
|
listprojects|-*)
|
||
|
opts=(-h --help -d --debug -v --verbose)
|
||
|
compadd "$@" -- $opts
|
||
|
;;
|
||
|
track)
|
||
|
opts=(-h --help -d --debug -v --verbose --sd --start --ed --end -n --no-comment)
|
||
|
compadd "$@" -- $opts $projects
|
||
|
;;
|
||
|
report)
|
||
|
opts=(-h --help -d --debug -v --verbose --sd --start --ed --end -a --all -e --regexp -i --ignore-case -f -format -s --summary)
|
||
|
compadd "$@" -- $opts $projects
|
||
|
;;
|
||
|
*)
|
||
|
;;
|
||
|
esac
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
_ctt "$@"
|