mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-12-28 16:15:02 +01:00
42919: new shuf and uptime completions
This commit is contained in:
parent
3585c28c36
commit
32ac8c5bcb
2 changed files with 54 additions and 0 deletions
28
Completion/Unix/Command/_shuf
Normal file
28
Completion/Unix/Command/_shuf
Normal file
|
@ -0,0 +1,28 @@
|
|||
#compdef shuf gshuf
|
||||
|
||||
local ret=1
|
||||
local -a context line state state_descr
|
||||
local -A opt_args
|
||||
|
||||
_arguments -s -S : \
|
||||
'(: -)--help[display help information]' \
|
||||
'(: -)--version[display version information]' \
|
||||
'(-n --head-count)'{-n+,--head-count=}'[limit output to specified number of lines]:output line limit' \
|
||||
'(-o --output)'{-o+,--output=}'[write result to specified file]:output file:_files' \
|
||||
'--random-source=[use specified file as source of random bytes]: :_files' \
|
||||
'(-r --repeat)'{-r,--repeat}'[allow output lines to repeat]' \
|
||||
'(-z --zero-terminated)'{-z,--zero-terminated}'[use NUL as line delimiter]' \
|
||||
'(-i --input-range)*: :->operands' \
|
||||
+ '(excl)' \
|
||||
{-e,--echo}'[treat operands as input lines]' \
|
||||
'(:)'{-i+,--input-range=}'[treat specified numbers as input lines]:number range (x-y)' \
|
||||
&& ret=0
|
||||
|
||||
[[ $state == operands ]] &&
|
||||
if [[ -n ${opt_args[(i)excl-(-e|--echo)]} ]]; then
|
||||
_message 'input line' && ret=0
|
||||
else
|
||||
_files && ret=0
|
||||
fi
|
||||
|
||||
return ret
|
26
Completion/Unix/Command/_uptime
Normal file
26
Completion/Unix/Command/_uptime
Normal file
|
@ -0,0 +1,26 @@
|
|||
#compdef uptime guptime
|
||||
|
||||
local variant
|
||||
|
||||
_pick_variant -r variant procps=procps gnu='Free Soft' unix --version
|
||||
|
||||
case $variant in
|
||||
procps)
|
||||
_arguments -s -S : \
|
||||
'(: -)'{-h,--help}'[display help information]' \
|
||||
'(: -)'{-V,--version}'[display version information]' \
|
||||
+ '(excl)' \
|
||||
{-p,--pretty}'[display uptime in pretty format]' \
|
||||
{-s,--since}'[display date/time of system boot]'
|
||||
return
|
||||
;;
|
||||
gnu)
|
||||
_arguments -S : \
|
||||
'(: -)--help[display help information]' \
|
||||
'(: -)--version[display version information]' \
|
||||
'1:utmp/wtmp file:_files'
|
||||
return
|
||||
;;
|
||||
# *BSD, Darwin, Solaris, BusyBox
|
||||
*) _message 'no more arguments'; return 1 ;;
|
||||
esac
|
Loading…
Reference in a new issue