From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 8d2852b6 for ; Wed, 24 Apr 2019 17:59:58 +0000 (UTC) Received: (qmail 17494 invoked by alias); 24 Apr 2019 17:59:48 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44250 Received: (qmail 16098 invoked by uid 1010); 24 Apr 2019 17:59:48 -0000 X-Qmail-Scanner-Diagnostics: from mail-it1-f193.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.1/25426. spamassassin: 3.4.2. Clear:RC:0(209.85.166.193):SA:0(-2.1/5.0):. Processed in 2.248265 secs); 24 Apr 2019 17:59:48 -0000 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.193 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=pDeEYr+utadx8YkgYZKTnDsdi13PkY60pjSMy6ujitQ=; b=QYKnNs+BLneaFLbOJOiJsyVdZxy4eWzXEy0Ok9BOoHEFPTmeAkHV2ExVd0C41R2Pw6 8pIGX968kmUfLpjYf8luRHXiKvh3vLhwtHpStPh9t4bGJCZuizBMXp6m4r9suHLnz+hT Y+Vi8M1YNMvixjsBFOwRIklMRo4kZXyh2eaz15AxZgyQrx2SdfQGqCMV8bud3wkPCtTy dXJCkO1A/QXYkqEPCXMNgEVIKdqt90sxZy/0JUg+wvDMjZ50gefuHIEud7Vf1QsqWYpw akjYroOy72M70snXChutYCxUlplQwfaz45gEV9KXn7bUH3F/Tr0m3+t2imFqlWLV7tRW uUag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=pDeEYr+utadx8YkgYZKTnDsdi13PkY60pjSMy6ujitQ=; b=jEJCRDZMu9323fesFQWtDAI1oRSenNCu/3oCEZKF+9IEVoUIDB3AJBLR9+6ZBJY05l e/PMYiIG73PsEbXbylt99C7+z9e0mIkss++Qng9GQa0Yy82yIvXslr9PkbQ3nBLtGYTP z9B3IT4XHQauUMprG5AI1JJd7R7XykI2LxPWicJsjFHBjL/ScX+d+4FngnMnY61xsz+D S0YuCqAZq3JsGRZjQLAi4qtM/ImRicYX0bIQV1lmxqdmvEokgndt2c5ONkUn7bp64iXq +NkZccpHz11kkQLM/KgWeVVw9WYZt7Z5GCTP4+ipmC06woggwt5kpylpxbnZLOu+e46e qNvQ== X-Gm-Message-State: APjAAAVHY2eV3p2E6RodAgnlf2jDhyMuh0ikuBuDDPWPM677QObVqWXz nOHB5IKQ/Eypn8Rc91pkxWFaMCcE3CrAPA== X-Google-Smtp-Source: APXvYqxgNhEaLm62dtYMQ/Ae9HqvNMhn/3y1V50BLgC7tvwoOcMleFhTfNwXCpMLdCcUQaFh/eMjkQ== X-Received: by 2002:a02:942c:: with SMTP id a41mr23295139jai.61.1556128752645; Wed, 24 Apr 2019 10:59:12 -0700 (PDT) From: dana Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: [PATCH] Completion: Fix use of -A and -S options to _arguments Message-Id: Date: Wed, 24 Apr 2019 12:59:11 -0500 To: Zsh hackers list X-Mailer: Apple Mail (2.3445.9.1) Following again on workers/44242. Patch #2: Make use of the -A and -S options to _arguments consistent in = these functions. I can't think of any reason you would ever *not* want to use -S for = these, but someone did go out of their way to make it conditional in _ln =E2=80=94 = if anyone knows why that might be, please tell me. Aside: The use of *:: in _ln and _rm prevents those functions from = offering options after an operand has been given. I can't recall if this = behaviour has ever been discussed here before =E2=80=94 is there a way to deal with = it? dana diff --git a/Completion/Unix/Command/_chmod = b/Completion/Unix/Command/_chmod index e39cfd8ee..f72055b17 100644 --- a/Completion/Unix/Command/_chmod +++ b/Completion/Unix/Command/_chmod @@ -1,7 +1,7 @@ #compdef chmod gchmod zf_chmod =20 local curcontext=3D"$curcontext" state line expl ret=3D1 variant -local -a args privs +local -a args privs aopts=3D( -A '-*' ) =20 args=3D( '*: :->files' '1: :_file_modes' ) =20 @@ -17,6 +17,7 @@ case "$variant" in ) ;; gnu) + aopts=3D() args+=3D( '(-v --verbose -c --changes)'{-c,--changes}'[report changes = made]' '(-v --verbose -c --changes)'{-v,--verbose}'[output a diagnostic = for every file processed]' @@ -63,7 +64,7 @@ case "$variant" in ;; esac =20 -_arguments -C -s "$args[@]" && ret=3D0 +_arguments -C -s -S $aopts "$args[@]" && ret=3D0 =20 case "$state" in files) diff --git a/Completion/Unix/Command/_chown = b/Completion/Unix/Command/_chown index 8fde02096..849607448 100644 --- a/Completion/Unix/Command/_chown +++ b/Completion/Unix/Command/_chown @@ -1,11 +1,12 @@ #compdef chown chgrp gchown=3Dchown gchgrp=3Dchgrp zf_chown=3Dchown = zf_chgrp=3Dchgrp =20 local curcontext=3D"$curcontext" state line expl ret=3D1 variant -local suf usr grp req deref pattern arg args +local suf usr grp req deref pattern arg args aopts=3D( -A '-*' ) =20 _pick_variant -r variant -b zsh gnu=3DFree\ Soft $OSTYPE --version case "$variant" in gnu) + aopts=3D() args=3D( '(-c --changes -v --verbose)'{-c,--changes}'[report each change = made]' '(-c --changes -v --verbose)'{-v,--verbose}'[output info for = every file processed]' @@ -65,7 +66,7 @@ case "$variant" in esac =20 (( $+words[(r)--reference*] )) || args+=3D( '(--reference)1: :->owner' = ) -_arguments -C -s "$args[@]" '*: :->files' && ret=3D0 +_arguments -C -s -S $aopts "$args[@]" '*: :->files' && ret=3D0 =20 case $state in owner) diff --git a/Completion/Unix/Command/_ln b/Completion/Unix/Command/_ln index 339d327fe..d67e54264 100644 --- a/Completion/Unix/Command/_ln +++ b/Completion/Unix/Command/_ln @@ -3,7 +3,7 @@ local curcontext=3D"$curcontext" state line ret=3D1 variant local -A opt_args =20 -local -a args opts +local -a args opts=3D( -A '-*' ) args=3D( '(-i)-f[remove existing destination files]' '-s[create symbolic links instead of hard links]' @@ -12,7 +12,7 @@ args=3D( _pick_variant -r variant -b zsh gnu=3Dgnu $OSTYPE --help case $variant; in gnu) - opts=3D(-S) + opts=3D() args=3D( '(-b --backup)-b[create a backup of each existing destination = file]' \ '(-b --backup)--backup=3D[create a backup of each existing = destination file]::method:(( @@ -70,7 +70,7 @@ case $variant; in ;; esac =20 -_arguments -C -s $opts : \ +_arguments -C -s -S $opts : \ $args \ ':link target:_files' \ '*:: :->files' && ret=3D0 diff --git a/Completion/Unix/Command/_mkdir = b/Completion/Unix/Command/_mkdir index 58d1b8f48..e5c99a1e1 100644 --- a/Completion/Unix/Command/_mkdir +++ b/Completion/Unix/Command/_mkdir @@ -1,12 +1,13 @@ #compdef mkdir gmkdir zf_mkdir =20 -local curcontext=3D"$curcontext" state line expl args variant ret=3D1 +local curcontext=3D"$curcontext" variant ret=3D1 +local -a state line expl args aopts=3D( -A '-*' ) typeset -A opt_args =20 args=3D( '(-m --mode)'{-m,--mode=3D}'[set permission mode]: :_file_modes' '(-p --parents)'{-p,--parents}'[make parent directories as needed]' - '(-)*: :->directories' + '*: :->directories' ) =20 _pick_variant -r variant -b zsh gnu=3Dgnu $OSTYPE --help @@ -18,6 +19,7 @@ case $variant in ) ;| gnu) + aopts=3D() if [[ $OSTYPE =3D=3D linux* ]]; then args+=3D( '(-Z --context)'{-Z,--context=3D}'[set SELinux context]:SELinux = context' @@ -33,7 +35,7 @@ case $variant in ;; esac =20 -_arguments -C -s $args && ret=3D0 +_arguments -C -s -S $aopts $args && ret=3D0 =20 case "$state" in directories) diff --git a/Completion/Unix/Command/_mv b/Completion/Unix/Command/_mv index 2b8ac3273..027b2e68c 100644 --- a/Completion/Unix/Command/_mv +++ b/Completion/Unix/Command/_mv @@ -1,10 +1,11 @@ #compdef mv gmv zf_mv =20 -local args variant +local args variant aopts=3D( -A '-*' ) =20 _pick_variant -r variant -b zsh gnu=3DGNU $OSTYPE --version case $variant; in gnu) + aopts=3D() args=3D( '(-b --backup -n --no-clobber)--backup=3D[make a backup of each = existing destination file]: : _values "backup type" {none,off}"[never make backups]" @@ -50,5 +51,5 @@ case $variant; in ;; esac =20 -_arguments -s -S $args \ +_arguments -s -S $aopts $args \ '*:file:_files' diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm index dfd3a394a..ea9190de2 100644 --- a/Completion/Unix/Command/_rm +++ b/Completion/Unix/Command/_rm @@ -1,7 +1,7 @@ #compdef rm grm zf_rm =20 local variant -declare -a opts args +declare -a args opts=3D( -A '-*' ) args=3D( '(-f --force)'{-f,--force}'[ignore nonexistent files, never prompt]' '(-I --interactive)-i[prompt before every removal]' @@ -11,7 +11,7 @@ args=3D( _pick_variant -r variant -b zsh gnu=3Dgnu $OSTYPE --help case $variant; in gnu) - opts+=3D(-S) + opts=3D() args+=3D( '(-i --interactive)-I[prompt when removing many files]' '(-i -I)--interactive=3D-[prompt under given condition = (defaulting to always)]::when:((once\:"prompt when removing many files" @@ -64,7 +64,7 @@ esac local curcontext=3D$curcontext state line ret=3D1 declare -A opt_args =20 -_arguments -C -s $opts \ +_arguments -C -s -S $opts \ $args && ret=3D0 =20 case $state in diff --git a/Completion/Unix/Command/_rmdir = b/Completion/Unix/Command/_rmdir index 004511558..d330e0aef 100644 --- a/Completion/Unix/Command/_rmdir +++ b/Completion/Unix/Command/_rmdir @@ -1,7 +1,7 @@ #compdef rmdir grmdir zf_rmdir =20 local variant -local -a args +local -a args aopts=3D( -A '-*' ) =20 args=3D( '(-p --parents)'{-p,--parents}'[remove each component of the = specified paths]' @@ -10,6 +10,7 @@ args=3D( _pick_variant -r variant -b zsh gnu=3DGNU $OSTYPE --version case $variant; in gnu) + aopts=3D() args+=3D( '--ignore-fail-on-non-empty[ignore failure if directory is = non-empty]' '(-v --verbose)'{-v,--verbose}'[be verbose]' @@ -26,6 +27,6 @@ case $variant; in ;; esac =20 -_arguments -s -S -A '-*' \ +_arguments -s -S $aopts \ $args \ '*:directories:_directories'