Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2023-04-14 18:30:10 +0200
committerLevente Polyak <anthraxx@archlinux.org>2023-05-20 00:08:12 +0200
commite1142935e508ac1f70ec3c074655124056dc7666 (patch)
treefc89d7354988cd951a04fd003d7223872e05264e
parentbc182032eb4a1cbae573c9f09bdd9f8338b20d23 (diff)
completion: zsh: allow args even when the command has subcommands
This allows to show arguments on root level of commands that themselves have subcommands available. Complete those when any - is used in the completion word.
-rw-r--r--contrib/completion/zsh/_devtools.in13
1 files changed, 11 insertions, 2 deletions
diff --git a/contrib/completion/zsh/_devtools.in b/contrib/completion/zsh/_devtools.in
index e782fba..cc8d5cf 100644
--- a/contrib/completion/zsh/_devtools.in
+++ b/contrib/completion/zsh/_devtools.in
@@ -233,6 +233,10 @@ _pkgctl_cmds=(
"repo[Manage Git packaging repositories and their configuration]"
)
+_pkgctl_args=(
+ '(-h --help)'{-h,--help}'[Display usage]'
+)
+
_pkgctl_diff_args=("${_diffpkg_args[@]}")
_handle_subcommands() {
@@ -243,8 +247,13 @@ _handle_subcommands() {
'*::arg:->args'
case $state in
cmds)
- local service_cmds=${service_name}_cmds[@]
- _values "${(P)service_cmds}"
+ if [[ "${line[-1]}" == -* ]] && typeset -p ${service_name}_args &> /dev/null; then
+ local argname="${service_name}_args[@]"
+ _arguments -s "${(P)argname}"
+ else
+ local service_cmds=${service_name}_cmds[@]
+ _values "${(P)service_cmds}"
+ fi
;;
args)
local service_sub=${service_name}_$line[1]