index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Levente Polyak <anthraxx@archlinux.org> | 2022-09-11 20:42:30 +0200 |
---|---|---|
committer | Levente Polyak <anthraxx@archlinux.org> | 2023-05-19 22:27:11 +0200 |
commit | 5eb09a9cc931ca506875276dcd7b794395ba77d0 (patch) | |
tree | 695a655f240a10b6e9374081cbe2884bb21f027d /contrib/completion/zsh/_devtools.in | |
parent | 66758941594831e5da81a7c00280e73ccc842688 (diff) |
-rw-r--r-- | contrib/completion/zsh/_devtools.in | 40 |
diff --git a/contrib/completion/zsh/_devtools.in b/contrib/completion/zsh/_devtools.in index 707e3fa..1dc112f 100644 --- a/contrib/completion/zsh/_devtools.in +++ b/contrib/completion/zsh/_devtools.in @@ -15,10 +15,24 @@ _archbuild_args=( '--[Introduce makechrootpkg options]:*::makechrootpkg options:= _dispatch makechrootpkg makechrootpkg' ) -_archco_args=( +_archco_cmds=( + "archco command" + "clone[Clone a package repository]" + "configure[Configure a clone according to distro specs]" +) + +_archco_clone_args=( + '(-u --unprivileged)'{-u,--unprivileged}'[Read-only access without packager info as Git author]' + '(-h --help)'{-h,--help}'[Display usage]' '*:packages:_devtools_completions_all_packages' ) +_archco_configure_args=( + '(-u --unprivileged)'{-u,--unprivileged}'[Configure read-only repo without packager info as Git author]' + '(-h --help)'{-h,--help}'[Display usage]' + '*:git_dir:_files -/' +) + _arch_nspawn_args=( '-C[Location of a pacman config file]:pacman_config:_files -g "*.conf(.)"' '-M[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"' @@ -128,8 +142,30 @@ _devtools_completions_all_packages() { } _devtools() { - local argname="_${service//-/_}_args[@]" + local service_func=_${service//-/_} + local service_cmds=${service_func}_cmds + if typeset -p ${service_cmds} &> /dev/null; then + _arguments -C \ + "1: :->cmds" \ + '*::arg:->args' + case $state in + cmds) + local service_cmds_array=${service_cmds}[@] + _values "${(P)service_cmds_array}" + ;; + args) + local cmd_args_array=${service_func}_$line[1]_args + if typeset -p ${cmd_args_array} &> /dev/null; then + local cmd_args=${cmd_args_array}[@] + _arguments -s "${(P)cmd_args}" + fi + ;; + esac + return 0 + fi + local argname="${service_func}_args[@]" _arguments -s "${(P)argname}" + } _devtools |