index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Levente Polyak <anthraxx@archlinux.org> | 2022-09-12 01:34:08 +0200 |
---|---|---|
committer | Levente Polyak <anthraxx@archlinux.org> | 2023-05-19 22:27:12 +0200 |
commit | a8be7423efb287edd5ef80002a75a853fc0c9c1d (patch) | |
tree | 327592b654c18c8b66d0919570f7cdc973c65e04 /contrib | |
parent | d15bd29a9d411dedc0a0682ec54b55e079d4f00f (diff) |
-rw-r--r-- | contrib/completion/zsh/_devtools.in | 42 |
diff --git a/contrib/completion/zsh/_devtools.in b/contrib/completion/zsh/_devtools.in index d30648a..959497e 100644 --- a/contrib/completion/zsh/_devtools.in +++ b/contrib/completion/zsh/_devtools.in @@ -1,4 +1,4 @@ -#compdef archbuild pkgrepo arch-nspawn archrelease commitpkg diffpkg finddeps makechrootpkg mkarchroot rebuildpkgs extrapkg=commitpkg corepkg=commitpkg testingpkg=commitpkg stagingpkg=commitpkg communitypkg=commitpkg community-testingpkg=commitpkg community-stagingpkg=commitpkg multilibpkg=commitpkg multilib-testingpkg=commitpkg extra-x86_64-build=archbuild testing-x86_64-build=archbuild staging-x86_64-build=archbuild multilib-build=archbuild multilib-testing-build=archbuild multilib-staging-build=archbuild kde-unstable-x86_64-build=archbuild gnome-unstable-x86_64-build=archbuild checkpkg sogrep offload-build makerepropkg +#compdef archbuild pkgrepo arch-nspawn archrelease commitpkg pkgctl diffpkg finddeps makechrootpkg mkarchroot rebuildpkgs extrapkg=commitpkg corepkg=commitpkg testingpkg=commitpkg stagingpkg=commitpkg communitypkg=commitpkg community-testingpkg=commitpkg community-stagingpkg=commitpkg multilibpkg=commitpkg multilib-testingpkg=commitpkg extra-x86_64-build=archbuild testing-x86_64-build=archbuild staging-x86_64-build=archbuild multilib-build=archbuild multilib-testing-build=archbuild multilib-staging-build=archbuild kde-unstable-x86_64-build=archbuild gnome-unstable-x86_64-build=archbuild checkpkg sogrep offload-build makerepropkg # # SPDX-License-Identifier: GPL-3.0-or-later @@ -149,31 +149,47 @@ _devtools_completions_all_packages() { compadd - "${(@)packages}" } -_devtools() { - local service_func=_${service//-/_} - local service_cmds=${service_func}_cmds - if typeset -p ${service_cmds} &> /dev/null; then +_pkgctl_cmds=( + "pkgctl command" + "diff[Compare package files using different modes]" + "repo[Manage Git packaging repositories and their configuration]" +) + +_pkgctl_diff_args=("${_diffpkg_args[@]}") + +_pkgctl_repo_cmds=("${_pkgrepo_cmds[@]}") +_pkgctl_repo_clone_args=("${_pkgrepo_clone_args[@]}") +_pkgctl_repo_configure_args=("${_pkgrepo_configure_args[@]}") + +_handle_subcommands() { + local service_name=${1} + if typeset -p ${service_name}_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}" + local service_cmds=${service_name}_cmds[@] + _values "${(P)service_cmds}" ;; 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}[@] + local service_sub=${service_name}_$line[1] + if typeset -p ${service_sub}_args &> /dev/null; then + local cmd_args=${service_sub}_args[@] _arguments -s "${(P)cmd_args}" + elif typeset -p ${service_sub}_cmds &> /dev/null; then + _handle_subcommands "${service_sub}" fi ;; esac - return 0 + elif typeset -p ${service_name}_args &> /dev/null; then + local argname="${service_name}_args[@]" + _arguments -s "${(P)argname}" fi - local argname="${service_func}_args[@]" - _arguments -s "${(P)argname}" +} +_devtools() { + _handle_subcommands _${service//-/_} } _devtools |