have zero-center && _zero-center() { local cur prev opts base COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" # # The basic options we'll complete. # opts="-h --help -s -showlist -l --launch" # # Complete the arguments to some of the basic commands. # case "${prev}" in -l) local running=$(ls /usr/share/zero-center/applications | grep .app | sed {s/".app"/""/} ) COMPREPLY=( $(compgen -W "${running}" -- ${cur}) ) return 0 ;; --launch) local names=$(ls /usr/share/zero-center/applications | grep .app | sed {s/".app"/""/} ) COMPREPLY=( $(compgen -W "${names}" -- ${cur}) ) return 0 ;; *) ;; esac COMPREPLY=($(compgen -W "${opts}" -- ${cur})) return 0 } [ "$have" ] && complete -F _zero-center zero-center