summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Martin <phy1729@gmail.com>2018-01-27 13:06:07 -0600
committerOliver Kiddle <opk@zsh.org>2018-02-08 00:37:26 +0100
commit0236d9c5f1513091cf66cf6fec33ad6fb2d88960 (patch)
tree9438e1e062b111a3236ae29a55bfe0785d46cea6
parent0c324124d0c9837cdd3b43a18ec7d22fcd5e9012 (diff)
downloadzsh-0236d9c5f1513091cf66cf6fec33ad6fb2d88960.tar.gz
zsh-0236d9c5f1513091cf66cf6fec33ad6fb2d88960.zip
42330: ln -L and -P are POSIX, but not supported by Darwin or NetBSD
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_ln54
2 files changed, 37 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 95e3656a9..c92a60ecd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2018-02-07 Oliver Kiddle <okiddle@yahoo.co.uk>
+ * Matthew Martin: 42330: Completion/Unix/Command/_ln:
+ -L and -P are POSIX, but not supported by Darwin or NetBSD
+
* wgh@torlan.ru: 42336: Completion/Unix/Command/_adb: force
single column output when getting filenames with adb ls command
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