From: Matthew Martin <phy1729@gmail.com>
To: zsh-workers@zsh.org
Subject: [patch] Update _ln for [DFNO]BSD and Darwin
Date: Sat, 27 Jan 2018 13:06:07 -0600 [thread overview]
Message-ID: <20180127190607.GA73864@CptOrmolo.darkstar> (raw)
-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
reply other threads:[~2018-01-27 19:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180127190607.GA73864@CptOrmolo.darkstar \
--to=phy1729@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).