From 98ce8a658ec86cbd115c41e4167bd7002ce63816 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sat, 11 Oct 2014 01:28:10 +0200 Subject: 33424: use common function for completing Debian architectures --- Completion/Debian/Command/_dak | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'Completion/Debian/Command/_dak') diff --git a/Completion/Debian/Command/_dak b/Completion/Debian/Command/_dak index 840fc0017..086196c4a 100644 --- a/Completion/Debian/Command/_dak +++ b/Completion/Debian/Command/_dak @@ -1,31 +1,26 @@ #compdef dak -local curcontext="$curcontext" state line expl cmd args ret=1 -typeset -A opt_args +local expl cmd args ret=1 -_arguments -C \ - '1: :->cmd' \ - '*:: :->args' && ret=0 - -if (( ! $+_dak_cmds )); then +if (( CURRENT == 2 )); then + if (( ! $+_dak_cmds )); then typeset -gH _dak_cmds _dak_cmds=(${${${(f)${"$(_call_program dak dak --help)"#*Availa#ble commands:}}#[^a-z] ##}%%[ ]*}) -fi + fi -if [[ $state != 'args' ]]; then - _describe -t subcommand 'subcommand' _dak_cmds - return 0 + _describe -t subcommands 'subcommand' _dak_cmds + return fi -cmd="$words[1]" -curcontext="${curcontext%:*:*}:dak-$cmd:" +cmd="$words[2]" +local curcontext="${curcontext%:*:*}:dak-$cmd:" args=( '(-)'{--help,-h}'[show help message]' ) case $cmd in (ls) args+=( - '(-a --architecture)'{-a,--architecture=}':arch:_values -s , "architecture list" source all alpha amd64 arm hppa hurd-i386 i386 ia64 mips mipsel' + '(-a --architecture)'{-a,--architecture=}':arch:_sequence _deb_architectures -a "all source"' '(-b --binary-type)'{-b,--binary-type=}':type:(deb udeb)' '(-c --component)'{-c,--component=}':component:_values -s , "component list" main contrib non-free' '(-g --greaterorequal)'{-g,--greaterorequal} @@ -70,7 +65,7 @@ case $cmd in ;; (rm) args+=( - '(-a --architecture)'{-a,--architecture=}':arch:_values -s , "architecture list" source all alpha amd64 arm hppa hurd-i386 i386 ia64 mips mipsel' + '(-a --architecture)'{-a,--architecture=}':arch:_sequence _deb_architectures -a "all source"' '(-b --binary)'{-b,--binary}'[remove binaries only]' '(-c --component)'{-c,--component=}':component:_values -s , "component list" main contrib non-free' '(-C --carbon-copy)'{-C,--carbon-copy=}':cc address:_email_addresses' @@ -96,7 +91,7 @@ case $cmd in (make-suite-file-list) args+=( - '(-a --architecture)'{-a,--architecture=}':arch:_values -s , "architecture list" source all alpha amd64 arm hppa hurd-i386 i386 ia64 mips mipsel' + '(-a --architecture)'{-a,--architecture=}':arch:_sequence _deb_architectures -a "all source"' '(-c --component)'{-c,--component=}':component:_values -s , "component list" main contrib non-free' '(-n --no-delete)'{-n,--no-delete}'[do not delete older versions]' '(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" oldstable stable testing unstable experimental' @@ -239,10 +234,10 @@ case $cmd in ;; (*) - _files + args+=( '*: :_default' ) ;; esac _arguments -s "$args[@]" && ret=0 -return $ret +return ret -- cgit 1.4.1