From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20044 invoked by alias); 27 Jan 2018 19:06:15 -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: 42330 Received: (qmail 8380 invoked by uid 1010); 27 Jan 2018 19:06:14 -0000 X-Qmail-Scanner-Diagnostics: from mail-oi0-f47.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.218.47):SA:0(-1.6/5.0):. Processed in 1.20366 secs); 27 Jan 2018 19:06:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_PASS,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: phy1729@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=Cp+hFub2JkD1GyIod9ma5SOeQVchNfCxTnfmVTYcRAk=; b=mukKm0ZWe8dayfUzv3FnBlx6XAxrlonvKhzA/AnXXJcmVW5s8OrfnvpA9hlBFVYC2a m3DN9vgLlbWPfpxqgjNRLOUHhgftN42QF+nt75yF38lPSb5tXW7s+ZclXSSUdNAk5yUs dVy7Q+mo//zukwKdstEI4KKZ+igi6AEZStKuZiwHSwL9w6VjAydpFOL0Bg2A+i4vULwk 8NuAVB43YQOzcFpxY0ena7MliD2Qr+OfIEphF1q+tCL+kOU1n3yldp7WV3+li5ACsj8z 0IYY7C6CA9I6IDrfxlmfJ3t1mo30oeSqMbEM7Zbp97ZbDE9mKC92G5EjlFyphi8lRs4+ CqMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :mime-version:content-disposition:user-agent; bh=Cp+hFub2JkD1GyIod9ma5SOeQVchNfCxTnfmVTYcRAk=; b=Fl6vB9E3KrJubSvxHw6tT9Tr6iVCuutp7vK0wAzXSYWA7+ssMu7h4XuxAtfDHP9MXP NtfT2n4TikfzaDUYsrdANQ3RhJT3UBkMOAEnOToHmxc6YlG3dzrj18Q0F/dsmmbI4bec 8HQFWyp1Bl7fCNx2716s2iyC/be1efG+wB9e7pVPHnsKperuFRUszsvp0OjY2MSO29Nc 4MPuILS4yfjYzXmOe5KS7jjpqc9y6KTmkPGdgSbXEs9dmqVu+tqexYigkkbvAP+N8LaI 4HaAyfTCQBKszcZQWCqPbqJ6l+0Bo0T+2CzaCoBOOlkxrDSPfZyGbFNO6j6U+g95Kxdc kktA== X-Gm-Message-State: AKwxytckYcghZBb+NFKsK8vyHULDB/9nR/hzHSSoneQ5YbBlkes/6GTw HkoTsnWD8V+73LP+m2daFh7DMR1S X-Google-Smtp-Source: AH8x225iYycakOvp/D0QvgfjfkrWCPI77ejBXE9fa7cpKXnMehwg6TCgObVB3Or86awElTH7IGWPAg== X-Received: by 10.202.226.139 with SMTP id z133mr15504122oig.102.1517079969671; Sat, 27 Jan 2018 11:06:09 -0800 (PST) Date: Sat, 27 Jan 2018 13:06:07 -0600 From: Matthew Martin To: zsh-workers@zsh.org Subject: [patch] Update _ln for [DFNO]BSD and Darwin Message-ID: <20180127190607.GA73864@CptOrmolo.darkstar> Mail-Followup-To: zsh-workers@zsh.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) -L and -P are POSIX, but not supported by Darwin or NetBSD (or so the online man pages claim). diff --git a/Completion/Unix/Command/_ln b/Completion/Unix/Command/_ln index efb982aba..764dc8f99 100644 --- a/Completion/Unix/Command/_ln +++ b/Completion/Unix/Command/_ln @@ -3,19 +3,11 @@ local curcontext="$curcontext" state line ret=1 local -A opt_args -local -a args bsd +local -a args opts args=( - '-f[remove existing destination files]' + '(-i)-f[remove existing destination files]' '-s[create symbolic links instead of hard links]' ) -bsd=( - '-F[remove existing destination directories]' - {-h,-n}'[do not dereference destination]' - '-i[prompt before removing destination files]' - '-v[print name of each linked file]' -) - -local -a opts local variant _pick_variant -r variant gnu=gnu unix --help @@ -50,18 +42,40 @@ elif (( ${+builtins[ln]} )); then args+=( '-d[attempt to hard link directories]' {-h,-n}'[do not dereference destination]' - '-i[prompt before removing destination files]') -elif [[ $OSTYPE == darwin* ]]; then - args+=( $bsd ) -elif [[ $OSTYPE == freebsd* ]]; then - args+=( $bsd - '(-L)-P[create hard links directly to symbolic links]' - '(-P)-L[create hard links to symbolic link references]' - "-w[warn if source of a symbolic link doesn't currently exist]" - ) + '(-f)-i[prompt before removing destination files]') +else + case $OSTYPE in + darwin*|dragonfly*|freebsd*|netbsd*|openbsd*) + args+=( + {-h,-n}'[do not dereference destination]' + ) + ;| + darwin*|dragonfly*|freebsd*|netbsd*) + args+=( + '(-f)-i[prompt before removing destination files]' + '-v[print name of each linked file]' + ) + ;| + darwin*|dragonfly*|freebsd*) + args+=( + '-F[remove existing destination directories]' + ) + ;| + dragonfly*|freebsd*|openbsd*) + args+=( + '(-L)-P[create hard links directly to symbolic links]' + '(-P)-L[create hard links to symbolic link references]' + ) + ;| + dragonfly*|freebsd*) + args+=( + "-w[warn if source of a symbolic link doesn't currently exist]" + ) + ;; + esac fi -_arguments -C -s $opts \ +_arguments -C -s $opts : \ $args \ ':link target:_files' \ '*:: :->files' && ret=0