mirror of
https://git.code.sf.net/p/zsh/code
synced 2026-04-18 06:53:35 -04:00
54094: handle rust coreutils in completions
This commit is contained in:
31
ChangeLog
31
ChangeLog
@@ -1,3 +1,34 @@
|
||||
2025-11-24 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 54094: Completion/Unix/Command/_base64,
|
||||
Completion/Unix/Command/_basename, Completion/Unix/Command/_cat,
|
||||
Completion/Unix/Command/_chmod, Completion/Unix/Command/_chown,
|
||||
Completion/Unix/Command/_chroot, Completion/Unix/Command/_cksum,
|
||||
Completion/Unix/Command/_comm, Completion/Unix/Command/_cp,
|
||||
Completion/Unix/Command/_csplit, Completion/Unix/Command/_cut,
|
||||
Completion/Unix/Command/_date, Completion/Unix/Command/_dd,
|
||||
Completion/Unix/Command/_df, Completion/Unix/Command/_du,
|
||||
Completion/Unix/Command/_env, Completion/Unix/Command/_fmt,
|
||||
Completion/Unix/Command/_fold, Completion/Unix/Command/_head,
|
||||
Completion/Unix/Command/_id, Completion/Unix/Command/_install,
|
||||
Completion/Unix/Command/_join, Completion/Unix/Command/_ln,
|
||||
Completion/Unix/Command/_ls, Completion/Unix/Command/_mkdir,
|
||||
Completion/Unix/Command/_mkfifo, Completion/Unix/Command/_mknod,
|
||||
Completion/Unix/Command/_mktemp, Completion/Unix/Command/_mv,
|
||||
Completion/Unix/Command/_nice, Completion/Unix/Command/_nl,
|
||||
Completion/Unix/Command/_od, Completion/Unix/Command/_paste,
|
||||
Completion/Unix/Command/_pr, Completion/Unix/Command/_readlink,
|
||||
Completion/Unix/Command/_rm, Completion/Unix/Command/_rmdir,
|
||||
Completion/Unix/Command/_seq, Completion/Unix/Command/_sort,
|
||||
Completion/Unix/Command/_split, Completion/Unix/Command/_stat,
|
||||
Completion/Unix/Command/_stdbuf, Completion/Unix/Command/_tac,
|
||||
Completion/Unix/Command/_tail, Completion/Unix/Command/_tee,
|
||||
Completion/Unix/Command/_touch, Completion/Unix/Command/_tr,
|
||||
Completion/Unix/Command/_truncate, Completion/Unix/Command/_tty,
|
||||
Completion/Unix/Command/_uname, Completion/Unix/Command/_unexpand,
|
||||
Completion/Unix/Command/_uniq, Completion/Unix/Command/_wc,
|
||||
Completion/Unix/Command/_who: handle rust coreutils in completions
|
||||
|
||||
2025-11-22 dana <dana@dana.is>
|
||||
|
||||
* 54092 (tweaked): Completion/Unix/Command/_git: improve format
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
local variant type=base${service//[^2346]/}
|
||||
|
||||
_pick_variant -r variant \
|
||||
gnu='Free Soft' fourmilab=fourmi darwin=-D unix --version
|
||||
gnu='(Free Soft|uutils)' fourmilab=fourmi darwin=-D unix --version
|
||||
|
||||
case $variant in
|
||||
gnu)
|
||||
@@ -19,7 +19,7 @@ case $variant in
|
||||
'(enc -d --decode)'{-d,--decode}"[decode input from $type]" \
|
||||
'(enc -i --ignore-garbage)'{-i,--ignore-garbage}'[ignore irrelevant characters when decoding]' \
|
||||
+ '(enc)' \
|
||||
'(dec)'{-w+,--wrap=}'[wrap encoded lines at specified number of columns]:number of columns' \
|
||||
'(dec)'{-w+,--wrap=}'[wrap encoded lines at specified number of columns]:number of columns [76]' \
|
||||
+ in \
|
||||
'1:input file:_files'
|
||||
return
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#compdef basename gbasename
|
||||
|
||||
local args variant
|
||||
_pick_variant -r variant gnu=GNU $OSTYPE --version
|
||||
_pick_variant -r variant gnu='(GNU|uutils)' $OSTYPE --version
|
||||
|
||||
case $variant in
|
||||
gnu)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
local -a args
|
||||
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' unix --version; then
|
||||
args=(
|
||||
'(-A --show-all)'{-A,--show-all}'[equivalent to -vET]'
|
||||
'(-b --number-nonblank -n --number)'{-b,--number-nonblank}'[number nonempty output lines, overrides -n]'
|
||||
|
||||
@@ -8,7 +8,7 @@ aopts=( -A '-[^gorstuwxX]*' )
|
||||
|
||||
args=( '*: :->files' '1: :_file_modes' )
|
||||
|
||||
_pick_variant -r variant -b zsh gnu=Free\ Soft $OSTYPE --version
|
||||
_pick_variant -r variant -b zsh gnu='(Free Soft|uutils)' $OSTYPE --version
|
||||
case "$variant" in
|
||||
zsh)
|
||||
# Assign, not append because zf_chmod only supports octal modes.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
local curcontext="$curcontext" state line expl ret=1 variant
|
||||
local suf usr grp req deref pattern arg args aopts=( -A '-*' )
|
||||
|
||||
_pick_variant -r variant -b zsh gnu=Free\ Soft $OSTYPE --version
|
||||
_pick_variant -r variant -b zsh gnu='(Free Soft|uutils)' $OSTYPE --version
|
||||
case "$variant" in
|
||||
gnu)
|
||||
aopts=()
|
||||
|
||||
@@ -4,7 +4,7 @@ local variant ret=1
|
||||
local -a context line state state_descr args
|
||||
local -A opt_args
|
||||
|
||||
_pick_variant -r variant gnu='Free Soft' unix --version
|
||||
_pick_variant -r variant gnu='(Free Soft|uutils)' unix --version
|
||||
|
||||
variant+=-$OSTYPE
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
local -a args
|
||||
|
||||
_pick_variant gnu='Free Soft' unix --version && {
|
||||
_pick_variant gnu='(Free Soft|uutils)' unix --version && {
|
||||
args=(
|
||||
'*: :_files'
|
||||
'(: -)--help[display help information]'
|
||||
|
||||
@@ -10,7 +10,7 @@ args=(
|
||||
'2:file to compare:_files'
|
||||
)
|
||||
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' unix --version; then
|
||||
aopts=( )
|
||||
args+=(
|
||||
'(--nocheck-order)--check-order[check input is correctly sorted]'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#compdef cp gcp
|
||||
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' unix --version; then
|
||||
_arguments -s -S \
|
||||
'(-a --archive)'{-a,--archive}'[archive mode, same as -dR --preserve=all]' \
|
||||
"--attributes-only[don't copy file data, just attributes]" \
|
||||
|
||||
@@ -14,7 +14,7 @@ specs=(
|
||||
'(hv)*: :->patterns'
|
||||
)
|
||||
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' unix --version; then
|
||||
# GNU coreutils 8.32
|
||||
specs+=(
|
||||
'(hv -b --suffix-format -n --digits)'{-b+,--suffix-format=}'[specify format for numbers in output file names]:format [%%02d]: '
|
||||
|
||||
@@ -32,7 +32,7 @@ case $LANG in
|
||||
;;
|
||||
esac
|
||||
|
||||
if _pick_variant gnu="Free Soft" unix --version; then
|
||||
if _pick_variant gnu='(Free Soft|uutils)' unix --version; then
|
||||
_arguments \
|
||||
'(--bytes -b)'{--bytes=,-b+}'['$_cut_args[bytes]']:list' \
|
||||
'(--characters -c)'{--characters=,-c+}'['$_cut_args[characters]']:list' \
|
||||
|
||||
@@ -6,7 +6,7 @@ local -a opts args
|
||||
|
||||
opts=( -s -w -C )
|
||||
|
||||
if _pick_variant gnu="Free Software Foundation" unix --version; then
|
||||
if _pick_variant gnu='(Free Soft|uutils)' unix --version; then
|
||||
local d='(-d --date -f --file -r --reference -s --set --resolution)'
|
||||
local f='(-I --iso-8601 -R --rfc-email --rfc-3339 --resolution)'
|
||||
args=(
|
||||
|
||||
@@ -4,7 +4,7 @@ local -a vals conv flags units
|
||||
local variant
|
||||
|
||||
units=( w:word b:block k:1024 m g t )
|
||||
_pick_variant -r variant gnu=GNU $OSTYPE --version
|
||||
_pick_variant -r variant gnu='(GNU|uutils)' $OSTYPE --version
|
||||
|
||||
vals=(
|
||||
'(ibs obs)bs[block size]: :_numbers -u bytes "block size" $units'
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
local curcontext="$curcontext" state state_descr line args spec ret=1
|
||||
local -A opt_args
|
||||
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' unix --version; then
|
||||
args=(
|
||||
'--total[produce a grand total]'
|
||||
'(-T --print-type)'{-T,--print-type}'[print file system type]'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#compdef du gdu
|
||||
|
||||
if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then
|
||||
if _pick_variant gnu='(Free Soft|uutils)' unix --version /dummy/no-such-file; then
|
||||
local context state line expl ret=1
|
||||
|
||||
_arguments -s \
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
local context state line variant ign ret=1
|
||||
local -a args suf
|
||||
|
||||
_pick_variant -r variant gnu=Free\ Soft $OSTYPE --version
|
||||
_pick_variant -r variant gnu='(Free Soft|uutils)' $OSTYPE --version
|
||||
case $variant in
|
||||
gnu)
|
||||
(( $#words > 2 )) && ign='!'
|
||||
|
||||
@@ -7,9 +7,9 @@ local wopt="[specify maximum line width]:width [75]"
|
||||
local sopt="[don't join short lines\: split only]"
|
||||
|
||||
args=( -A "-*" "(1 2)-w+$wopt" '*:file:_files' )
|
||||
_pick_variant -r variant gnu=GNU $OSTYPE --version
|
||||
_pick_variant -r variant gnu='GNU' uutils=uutils $OSTYPE --version
|
||||
case $variant in
|
||||
gnu)
|
||||
uutils|gnu)
|
||||
args=(
|
||||
'(-c --crown-margin)'{-c,--crown-margin}$copt
|
||||
'(-w --width)'{-w+,--width=}$wopt
|
||||
@@ -22,6 +22,16 @@ case $variant in
|
||||
'(- *)--version[display version information]'
|
||||
'*:file:_files'
|
||||
)
|
||||
;|
|
||||
uutils)
|
||||
args+=(
|
||||
'(-m --preserve-headers)'{-m,--preserve-headers}'[preserve mail headers in the input]'
|
||||
'(-P --skip-prefix)'{-P+,--skip-prefix=}'[preserve lines beginning with given prefix]:prefix'
|
||||
'(-x --exact-prefix)'{-x,--exact-prefix}'[with -p, match at the beginning of the line with no preceding whitespace]'
|
||||
'(-X --exact-skip-prefix)'{-X,--exact-skip-prefix}'[with -P, match at the beginning of the line with no preceding whitespace]'
|
||||
'(-q --quick)'{-q,--quick}'[break lines more quickly at the expense of a more ragged appearance]'
|
||||
'(-T --tab-width)'{-T,--tab-width}'[specify width to treat tabs]:width [8]'
|
||||
)
|
||||
;;
|
||||
solaris*)
|
||||
args=(
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
local variant
|
||||
local -a args
|
||||
|
||||
_pick_variant -r variant busybox=BusyBox gnu='Free Soft' unix --version
|
||||
_pick_variant -r variant busybox=BusyBox gnu='(Free Soft|uutils)' unix --version
|
||||
|
||||
args=(
|
||||
'(-b --bytes)'{-b,--bytes}'[count bytes rather than columns]'
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
local curcontext=$curcontext state state_descr line expl opts args ret=1
|
||||
typeset -A opt_args
|
||||
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' unix --version; then
|
||||
args=(
|
||||
'(-n --lines -c --bytes)'{-c+,--bytes=}'[print the first (or with -, all but the last) specified bytes]:number of bytes:->number'
|
||||
'(-n --lines -c --bytes)'{-n+,--lines=}'[print the first (or with -, all but the last) specified lines]:number of lines:->number'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
local args choices
|
||||
|
||||
if _pick_variant gnu=GNU $OSTYPE --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' $OSTYPE --version; then
|
||||
choices='--help --version -Z --context -g --group -G --groups -u --user'
|
||||
_arguments \
|
||||
"($choices)"{-Z,--context}'[print only security context]' \
|
||||
|
||||
@@ -19,7 +19,7 @@ common_args=(
|
||||
'*: :_files'
|
||||
)
|
||||
|
||||
if _pick_variant gnu='Free Soft' unix --version; then
|
||||
if _pick_variant gnu='(Free Soft|uutils)' unix --version; then
|
||||
# Hide Linux-specific options on non-Linux platforms
|
||||
[[ $OSTYPE == linux* ]] || lx='!'
|
||||
args+=(
|
||||
|
||||
@@ -12,7 +12,7 @@ args=(
|
||||
'(-j -2 -j2)'{-j2,-2+}'[join on specified field of second file]:field number'
|
||||
'1:file:_files' '2:file:_files'
|
||||
)
|
||||
_pick_variant -r variant gnu=GNU $OSTYPE --version
|
||||
_pick_variant -r variant gnu='(GNU|uutils)' $OSTYPE --version
|
||||
case $variant in
|
||||
gnu)
|
||||
args+=(
|
||||
|
||||
@@ -9,7 +9,7 @@ args=(
|
||||
'-s[create symbolic links instead of hard links]'
|
||||
)
|
||||
|
||||
_pick_variant -r variant -b zsh gnu=gnu $OSTYPE --help
|
||||
_pick_variant -r variant -b zsh gnu='(GNU|uutils)' $OSTYPE --version
|
||||
case $variant; in
|
||||
gnu)
|
||||
opts=()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
local arguments is_gnu datef
|
||||
|
||||
if ! _pick_variant gnu=gnu unix --help; then
|
||||
if ! _pick_variant gnu='(GNU|uutils)' unix --version; then
|
||||
arguments=(
|
||||
'(-A)-a[list entries starting with .]'
|
||||
'(-a)-A[list all except . and ..]'
|
||||
|
||||
@@ -10,7 +10,7 @@ args=(
|
||||
'*: :->directories'
|
||||
)
|
||||
|
||||
_pick_variant -r variant -b zsh gnu=gnu $OSTYPE --help
|
||||
_pick_variant -r variant -b zsh gnu='(GNU|uutils)' $OSTYPE --version
|
||||
|
||||
case $variant in
|
||||
gnu|freebsd*|dragonfly*|darwin*)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
local -a aopts args
|
||||
|
||||
if _pick_variant gnu='Free Soft' unix --version; then
|
||||
if _pick_variant gnu='(Free Soft|uutils)' unix --version; then
|
||||
args=(
|
||||
'(: * -)--help[display help information]'
|
||||
'(: * -)--version[display version information]'
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
local -a aopts args
|
||||
|
||||
if _pick_variant gnu='Free Soft' $OSTYPE --version; then
|
||||
if _pick_variant gnu='(Free Soft|uutils)' $OSTYPE --version; then
|
||||
args=(
|
||||
'(: * -)--help[display help information]'
|
||||
'(: * -)--version[display version information]'
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
local variant
|
||||
local -a args
|
||||
|
||||
_pick_variant -r variant busybox=BusyBox gnu='Free Soft' $OSTYPE --version
|
||||
_pick_variant -r variant busybox=BusyBox gnu='(Free Soft|uutils)' $OSTYPE --version
|
||||
|
||||
args=(
|
||||
'(-d --directory)'{-d,--directory}'[make directory instead of file]'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
local args variant aopts=( -A '-*' )
|
||||
|
||||
_pick_variant -r variant -b zsh gnu=GNU $OSTYPE --version
|
||||
_pick_variant -r variant -b zsh gnu='(GNU|uutils)' $OSTYPE --version
|
||||
case $variant; in
|
||||
gnu)
|
||||
aopts=()
|
||||
|
||||
@@ -9,7 +9,7 @@ if [[ $words[2] = -(-|+|)[0-9]## ]]; then
|
||||
fi
|
||||
compset -n 2 # Ignore the 1st arg
|
||||
else
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' unix --version; then
|
||||
specs+=(
|
||||
'(-)'{-n+,--adjustment=}'[adjust niceness]:niceness increment'
|
||||
'(* -)--help[display help and exit]'
|
||||
|
||||
@@ -16,7 +16,7 @@ args=(
|
||||
'(-w --number-width)'{-w+,--number-width=}'[specify number of columns for line numbers]:columns'
|
||||
)
|
||||
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' unix --version; then
|
||||
args+=(
|
||||
'(- *)--help[display help information]'
|
||||
'(- *)--version[display version information]'
|
||||
|
||||
@@ -21,7 +21,7 @@ args=(
|
||||
'-s[output decimal shorts (-t d2)]'
|
||||
)
|
||||
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' unix --version; then
|
||||
# -h -B -I and -L are obsolescent and undocumented
|
||||
args=( ${(R)args:#(|\*)(|\(*\))-[hBIL]*} )
|
||||
args+=(
|
||||
|
||||
@@ -4,7 +4,7 @@ local -a args
|
||||
local dopt='[specify delimiter list]:delimiter list [tab]'
|
||||
local sopt='[paste one file at a time instead of in parallel]'
|
||||
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' unix --version; then
|
||||
args=(
|
||||
'(-z --zero-terminated)'{-z,--zero-terminated}'[use NUL as line delimiter instead of newline]'
|
||||
"(-d)--delimiters=$dopt"
|
||||
|
||||
@@ -5,7 +5,7 @@ local -a state state_descr line specs optA
|
||||
typeset -A opt_args
|
||||
|
||||
# take care of '+FIRST_PAGE[:LAST_PAGE]' (GNU) or '+FIRST_PAGE' (POSIX)
|
||||
if _pick_variant -r variant gnu=GNU $OSTYPE --version; then
|
||||
if _pick_variant -r variant gnu='(GNU|uutils)' $OSTYPE --version; then
|
||||
msg='FIRST_PAGE[:LAST_PAGE]'
|
||||
else
|
||||
msg='first page'
|
||||
|
||||
@@ -24,7 +24,7 @@ args=(
|
||||
)
|
||||
|
||||
# Filter out non-GNU options if applicable
|
||||
if _pick_variant gnu='Free Soft' unix --version; then
|
||||
if _pick_variant gnu='(Free Soft|uutils)' unix --version; then
|
||||
aopts=( )
|
||||
else
|
||||
case $OSTYPE in
|
||||
|
||||
@@ -8,7 +8,7 @@ args=(
|
||||
'(-r -R --recursive)'{-r,-R,--recursive}'[remove directories and their contents recursively]'
|
||||
'*:: :->file'
|
||||
)
|
||||
_pick_variant -r variant -b zsh gnu=gnu $OSTYPE --help
|
||||
_pick_variant -r variant -b zsh gnu='(GNU|uutils)' $OSTYPE --version
|
||||
case $variant; in
|
||||
gnu)
|
||||
opts=()
|
||||
|
||||
@@ -7,13 +7,15 @@ args=(
|
||||
'(-p --parents)'{-p,--parents}'[remove each component of the specified paths]'
|
||||
)
|
||||
|
||||
_pick_variant -r variant -b zsh gnu=GNU $OSTYPE --version
|
||||
_pick_variant -r variant -b zsh gnu='(GNU|uutils)' $OSTYPE --version
|
||||
case $variant; in
|
||||
gnu)
|
||||
aopts=()
|
||||
args+=(
|
||||
'--ignore-fail-on-non-empty[ignore failure if directory is non-empty]'
|
||||
'(-v --verbose)'{-v,--verbose}'[be verbose]'
|
||||
'(- *)--help[display usage information]'
|
||||
'(- *)--version[display version information]'
|
||||
)
|
||||
;;
|
||||
zsh)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
local variant args
|
||||
|
||||
_pick_variant -r variant gnu=GNU $OSTYPE --version
|
||||
_pick_variant -r variant gnu='(GNU|uutils)' $OSTYPE --version
|
||||
|
||||
args=( ':: :_guard "^-[^0-9]*" '{first,step,last} )
|
||||
case $variant in
|
||||
|
||||
@@ -19,7 +19,7 @@ args=(
|
||||
\*{-k+,--key=}'[specified start and end fields for key]:key field'
|
||||
)
|
||||
|
||||
_pick_variant -r variant gnu=GNU $OSTYPE --version
|
||||
_pick_variant -r variant gnu='(GNU|uutils)' $OSTYPE --version
|
||||
case $variant in
|
||||
dragonfly*|netbsd*|openbsd*|freebsd*|darwin*|gnu)
|
||||
args+=(
|
||||
|
||||
@@ -4,7 +4,7 @@ local curcontext="$curcontext" variant ret=1
|
||||
local -A opt_args
|
||||
local -a state line args
|
||||
|
||||
_pick_variant -r variant gnu=GNU $OSTYPE --version
|
||||
_pick_variant -r variant gnu='(GNU|uutils)' $OSTYPE --version
|
||||
|
||||
args=(
|
||||
'-a+[generate suffixes of specified length]:length [2]' \
|
||||
|
||||
@@ -10,7 +10,7 @@ local expl variant ret=1
|
||||
local -a context line state state_descr args aopts=( -A '-*' )
|
||||
local -A opt_args
|
||||
|
||||
_pick_variant -r variant -b zsh gnu='Free Soft' $OSTYPE --version
|
||||
_pick_variant -r variant -b zsh gnu='(Free Soft|uutils)' $OSTYPE --version
|
||||
|
||||
case $variant in
|
||||
zsh)
|
||||
|
||||
@@ -10,7 +10,7 @@ buf=( err in out )
|
||||
opt='[set initial buffering for std${buf[i]}]: : _alternative
|
||||
"sizes\: \: _numbers -u bytes size k M G"
|
||||
"modes\:mode\:((0\:unbuffered L\:line\ buffered'
|
||||
if _pick_variant gnu=GNU freebsd --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' freebsd --version; then
|
||||
gnu=1
|
||||
args=(
|
||||
'(- *)--help[display usage information]'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#compdef tac gtac
|
||||
|
||||
# NetBSD (at least) has its own bare-bones version of this tool
|
||||
_pick_variant gnu='Free Soft' unix --version || {
|
||||
_pick_variant gnu='(Free Soft|uutils)' unix --version || {
|
||||
_default
|
||||
return
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
local curcontext=$curcontext state state_descr line opts args ret=1
|
||||
typeset -A opt_args
|
||||
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' unix --version; then
|
||||
args=(
|
||||
'(-n --lines -c --bytes)'{-c+,--bytes=}'[print the last specified bytes; with +, start at the specified byte]:number of bytes:->number'
|
||||
'(-n --lines -c --bytes)'{-n+,--lines=}'[print the last specified lines; with +, start at the specified line]:number of lines:->number'
|
||||
|
||||
@@ -14,7 +14,7 @@ args=(
|
||||
)
|
||||
|
||||
# Filter out non-GNU options if applicable
|
||||
_pick_variant gnu='Free Soft' unix --version ||
|
||||
_pick_variant gnu='(Free Soft|uutils)' unix --version ||
|
||||
args=( ${(@M)args:#(|*\))-[ai]\[*} )
|
||||
|
||||
_arguments -s -S : $args '*: :_files' && ret=0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#compdef touch gtouch
|
||||
|
||||
local args variant
|
||||
_pick_variant -r variant gnu=GNU $OSTYPE --version
|
||||
_pick_variant -r variant gnu='(GNU|uutils)' $OSTYPE --version
|
||||
|
||||
args=(
|
||||
'-a[change access time (atime)]'
|
||||
|
||||
@@ -9,7 +9,7 @@ descr=(
|
||||
-s '[squeeze repeated instances of character to a single instance]'
|
||||
)
|
||||
|
||||
_pick_variant -r variant gnu=GNU $OSTYPE --version
|
||||
_pick_variant -r variant gnu='(GNU|uutils)' $OSTYPE --version
|
||||
case $variant in
|
||||
gnu)
|
||||
args=(
|
||||
|
||||
@@ -4,7 +4,7 @@ local curcontext=$curcontext variant rs ret=1
|
||||
local -a state state_descr line specs optA
|
||||
typeset -A opt_args
|
||||
|
||||
_pick_variant -r variant gnu=GNU $OSTYPE --version
|
||||
_pick_variant -r variant gnu='(GNU|uutils)' $OSTYPE --version
|
||||
[[ $variant != gnu ]] && rs='-r -s' # -r/-s mutually exclusive
|
||||
|
||||
# common specs
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
local -a args
|
||||
|
||||
if _pick_variant gnu='Free Soft' unix --version; then
|
||||
if _pick_variant gnu='(Free Soft|uutils)' unix --version; then
|
||||
args=(
|
||||
'(-)--help[display help information]'
|
||||
'(-)--version[display version information]'
|
||||
|
||||
@@ -38,7 +38,7 @@ case $LANG in
|
||||
;;
|
||||
esac
|
||||
|
||||
if _pick_variant gnu="Free Soft" unix --version; then
|
||||
if _pick_variant gnu='(Free Soft|uutils)' unix --version; then
|
||||
_arguments -s \
|
||||
'(-)'{--all,-a}'['$_uname_args[all]']' \
|
||||
'(--kernel-name -s)'{--kernel-name,-s}'['$_uname_args[kernel-name]']' \
|
||||
|
||||
@@ -6,7 +6,7 @@ local -a args
|
||||
all="convert all whitespace, instead of just initial whitespace"
|
||||
tabs="[use comma separated list of tab positions]:list of tab positions"
|
||||
|
||||
if _pick_variant gnu="Free Soft" unix --version; then
|
||||
if _pick_variant gnu='(Free Soft|uutils)' unix --version; then
|
||||
if [[ $service = *un* ]]; then
|
||||
args=(
|
||||
"(-a --help --version)--all[$all]"
|
||||
|
||||
@@ -18,7 +18,7 @@ args=(
|
||||
'(- *)--version[display version information]'
|
||||
)
|
||||
|
||||
if ! _pick_variant gnu=Free\ Soft unix --version; then
|
||||
if ! _pick_variant gnu='(Free Soft|uutils)' unix --version; then
|
||||
local optchars="cdufs"
|
||||
if [[ "$OSTYPE" == (darwin|dragonfly|freebsd|openbsd)* ]]; then
|
||||
optchars+=i
|
||||
|
||||
@@ -9,7 +9,7 @@ args=(
|
||||
'(-l --lines)'{-l,--lines}'[print line counts]'
|
||||
)
|
||||
|
||||
if _pick_variant gnu=GNU unix --version; then
|
||||
if _pick_variant gnu='(GNU|uutils)' unix --version; then
|
||||
args+=(
|
||||
'(*)--files0-from=[read NUL-terminated file list from specified file]:file:_files'
|
||||
'(-L --max-line-length)'{-L,--max-line-length}'[print longest line lengths]'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
local args variant
|
||||
|
||||
_pick_variant -r variant gnu=GNU $OSTYPE --version
|
||||
_pick_variant -r variant gnu='(GNU|uutils)' $OSTYPE --version
|
||||
|
||||
case $variant in
|
||||
gnu)
|
||||
|
||||
Reference in New Issue
Block a user