_ufind() { 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 ufind) cmd="ufind" ;; digraph) cmd+="__digraph" ;; help) cmd+="__help" ;; *) ;; esac done case "${cmd}" in ufind) opts=" -h -V --help --version digraph 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 ;; ufind__digraph) opts=" -d -h -V -c -f --description --help --version --convert --filter " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 fi case "${prev}" in --convert) COMPREPLY=("") return 0 ;; -c) COMPREPLY=("") return 0 ;; --filter) COMPREPLY=("") return 0 ;; -f) COMPREPLY=("") return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; ufind__help) opts=" -h -V --help --version " 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 ;; esac } complete -F _ufind -o bashdefault -o default ufind