_fwupdagent_cmd_list=( 'get-devices' 'get-updates' 'get-upgrades' 'security' ) _fwupdagent_opts=( '--verbose' ) _show_modifiers() { COMPREPLY+=( $(compgen -W '${_fwupdagent_opts[@]}' -- "$cur") ) } _fwupdagent() { local cur prev command arg args COMPREPLY=() _get_comp_words_by_ref cur prev _get_first_arg _count_args case $arg in *) #find first command if [[ "$args" = "1" ]]; then COMPREPLY=( $(compgen -W '${_fwupdagent_cmd_list[@]}' -- "$cur") ) fi ;; esac #modifiers _show_modifiers return 0 } complete -F _fwupdagent fwupdagent