summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2022-09-11 20:42:30 +0200
committerLevente Polyak <anthraxx@archlinux.org>2023-05-19 22:27:11 +0200
commit5eb09a9cc931ca506875276dcd7b794395ba77d0 (patch)
tree695a655f240a10b6e9374081cbe2884bb21f027d /contrib
parent66758941594831e5da81a7c00280e73ccc842688 (diff)
downloaddevtools-5eb09a9cc931ca506875276dcd7b794395ba77d0.tar.xz
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 <anthraxx@archlinux.org>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/zsh/_devtools.in40
1 files changed, 38 insertions, 2 deletions
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