_tiempo() { local i cur prev opts cmds COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" cmd="" opts="" for i in ${COMP_WORDS[@]} do case "${i}" in "$1") cmd="tiempo" ;; archive) cmd+="__archive" ;; backend) cmd+="__backend" ;; configure) cmd+="__configure" ;; display) cmd+="__display" ;; edit) cmd+="__edit" ;; help) cmd+="__help" ;; in) cmd+="__in" ;; kill) cmd+="__kill" ;; list) cmd+="__list" ;; month) cmd+="__month" ;; now) cmd+="__now" ;; out) cmd+="__out" ;; resume) cmd+="__resume" ;; sheet) cmd+="__sheet" ;; today) cmd+="__today" ;; week) cmd+="__week" ;; yesterday) cmd+="__yesterday" ;; *) ;; esac done case "${cmd}" in tiempo) opts="-h -V --help --version archive backend configure display today yesterday week month in resume out sheet list kill now edit help" 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 ;; tiempo__archive) opts="-s -e -g -f -t -h --start --end --grep --fake --time --help " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --start) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -s) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --end) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -e) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --grep) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -g) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --time) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__backend) opts="-h --help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__configure) opts="-h --round-in-seconds --database-file --append-notes-delimiter --formatter-search-paths --default-formatter --require-note --no-require-note --auto-checkout --no-auto-checkout --note-editor --week-start --interactive-entries --help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --round-in-seconds) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --database-file) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --append-notes-delimiter) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --formatter-search-paths) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --default-formatter) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --note-editor) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --week-start) COMPREPLY=($(compgen -W "monday tuesday wednesday thursday friday saturday sunday" -- "${cur}")) return 0 ;; --interactive-entries) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__display) opts="-v -s -e -f -g -h --ids --start --end --format --grep --help " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --start) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -s) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --end) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -e) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --format) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -f) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --grep) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -g) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__edit) opts="-s -e -z -m -h --id --start --end --append --move --help " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --id) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --start) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -s) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --end) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -e) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --move) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -m) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__help) opts="..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__in) opts="-h --at --help " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --at) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__kill) opts="-l -h --id --last --help " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --id) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__list) opts="-a -f -h --all --flat --help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__month) opts="-v -f -g -m -h --ids --format --grep --month --help " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --format) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -f) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --grep) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -g) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --month) COMPREPLY=($(compgen -W "this current last jan january feb february mar march apr april may jun june jul july aug august sep september oct october nov november dic december" -- "${cur}")) return 0 ;; -m) COMPREPLY=($(compgen -W "this current last jan january feb february mar march apr april may jun june jul july aug august sep september oct october nov november dic december" -- "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__now) opts="-h --help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__out) opts="-h --at --help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --at) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__resume) opts="-i -h --at --id --interactive --help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --at) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --id) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__sheet) opts="-h --help " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__today) opts="-v -e -f -g -h --ids --end --format --grep --help " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --end) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -e) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --format) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -f) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --grep) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -g) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__week) opts="-v -e -f -g -h --ids --end --format --grep --help " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --end) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -e) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --format) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -f) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --grep) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -g) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; tiempo__yesterday) opts="-v -f -g -h --ids --format --grep --help " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --format) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -f) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --grep) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -g) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; esac if [[ ( $cmd = s* || $cmd = d* || $cmd = k* ) && "$COMP_CWORD" = 2 ]]; then COMPREPLY=($(compgen -W "$(t l --all --flat)" $cur)) return fi } complete -F _tiempo -o bashdefault -o default t