mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 17:24:50 +01:00
new BSD completion and fix _chown for symlinks (15562)
This commit is contained in:
parent
ab483ef55e
commit
d2f6a686c2
4 changed files with 62 additions and 12 deletions
|
@ -1,5 +1,9 @@
|
|||
2001-08-06 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 15562, Akinori Musha: 15559, 15563: Completion/BSD/Command/_chflags,
|
||||
Completion/Unix/Command/_chown, Completion/Unix/Command/_sysctl:
|
||||
new BSD completion and fix _chown for symlinks
|
||||
|
||||
* 15577: Completion/Unix/Command/_grep,
|
||||
Completion/Unix/Command/_loadkeys: fix exclusion lists
|
||||
|
||||
|
|
45
Completion/BSD/Command/_chflags
Normal file
45
Completion/BSD/Command/_chflags
Normal file
|
@ -0,0 +1,45 @@
|
|||
#compdef chflags
|
||||
|
||||
local flags own='-g *(-u$EUID)'
|
||||
|
||||
flags=(
|
||||
'(noopaque)opaque[set the opaque flag]'
|
||||
'(opaque)noopaque[unset the opaque flag]'
|
||||
'(dump)nodump[set the nodump flag]'
|
||||
'(nodump)dump[unset the nodump flag]'
|
||||
'(nouappnd)uappnd[set the user append-only flag]'
|
||||
'(uappnd)nouappnd[unset the user append-only flag]'
|
||||
'(nouchg)uchg[set the user immutable flag]'
|
||||
'(uchg)nouchg[unset the user immutable flag]'
|
||||
)
|
||||
|
||||
if (( ! EUID )); then
|
||||
flags=( $flags[@]
|
||||
'(noarch)arch[set the archived flag]'
|
||||
'(arch)noarch[unset the archived flag]'
|
||||
'(nosappnd)sappnd[set the system append-only flag]'
|
||||
'(sappnd)nosappnd[unset the system append-only flag]'
|
||||
'(noschg)schg[set the system immutable flag]'
|
||||
'(schg)noschg[unset the system immutable flag]'
|
||||
)
|
||||
unset own
|
||||
fi
|
||||
|
||||
if [[ $OSTYPE = freebsd* ]]; then
|
||||
flags=( $flags[@]
|
||||
'(nouunlnk)uunlnk[set the user undeletable flag]'
|
||||
'(uunlnk)nouunlnk[unset the user undeletable flag]'
|
||||
)
|
||||
(( EUID )) || flags=( $flags[@]
|
||||
'(nosunlnk)sunlnk[set the system undeletable flag]'
|
||||
'(sunlnk)nosunlnk[unset the system undeletable flag]'
|
||||
)
|
||||
fi
|
||||
|
||||
_arguments -s -A "-*" \
|
||||
'(-L -P)-H[follow symlinks on the command line (specify with -R)]' \
|
||||
'(-H -P)-L[follow all symlinks (specify with -R)]' \
|
||||
'(-L -H)-P[do not follow symlinks (specify with -R)]' \
|
||||
'-R[recurse directories]' \
|
||||
':file flag:_values -s , "file flags" $flags[@]' \
|
||||
'*:file:_files "$own"'
|
|
@ -28,6 +28,7 @@ else
|
|||
[[ -n $grp ]] && grp="${${(M)grp:#[0-9]#}:-.$grp.}"
|
||||
req=( ${usr:+\^u$usr} ${grp:+\^g$grp} )
|
||||
(( EUID )) && req=( u$EUID$^req )
|
||||
req=( -$^req )
|
||||
|
||||
_files -g "*(${(j:,:)req})" && return 0
|
||||
fi
|
||||
|
|
|
@ -1,18 +1,7 @@
|
|||
#compdef sysctl
|
||||
|
||||
case $OSTYPE in
|
||||
freebsd[0-4].*)
|
||||
: ${(A)_cache_sysctlvars:=${${$(sysctl -A):#[^a-z]*}%%:*}}
|
||||
_arguments -s -A "-*" \
|
||||
'(-w -X *)-a[list all]' \
|
||||
'(-w -X *)-A[show all opaques (values suppressed)]' \
|
||||
'(-w)-b[binary output]' \
|
||||
'(-w)-n[show only variable values]' \
|
||||
'(-a -A -b -n -X)-w[write mode]' \
|
||||
'(-a -A -w *)-X[show all opaques (entire values)]' \
|
||||
'(-a -A -X)*:sysctl variable:_multi_parts ${words[(r)-w]:+-S=} -i . _cache_sysctlvars'
|
||||
;;
|
||||
freebsd[5-9].*)
|
||||
freebsd[5-9].*|freebsd4.[4-9]*)
|
||||
local -a sysctlvars
|
||||
sysctlvars=( $(sysctl -aN) )
|
||||
_arguments -s -A "-*" \
|
||||
|
@ -24,6 +13,17 @@ case $OSTYPE in
|
|||
'(-o)-x[show opaques as well (entire values)]' \
|
||||
'(-a)*:sysctl variable:_multi_parts -i . sysctlvars'
|
||||
;;
|
||||
freebsd[0-4].*)
|
||||
: ${(A)_cache_sysctlvars:=${${$(sysctl -A):#[^a-z]*}%%:*}}
|
||||
_arguments -s -A "-*" \
|
||||
'(-w -X *)-a[list all]' \
|
||||
'(-w -X *)-A[show all opaques (values suppressed)]' \
|
||||
'(-w)-b[binary output]' \
|
||||
'(-w)-n[show only variable values]' \
|
||||
'(-a -A -b -n -X)-w[write mode]' \
|
||||
'(-a -A -w *)-X[show all opaques (entire values)]' \
|
||||
'(-a -A -X)*:sysctl variable:_multi_parts ${words[(r)-w]:+-S=} -i . _cache_sysctlvars'
|
||||
;;
|
||||
linux*)
|
||||
_arguments -A "-*" \
|
||||
'-n[show only variable values]' \
|
||||
|
|
Loading…
Reference in a new issue