Add bash completion. Reindent zsh completion
This commit is contained in:
@@ -2,68 +2,72 @@
|
||||
|
||||
_timer() {
|
||||
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments \
|
||||
'1: :->command' \
|
||||
'2: :->arg1' \
|
||||
'3: :->arg2' \
|
||||
'4: :->arg3'
|
||||
|
||||
case "$state" in
|
||||
(command)
|
||||
_arguments '1:commands:(start stop report deadline refresh help)'
|
||||
;;
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments \
|
||||
'1: :->command' \
|
||||
'2: :->arg1' \
|
||||
'3: :->arg2' \
|
||||
'4: :->arg3'
|
||||
|
||||
case "$state" in
|
||||
(command)
|
||||
# Commands
|
||||
_arguments '1:commands:(start stop report deadline refresh help)'
|
||||
;;
|
||||
|
||||
(arg1)
|
||||
case $words[2] in
|
||||
(start)
|
||||
compadd $(timer tasklist)
|
||||
;;
|
||||
(report)
|
||||
compadd day week month $(timer tasklist)
|
||||
;;
|
||||
(deadline)
|
||||
compadd set clear all $(timer deadlist)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(arg1)
|
||||
# Command argument 1
|
||||
case $words[2] in
|
||||
(start)
|
||||
compadd $(timer tasklist)
|
||||
;;
|
||||
(report)
|
||||
compadd day week month $(timer tasklist)
|
||||
;;
|
||||
(deadline)
|
||||
compadd set clear all $(timer deadlist)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
(arg2)
|
||||
case $words[2] in
|
||||
(report)
|
||||
case $words[3] in
|
||||
(day)
|
||||
compadd $(date +"%Y-%m-%d")
|
||||
(arg2)
|
||||
# Command argument 2
|
||||
case $words[2] in
|
||||
(report)
|
||||
case $words[3] in
|
||||
(day)
|
||||
compadd $(date +"%Y-%m-%d")
|
||||
;;
|
||||
(week)
|
||||
compadd $(date +"%Y-%m-%d")
|
||||
;;
|
||||
(month)
|
||||
compadd $(date +"%Y-%m-%d")
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(deadline)
|
||||
case $words[3] in
|
||||
(set)
|
||||
compadd $(timer tasklist) $(date +"%Y-%m-%d")
|
||||
;;
|
||||
(clear)
|
||||
compadd $(timer deadlist)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(week)
|
||||
compadd $(date +"%Y-%m-%d")
|
||||
;;
|
||||
(month)
|
||||
compadd $(date +"%Y-%m-%d")
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(deadline)
|
||||
case $words[3] in
|
||||
(set)
|
||||
compadd $(timer tasklist) $(date +"%Y-%m-%d")
|
||||
;;
|
||||
(clear)
|
||||
compadd $(timer deadlist)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
(arg3)
|
||||
if [ "$words[2]" = "deadline" ]
|
||||
then
|
||||
compadd $(date +"%Y-%m-%d")
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
(arg3)
|
||||
# Command argument 3
|
||||
if [ "$words[2]" = "deadline" ]
|
||||
then
|
||||
compadd $(date +"%Y-%m-%d")
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_timer "$@"
|
||||
|
||||
Reference in New Issue
Block a user