mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-12 01:11:27 +02:00
42330: ln -L and -P are POSIX, but not supported by Darwin or NetBSD
This commit is contained in:
parent
0c324124d0
commit
0236d9c5f1
2 changed files with 37 additions and 20 deletions
|
@ -1,5 +1,8 @@
|
||||||
2018-02-07 Oliver Kiddle <okiddle@yahoo.co.uk>
|
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
|
* wgh@torlan.ru: 42336: Completion/Unix/Command/_adb: force
|
||||||
single column output when getting filenames with adb ls command
|
single column output when getting filenames with adb ls command
|
||||||
|
|
||||||
|
|
|
@ -3,19 +3,11 @@
|
||||||
local curcontext="$curcontext" state line ret=1
|
local curcontext="$curcontext" state line ret=1
|
||||||
local -A opt_args
|
local -A opt_args
|
||||||
|
|
||||||
local -a args bsd
|
local -a args opts
|
||||||
args=(
|
args=(
|
||||||
'-f[remove existing destination files]'
|
'(-i)-f[remove existing destination files]'
|
||||||
'-s[create symbolic links instead of hard links]'
|
'-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
|
local variant
|
||||||
_pick_variant -r variant gnu=gnu unix --help
|
_pick_variant -r variant gnu=gnu unix --help
|
||||||
|
@ -50,18 +42,40 @@ elif (( ${+builtins[ln]} )); then
|
||||||
args+=(
|
args+=(
|
||||||
'-d[attempt to hard link directories]'
|
'-d[attempt to hard link directories]'
|
||||||
{-h,-n}'[do not dereference destination]'
|
{-h,-n}'[do not dereference destination]'
|
||||||
'-i[prompt before removing destination files]')
|
'(-f)-i[prompt before removing destination files]')
|
||||||
elif [[ $OSTYPE == darwin* ]]; then
|
else
|
||||||
args+=( $bsd )
|
case $OSTYPE in
|
||||||
elif [[ $OSTYPE == freebsd* ]]; then
|
darwin*|dragonfly*|freebsd*|netbsd*|openbsd*)
|
||||||
args+=( $bsd
|
args+=(
|
||||||
'(-L)-P[create hard links directly to symbolic links]'
|
{-h,-n}'[do not dereference destination]'
|
||||||
'(-P)-L[create hard links to symbolic link references]'
|
)
|
||||||
"-w[warn if source of a symbolic link doesn't currently exist]"
|
;|
|
||||||
)
|
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
|
fi
|
||||||
|
|
||||||
_arguments -C -s $opts \
|
_arguments -C -s $opts : \
|
||||||
$args \
|
$args \
|
||||||
':link target:_files' \
|
':link target:_files' \
|
||||||
'*:: :->files' && ret=0
|
'*:: :->files' && ret=0
|
||||||
|
|
Loading…
Reference in a new issue