Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[patch] Update _ln for [DFNO]BSD and Darwin
- X-seq: zsh-workers 42330
- From: Matthew Martin <phy1729@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [patch] Update _ln for [DFNO]BSD and Darwin
- Date: Sat, 27 Jan 2018 13:06:07 -0600
- 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==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
-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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author