diff options
-rw-r--r-- | shell-completion/zsh/_varlinkctl | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/shell-completion/zsh/_varlinkctl b/shell-completion/zsh/_varlinkctl index 720700d04a..c904ebd711 100644 --- a/shell-completion/zsh/_varlinkctl +++ b/shell-completion/zsh/_varlinkctl @@ -4,27 +4,25 @@ local -a reply line _varlinkctl_interfaces() { - local expl - _wanted varlink-interfaces expl interface compadd "$@" -- \ + compadd "$@" -- \ "${(@f)$(_call_program varlink-interfaces varlinkctl list-interfaces $line[2])}" } _varlinkctl_methods() { - local expl - _wanted varlink-interfaces expl method compadd "$@" -- \ + compadd "$@" -- \ "${(@f)$(_call_program varlink-methods varlinkctl list-methods $line[2])}" } local -a varlink_addr=( - /$'[^\0]#\0'/ ':varlink-address:varlink address:_files -g "*(=)"' + /$'[^\0]#\0'/ ':varlink-addresses:varlink address:_files -g "*(=)"' ) local -a varlink_interface=( $varlink_addr - /$'[^\0]#\0'/ ':varlink-interface:varlink interface:_varlinkctl_interfaces' + /$'[^\0]#\0'/ ':varlink-interfaces:varlink interface:_varlinkctl_interfaces' ) local -a varlink_method=( $varlink_addr - /$'[^\0]#\0'/ ':varlink-method:varlink method:_varlinkctl_methods' + /$'[^\0]#\0'/ ':varlink-methods:varlink method:_varlinkctl_methods' ) local -a varlink_call=($varlink_method /$'[^\0]#\0'/ ':argument:argument:()') local -a varlink_idl=(/$'[^\0]#\0'/ ':varlink-idl-file:idl file:_files') @@ -39,7 +37,27 @@ _regex_words varlink-commands 'varlink command' \ 'help:show a help message' local -a varlinkcmd=( /$'[^\0]#\0'/ "$reply[@]" ) -_regex_arguments _varlinkctl_command "$varlinkcmd[@]" +_regex_arguments _varlinkctl_cmd "$varlinkcmd[@]" + +_varlinkctl_command() { + local varlink_command=varlinkctl + ((CURRENT > 2 )) && varlink_command=varlinkctl-$line[1] + + local -a varlink_args + case "$line[1]" in + (info|list-interfaces) + varlink_args=(address) ;; + (introspect|list-methods) + varlink_args=(address interface) ;; + (call) + varlink_args=(address method arguments) ;; + (validate-idl) + varlink_args=(file) ;; + esac + + curcontext="${curcontext%:*:*}:$varlink_command:$varlink_args[CURRENT-2]" + _varlinkctl_cmd "$@" +} local -a opts=( {-h,--help}'[Show a help message and exit]' |