#compdef cxd names=$(_call_program cxd $words[1] --list --short) _cxd() { #printf "\n%s\n" $names _arguments \ --version'[show the version string]' \ -h'[show a short help message]' \ --help'[show a short help message]' \ {-f,--file}'[database file]:(file):_files' \ - execargs \ :name:"($names)" \ - addargs \ {-a,--add}'[add a command]' \ {-c,--cwd}'[save CWD to command]' \ {-d,--dir}'[save DIR to command]' \ \*{-e,--env}'[save ENV to command]:(key=value):' \ :name: \ \*:::cmd:_cmdambivalent \ - removeargs \ {-r,--remove}'[remove a command]' \ {-i,--id}'[remove by ID]' \ :name:"($names)" \ - listargs \ {-l,--list}'[list commands]' \ - clearargs \ --clear'[clear database]' } _cxd