From 5eb09a9cc931ca506875276dcd7b794395ba77d0 Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Sun, 11 Sep 2022 20:42:30 +0200 Subject: archco: implement clone and configure subcommands Manages Git packaging repositories and helps with their configuration according to distro specs. Git author information and the used signing key is set up from makepkg.conf read from any valid location like /etc or XDG_CONFIG_HOME. The configure command can be used to synchronize the distro specs and makepkg.conf settings for previously cloned repositories. The unprivileged option can be used for cloning packaging repositories without SSH access using read-only HTTPS. Signed-off-by: Levente Polyak --- contrib/completion/zsh/_devtools.in | 40 +++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'contrib') 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 -- cgit v1.2.3-70-g09d2