have printa-printer-config && _printa-printer-config() { local cur prev opts base COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" # # The basic options we'll complete. # opts="list-controlled list-non-controlled enable-control disable-control help" # # Complete the arguments to some of the basic commands. # case "${prev}" in enable-control ) local names=$(printa-printer-config list-non-controlled) COMPREPLY=( $(compgen -W "${names}" -- ${cur}) ) return 0 ;; disable-control ) local names=$(printa-printer-config list-controlled) COMPREPLY=( $(compgen -W "${names}" -- ${cur}) ) return 0 ;; *) ;; esac COMPREPLY=($(compgen -W "${opts}" -- ${cur})) return 0 } [ "$have" ] && complete -F _printa-printer-config printa-printer-config