diff options
Diffstat (limited to 'Completion/Unix/Command')
53 files changed, 817 insertions, 234 deletions
diff --git a/Completion/Unix/Command/_ack b/Completion/Unix/Command/_ack index 626e54e0f..e83a9330e 100644 --- a/Completion/Unix/Command/_ack +++ b/Completion/Unix/Command/_ack @@ -21,17 +21,18 @@ zstyle -s ":completion:${curcontext}:" cache-policy update_policy typeset -ga _ack_raw_types if _cache_invalid ack-types || ! _retrieve_cache ack-types; then - (( ${+commands[${words[1]}]} )) && _ack_raw_types=( - ${(S)${(S)${(f)${${"$(_call_program file-types $words[1] --help=types)"}#*--\[no\]}}%; first line matches \/*\/}#*no\]} ) + _ack_raw_types=( + ${(S)${(S)${(f)${${"$(_call_program file-types $words[1] --help-types)"}#*--\[no\]}}%; ?irst line matches \/*\/}#*no\]} ) [[ $#_ack_raw_types -gt 0 ]] && _store_cache ack-types _ack_raw_types fi (( $#words > 2 )) && ign='!' _arguments -C -s -S \ - '(-i --ignore-case --smart-case --no-smart-case --nosmart-case --lines)'{-i,--ignore-case}'[match case-insensitively]' \ - '(-i --ignore-case --no-smart-case --nosmart-case --lines)--smart-case[case-insensitive match unless pattern includes uppercase]' \ - '(-i --ignore-case --smart-case --no-smart-case --nosmart-case --lines)'{--no-smart-case,--nosmart-case}'[disable --smart-case option]' \ + '(-i --ignore-case -I -S --smart-case --no-smart-case --nosmart-case --lines)'{-i,--ignore-case}'[match case-insensitively]' \ + '(-i --ignore-case -I -S --no-smart-case --nosmart-case --lines)'{-S,--smart-case}'[case-insensitive match unless pattern includes uppercase]' \ + '(-i --ignore-case -I -S --smart-case --no-smart-case --nosmart-case --lines)'{--no-smart-case,--nosmart-case}'[disable --smart-case option]' \ + '(-i --ignore-case -S --smart-case --no-smart-case --nosmart-case --lines)-I[turn on case-sensitivity in pattern]' \ '(-v --invert-match)'{-v,--invert-match}'[select non-matching lines]' \ '(-w --word-regexp)'{-w,--word-regexp}'[force pattern to match only whole words]' \ '(-Q --literal)'{-Q,--literal}'[use literal strings]' \ @@ -59,10 +60,12 @@ _arguments -C -s -S \ '(--nobreak --break)'{--nobreak,--break}'[print a break between results from different files, default on]' \ '(--nogroup)--group[group matches by file name]' \ "(--group)--nogroup[don't group matches by file name]" \ + '--proximate=[separate match output with blank lines unless they are adjacent]::proximity (lines)' \ '(--nocolor --nocolour)--colo'{,u}'r[enable color highlighting of output]' \ - '(--color --colour --color-filename --color-match --color-lineno)--nocolo'{,u}'r[suppress the color]' \ + '(--color --colour --color-filename --color-match --color-colno --color-lineno)--nocolo'{,u}'r[suppress the color]' \ '(--nocolor --nocolour --color --colour)--color-filename=[sets the color to be used for filenames]:color:->colors' \ '(--nocolor --nocolour --color --colour)--color-match=[sets the color to be used for matches]:color:->colors' \ + '(--nocolor --nocolour --color --colour)--color-colno=[specify color for column numbers]:color:->colors' \ '(--nocolor --nocolour --color --colour)--color-lineno=[specify color for line numbers]:color:->colors' \ '--flush[flush output on every line]' \ '(1)-f[only print the files that would be searched, without actually doing any searching]' \ @@ -92,6 +95,8 @@ _arguments -C -s -S \ '(--filter --nofilter)--filter[treat standard input as pipe]' \ '(--filter --nofilter)--nofilter[treat standard input as tty]' \ "${ign}(- 1 *)--man[display the manual page]" \ + "${ign}(- 1 *)--faq[display the frequently asked questions]" \ + "${ign}(- 1 *)--cookbook[display a list of tips and tricks for using ack]" \ "${ign}(- 1 *)--version[display version and copyright information]" \ "${ign}(- 1 *)--bar[consult Admiral Ackbar]" \ "${ign}(- 1 *)--thpppt[bill the cat]" \ diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb index 776a03cbc..75a447dfc 100644 --- a/Completion/Unix/Command/_adb +++ b/Completion/Unix/Command/_adb @@ -112,6 +112,9 @@ _adb_dispatch_command () { (*:adb-shell:) (( $+functions[_adb_dispatch_shell] )) && _adb_dispatch_shell ;; + (*:adb-backup:) + (( $+functions[_adb_dispatch_backup] )) && _adb_dispatch_backup + ;; (*:adb-connect:|*:adb-disconnect:) (( $+functions[_adb_dispatch_connection_handling] )) && _adb_dispatch_connection_handling ;; @@ -191,6 +194,18 @@ _adb_dispatch_shell () { esac } +(( $+functions[_adb_dispatch_backup] )) || +_adb_dispatch_backup() { + _arguments \ + '-f[specify backup file]:backup file:_files' \ + '-apk[backup .apk files]' '!(-apk)-noapk' \ + '-obb[backup .obb files]' '!(-obb)-noobb' \ + '-shared[backup shared storage]' '!(-shared)-noshared' \ + '-all[backup all installed apps]' \ + '-nosystem[include system apps when backing up all apps]' '!(-nosystem)-system' \ + '*:package name:_adb_installed_packages' +} + (( $+functions[_adb_pm_list] )) || _adb_pm_list () { case ${words[4]} in @@ -298,7 +313,7 @@ _adb_package_manager_handler () { (getInstallLocation) ;; (*) - _wanted pm_argument expl 'pm argument' compadd list path install unistall enable disable setInstallLocation getInstallLocation + _wanted pm_argument expl 'pm argument' compadd list path install uninstall enable disable setInstallLocation getInstallLocation ;; esac } diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible index 330ef66b7..89a4998b7 100644 --- a/Completion/Unix/Command/_ansible +++ b/Completion/Unix/Command/_ansible @@ -1,6 +1,6 @@ #compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault -local curcontext="$curcontext" plug plugvar ret=1 +local curcontext="$curcontext" plug plugvar ign ret=1 local -a args state line local -A opt_args @@ -30,7 +30,7 @@ case $service in '(-D --diff)'{-D,--diff}'[show differences when changing small files and templates]' '(-b --become)'{-b,--become}'[escalate privileges on remote system]' '(-f --forks)'{-f+,--forks=}'[specify number of parallel processes to use]:processes [5]' - '--become-method=[specify privilege escalation method to use]:method [sudo]:(sesu sudo su pbrun pfexec doas dzdo ksu runas pmrun enable)' + '--become-method=[specify privilege escalation method to use]:method [sudo]:(sudo su pbrun pfexec doas dzdo ksu runas pmrun enable machinectl)' '--become-user=[specify remote user for running operations]:user:_users' "--syntax-check[perform a syntax check on the playbook, but don't execute it]" '!(-R --su-user -U --sudo-user)'{-R,-U,--su-user,--sudo-user}':user [root]:_users' @@ -102,6 +102,7 @@ case $service in ;; ansible-doc) args+=( + '!(-l --list -F --list_files -s --snippet)'{-j,--json} # "internal testing only" '(-l --list -F --list_files -s --snippet)'{-l,--list}'[list available plugins]' '(-l --list -F --list_files -s --snippet)'{-F,--list_files}'[show plugin names and their source files without summaries]' '(-l --list -F --list_files -s --snippet)'{-s,--snippet}'[show playbook snippet for specified plugins]' @@ -143,6 +144,7 @@ case $service in ansible-pull) args+=( "--check[don't make any changes]" + '--diff[show the differences in changed files]' '(-d --directory)'{-d+,--directory=}'[specify directory to checkout repository to]:directory:_directories' '--full[do a full instead of a shallow clone]' '(-m --module-name)'{-m+,--module-name=}'[specify repository module used for checking out repository]:module:(git subversion hg bzr)' @@ -167,9 +169,10 @@ case $service in ;; esac +(( $#words > 2 )) && ign='!' _arguments -s -S -C $args \ - '(- :)--version[display version information]' \ - '(- :)'{-h,--help}'[display usage information]' \ + "${ign}(- :)--version[display version information]" \ + "${ign}(- :)"{-h,--help}'[display usage information]' \ \*{-v,--verbose}"[verbose mode (repeat to increase)]" && ret=0 plug=${(v)opt_args[(i)-(t|-type)]:-module} @@ -220,11 +223,18 @@ case $state in fi ;; galaxy) + ign='' curcontext="${curcontext%:*}-${line[1]}:" - args=() + (( $#words > 2 )) && ign='!' + args=( + "${ign}(-)"{-h,--help}'[display usage information]' + '(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]' + '(-s --server)'{-s+,--server=}'[specify API server destination]:server:_hosts' + {-v,--verbose}'[verbose mode]' + ) case $line[1] in info|search|list|remove|install) - args=( '(-p --roles-path)'{-p,--roles-path}'[specify location of roles]:path:_directories' ) + args+=( '(-p --roles-path)'{-p,--roles-path}'[specify location of roles]:path:_directories' ) ;| info|init) args+=( "--offline[don't query the galaxy API]" ) @@ -241,22 +251,23 @@ case $state in ) ;; setup) - args=( + args+=( '--list[list integrations]' '--remove=[remove integration]:integration id' ) ;; init) args+=( - '--container-enabled[initialize the skeleton role with default contents for a Container Enabled role]' '--init-path=[specify path in which the skeleton role will be created]:path:_directories' '--role-skeleton=[specify path to a role skeleton that the new role should be based upon]' + '--type=[initialize using an alternate role type]:role type:(container apb network)' ) ;; install) args+=( '(-n --no-deps)'{-n,--no-deps}"[don’t download roles listed as dependencies]" '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors and continue with the next specified role]' + '(-g --keep-scm-meta)'{-g,--keep-scm-meta}'[use tar instead of the scm archive option when packaging the role]' '(-r --role-file)'{-r+,--role-file=}'[specify file containing a list of roles to be imported]:file:_files' ) ;; diff --git a/Completion/Unix/Command/_asciidoctor b/Completion/Unix/Command/_asciidoctor new file mode 100644 index 000000000..3839c7ed3 --- /dev/null +++ b/Completion/Unix/Command/_asciidoctor @@ -0,0 +1,42 @@ +#compdef asciidoctor + +# Notes: +# - We don't offer -v for verbose, even though that works in some cases +# - @todo We don't complete arguments to -E and -r. Unclear how they work. +# Should we offer gem names from `gem list`...? + +_arguments -s -S : \ + '(: * -)'{-h+,--help=}'[display help information]::help topic:(( + manpage\:"dump man page" + ))' \ + '(: * -)'{-V,--version}'[display version information]' \ + '(-q -v --quiet --verbose)'{-q,--quiet}'[reduce output verbosity]' \ + '(-q -v --quiet --verbose)'{-v,--verbose}'[increase output verbosity]' \ + '*'{-a+,--attribute=}'[set/unset specified document attribute]:document attribute' \ + '(-b --backend)'{-b+,--backend=}'[specify backend output format]:backend:( + docbook docbook45 docbook5 html html5 manpage + )' \ + '(-B --base-dir)'{-B+,--base-dir=}'[specify document base directory]:base directory:_files -/' \ + '(-d --doctype)'{-d+,--doctype=}'[specify document type]:document type:( + article book inline manpage + )' \ + '(-D --destination-dir)'{-D+,--destination-dir=}'[specify destination directory]:destination directory:_files -/' \ + '(-e --eruby)'{-e+,--eruby=}'[specify eRuby implementation]:eRuby implementation:(erb erubis)' \ + '(-E --template-engine)'{-E+,--template-engine=}'[specify template engine]:template engine' \ + '--failure-level=[specify minimum logging level to trigger non-zero exit]:failure logging level [FATAL]:( + WARNING ERROR FATAL + )' \ + '*'{-I+,--load-path=}'[add specified directory to load path]:extension directory:_files -/' \ + '(-n --section-numbers)'{-n,--section-numbers}'[auto-number section titles]' \ + '(-o --out-file)'{-o+,--out-file=}'[specify output file]:output file:_files' \ + '(-R --source-directory)'{-R+,--source-dir=}'[specify source directory]:source directory:_files -/' \ + '*'{-r+,--require=}'[require specified library]:Ruby library' \ + '(-s --no-header-footer)'{-s,--no-header-footer}'[suppress document header/footer]' \ + '(-S --safe --safe-mode)'{-S+,--safe-mode=}'[specify safe-mode level]:safe-mode level [unsafe]:( + unsafe safe server secure + )' \ + '(-S --safe-mode)--safe[set safe-mode level to safe]' \ + '(-t --timings)'{-t,--timings}'[display timing information]' \ + '*'{-T+,--template-dir=}'[specify template directory]:template directory:_files -/' \ + '--trace[include backtrace information on errors]' \ + '*:source file:_files' diff --git a/Completion/Unix/Command/_asciinema b/Completion/Unix/Command/_asciinema new file mode 100644 index 000000000..8e94f0d1e --- /dev/null +++ b/Completion/Unix/Command/_asciinema @@ -0,0 +1,59 @@ +#compdef asciinema + +local ret=1 +local -a context line state state_descr help +local -A opt_args + +help=( '(: * -)'{-h,--help}'[display help information]' ) + +_arguments -A '-*' \ + $help \ + '(: * -)--version[display version information]' \ + '1:command:(( + auth\:"link install ID with asciinema.org account" + cat\:"dump full output of recorded session" + play\:"play back recorded session" + rec\:"record session" + upload\:"upload recorded session" + ))' \ + '*:: :->next' \ +&& ret=0 + +[[ $state == next ]] && +case $words[1] in + auth) + _arguments -s -S : $help && ret=0 + ;; + cat|upload) + _arguments -s -S : $help '1::recording file:_files' && ret=0 + ;; + play) + _arguments -s -S : \ + $help \ + '(-i --idle-time-limit)'{-i+,--idle-time-limit=}'[specify max idle time]:max idle time (seconds)' \ + '(-s --speed)'{-s+,--speed=}'[specify playback speed]:speed factor' \ + '1: :->files-urls' \ + && ret=0 + [[ $state == files-urls ]] && + _alternative 'files:recording file:_files' 'urls: :_urls' && + ret=0 + ;; + rec) + _arguments -s -S : \ + $help \ + '(--overwrite)--append[append to existing recording]' \ + '(-c --command)'{-c+,--command=}'[specify command to record]: :_path_commands' \ + '(-e --env)'{-e+,--env=}'[specify environment variables to capture]:environment variable:_sequence _parameters -g "*export*"' \ + '(-i --idle-time-limit)'{-i+,--idle-time-limit=}'[specify max idle time]:max idle time (seconds)' \ + '(-q -y --quiet --yes)'{-q,--quiet}'[suppress notices/warnings (implies -y)]' \ + '--raw[save raw stdout output, without timing or other metadata]' \ + '--stdin[enable stdin (keyboard) recording]' \ + '(-t --title)'{-t+,--title=}'[specify title of recording]:title' \ + '(--append)--overwrite[overwrite existing recording]' \ + '(-y --yes)'{-y,--yes}'[bypass confirmation prompts]' \ + '1::recording file:_files' \ + && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_awk b/Completion/Unix/Command/_awk index 4063743e5..b23ecdf9d 100644 --- a/Completion/Unix/Command/_awk +++ b/Completion/Unix/Command/_awk @@ -21,7 +21,7 @@ args=( '*'{-v+,--assign}'[assign values to variables]:assignment:' '(1)*'{-f+,--file}'[read program file]:program file:->script' '1: :_guard "^-*" "program text"' - '*:input files:_files' + '*:input file:_files' ) case $variant in diff --git a/Completion/Unix/Command/_cat b/Completion/Unix/Command/_cat index e383f8c6b..c78dc4cd9 100644 --- a/Completion/Unix/Command/_cat +++ b/Completion/Unix/Command/_cat @@ -16,7 +16,7 @@ if _pick_variant gnu=GNU unix --version; then '(-v --show-nonprinting)'{-v,--show-nonprinting}'[use ^ and M- notation, except for LFD and TAB]' '(- : *)--help[display help and exit]' '(- : *)--version[output version information and exit]' - '*:files:_files' + '*: :_files' ) elif [[ "$OSTYPE" == (*bsd|dragonfly|darwin)* ]]; then @@ -29,7 +29,7 @@ elif [[ "$OSTYPE" == (*bsd|dragonfly|darwin)* ]]; then '(-v)-t[display tab as ^I (implies -v)]' '-u[do not buffer output]' '-v[display non-printing chars as ^X or M-a]' - '*:files:_files' + '*: :_files' ) [[ $OSTYPE = (free|net)bsd* ]] && args+=( '-l[set a lock on the stdout file descriptor]' @@ -48,14 +48,14 @@ elif [[ $OSTYPE = solaris* ]]; then '-v[display non-printing chars as ^X or M-a]' '-e[display $ at the end of each line (requires -v)]' '-t[display tab as ^I and formfeeds and ^L (requires -v)]' - '*:files:_files' + '*: :_files' ) else # POSIX reqires '-u', and most OSes may support '-n' args=( '-n[number all output lines]' '-u[do not buffer output]' - '*:files:_files' + '*: :_files' ) fi diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown index 2c63a399a..a97a0e0bf 100644 --- a/Completion/Unix/Command/_chown +++ b/Completion/Unix/Command/_chown @@ -40,7 +40,7 @@ else fi (( $+words[(r)--reference*] )) || args+=( '(--reference)1: :->owner' ) -_arguments -C -s "$args[@]" '*:files:->files' && ret=0 +_arguments -C -s "$args[@]" '*: :->files' && ret=0 case $state in owner) diff --git a/Completion/Unix/Command/_column b/Completion/Unix/Command/_column index cb67fef37..a81684dba 100644 --- a/Completion/Unix/Command/_column +++ b/Completion/Unix/Command/_column @@ -9,6 +9,7 @@ case $OSTYPE in linux-gnu) args=( '(info json -c --output-width)'{-c+,--output-width=}'[format output to fit display of specified width]:width' + '(info)'{-L,--table-empty-lines}"[don't ignore empty lines]" + fill '(info table text json -x --fillrows)'{-x,--fillrows}'[fill rows before filling columns]' + table diff --git a/Completion/Unix/Command/_df b/Completion/Unix/Command/_df index a31145cd4..21abff105 100644 --- a/Completion/Unix/Command/_df +++ b/Completion/Unix/Command/_df @@ -19,7 +19,7 @@ if _pick_variant gnu=GNU unix --version; then '!-v' '(- : *)--help[display help and exit]' '(- : *)--version[output version information and exit]' - '*:files:_umountable' + '*: :_umountable' - '(format)' {-B+,--block-size=}'[specify block size]:size (bytes)' '-k[like --block-size=1K]' @@ -36,7 +36,7 @@ elif [[ "$OSTYPE" == (darwin|dragonfly|freebsd|netbsd*|openbsd)* ]]; then '(-G -i -P)-i[include inode usage statistics (default)]' '-l[only display locally-mounted file systems]' '-n[use previously obtained statistics]' - '*:files:_umountable' + '*: :_umountable' ) spec='[only display file systems of specified types]:file system type:->fslist' case "$OSTYPE" in @@ -93,7 +93,7 @@ else '-k[use 1024-byte blocks]' '-P[POSIX compliant output]' '-t[include total allocated-space figures in the output]' - '*:files:_umountable' + '*: :_umountable' ) fi diff --git a/Completion/Unix/Command/_dhclient b/Completion/Unix/Command/_dhclient index beaab5e2d..ee309e1fd 100644 --- a/Completion/Unix/Command/_dhclient +++ b/Completion/Unix/Command/_dhclient @@ -22,6 +22,7 @@ case $OSTYPE in '-i+[ignore values provided by leases for specified options]:options' '-L+[specify file to write option data too]:file:_files' "-n[don't configure any interfaces]" + '-r[release the current lease back to the server it came from]' '-v[verbose log messages]' ) ;; diff --git a/Completion/Unix/Command/_diff3 b/Completion/Unix/Command/_diff3 index 524507ce0..8c59d701b 100644 --- a/Completion/Unix/Command/_diff3 +++ b/Completion/Unix/Command/_diff3 @@ -3,7 +3,7 @@ local -a args ed local ign -if _pick_variant gnu=GNU unix; then +if _pick_variant gnu=GNU unix --version; then ed=( '(-m --merge -A --show-all)'{-e,--ed}'[output ed script for incorporating changes]' '(-m --merge -A --show-all)'{-E,--show-overlap}'[like -e, but bracket conflicts]' @@ -21,8 +21,8 @@ if _pick_variant gnu=GNU unix; then '(-T --initial-tab)'{-T,--initial-tab}'[make tabs line up by prepending a tab]' '--diff-program=[specify program to compare files]: : _command_names -e' \*{-L+,--label=}'[use specified label instead of file name]:label' - "$ign(-)--help[display usage information]" - "$ign(-)"{-v,--version}'[display version information]' + "$ign(- :)--help[display usage information]" + "$ign(- :)"{-v,--version}'[display version information]' ) else args=( -A "-*" ) diff --git a/Completion/Unix/Command/_dig b/Completion/Unix/Command/_dig index 18e9a0dbd..d37f18643 100644 --- a/Completion/Unix/Command/_dig +++ b/Completion/Unix/Command/_dig @@ -69,7 +69,7 @@ local -a alts args _arguments -s -C $args \ '(- *)-h[display help information]' \ '(- *)-v[display version information]' \ - '*-c+[specify class]:class:compadd -M "m:{a-z}={A-Z}" - IN CS CH HS' \ + '*-c+[specify class]:class:compadd -M "m\:{a-z}={A-Z}" - IN CS CH HS' \ '*-b+[specify source IP]:IP' \ '*-f+[batch mode, read arguments from file]:file:_files' \ '*-m[enable memory usage debugging]' \ @@ -88,7 +88,7 @@ if [[ -n $state ]]; then _wanted hosts expl 'DNS server' _hosts && ret=0; else case $#line in - <3->) alts+=( 'classes:query class:compadd -M "m:{a-z}={A-Z}" - IN CS CH HS' ) ;& + <3->) alts+=( 'classes:query class:compadd -M "m\:{a-z}={A-Z}" - IN CS CH HS' ) ;& 2) alts+=( 'types:query type:_dns_types' ) ;; esac _alternative 'hosts:host:_hosts' $alts && ret=0 diff --git a/Completion/Unix/Command/_dmidecode b/Completion/Unix/Command/_dmidecode index eb273586f..047b74f6d 100644 --- a/Completion/Unix/Command/_dmidecode +++ b/Completion/Unix/Command/_dmidecode @@ -4,10 +4,11 @@ _arguments -s \ '(-d --dev-mem --from-dump)'{-d+,--dev-mem=}'[read memory from specified file]:memory device [/dev/mem]:_files' \ '(-)'{-h,--help}'[display usage information]' \ '(-q --quiet -u --dump)'{-q,--quiet}'[be less verbose]' \ - '(--type -u --dump --dump-bin -s --string)'{-s+,--string=}':DMI string:(bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency)' \ - '(-s --string --dump-bin)*'{-t+,--type=}'[only display entries of specified type]:entry type:(bios system baseboard chassis processor memory cache connector slot)' \ + '(-t --type -H --handle -u --dump --dump-bin -s --string)'{-s+,--string=}'[only display value of specified DMI string]:DMI string:(bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency)' \ + '(-s --string -H --handle --dump-bin)*'{-t+,--type=}'[only display entries of specified type]:entry type:(bios system baseboard chassis processor memory cache connector slot)' \ + '(-s --string -t --type -H --handle --dump-bin)'{-H,--handle=}'[only display the entry of specified handle]:handle' \ '(-q --quiet -u --dump -s --string)'{-u,--dump}"[don't decode entries]" \ - '--dump-bin=[dump DMI data to a binary file]:file:_files' \ + '(-s --string -t --type -H --handle)--dump-bin=[dump DMI data to a binary file]:file:_files' \ '(-d --dev-mem)--from-dump=[read DMI data from a binary file]:file:_files' \ "--no-sysfs[don't attempt to read DMI data from sysfs files]" \ '--oem-string=[only display the value of the specified OEM string]:OEM string number' \ diff --git a/Completion/Unix/Command/_ed b/Completion/Unix/Command/_ed index 50d2710fc..6ca9ceace 100644 --- a/Completion/Unix/Command/_ed +++ b/Completion/Unix/Command/_ed @@ -19,7 +19,7 @@ if _pick_variant gnu=GNU unix --version; then else args=(-A '-*' ${args:#*\)--*}) case $OSTYPE in - dragonfly*|freebsd*|netbsd*|solaris*) + dragonfly*|freebsd*|darwin*|netbsd*|solaris*) args+=( '-x[prompt for an encryption key]' ) diff --git a/Completion/Unix/Command/_env b/Completion/Unix/Command/_env index 99fc513d7..932a7fc89 100644 --- a/Completion/Unix/Command/_env +++ b/Completion/Unix/Command/_env @@ -16,11 +16,11 @@ case $variant in "${ign}(- *)--version[display version information]" ) ;; - freebsd*) + freebsd*|darwin*) args=( - '(-i)*-u[remove variable from the environment]:env var to remove:_parameters -g "*export*"' - '-P[specify alternate executable search PATH]:path:_dir_list' - '-S[perform word splitting]' + '(-i)*-u+[remove variable from the environment]:env var to remove:_parameters -g "*export*"' + '-P+[specify alternate executable search PATH]:path:_dir_list' + '-S+[perform word splitting]:string to split' '*-v[verbose output]' ) ;& diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc index 5b97b8c30..9de0b79b1 100644 --- a/Completion/Unix/Command/_gcc +++ b/Completion/Unix/Command/_gcc @@ -646,7 +646,7 @@ args+=( '-Wstrict-selector-match[Warn if type signatures of candidate methods do not match exactly]' '-Wstringop-overflow[Warn about buffer overflow in string manipulation functions like memcpy and strcpy. Same as -Wstringop-overflow=]' '-Wsubobject-linkage[Warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage]' - '-Wsuggest-attribute=-[Warn about functions which might be candidates for __attribute__((const))]:const:(pure const noreturn format)' + '*-Wsuggest-attribute=-[warn about functions that might be candidates for attributes]:attribute:(pure const noreturn format)' '-Wsuggest-final-methods[Warn about C++ virtual methods where adding final keyword would improve code quality]' '-Wsuggest-final-types[Warn about C++ polymorphic types where adding final keyword would improve code quality]' '-Wsuggest-override[Suggest that the override keyword be used when the declaration of a virtual function overrides another]' diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 195a7f6dc..093464625 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -295,7 +295,7 @@ _git-branch () { declare l c m d e l='--color --no-color -r --remotes -a -v --verbose --abbrev --no-abbrev --list --points-at --sort' - c='-l --create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --no-contains --merged --no-merged' + c='--create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --no-contains --merged --no-merged' m='-c --copy -C -m --move -M --edit-description' d='-d --delete -D' @@ -337,7 +337,7 @@ _git-branch () { "($c $m $d : -v -vv --verbose)"{-v,-vv,--verbose}'[show SHA1 and commit subject line for each head]' \ "($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \ "($c $m $d :)--no-abbrev[don't abbreviate sha1s]" \ - "($l $m $d)"{-l,--create-reflog}"[create the branch's reflog]" \ + "($l $m $d)--create-reflog[create the branch's reflog]" \ "($l $m $d -f --force)"{-f,--force}'[force the creation of a new branch]' \ "($l $m $d -t --track)"{-t,--track}'[setup configuration so that pull merges from the start point]' \ "($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \ @@ -872,6 +872,7 @@ _git-fetch () { '(--all -m --multiple)'{-m,--multiple}'[fetch from multiple remotes]' \ '(-P --prune-tags)'{-P,--prune-tags}'[prune local tags no longer on remote and clobber changed tags]' \ \*{-o+,--server-option=}'[send specified string to the server when using protocol version 2]:option' \ + '--negotiation-tip=[only report refs reachable from specified object to the server]:commit:__git_commits' \ '--filter=[object filtering]:filter:_git_rev-list_filters' \ '*:: :->repository-or-group-or-refspec' && ret=0 @@ -992,35 +993,37 @@ _git-grep () { '--untracked[search also in untracked files]' \ '(-a --text)'{-a,--text}'[process binary files as if they were text]' \ '(--textconv --no-textconv)--textconv[honor textconv filter settings]' \ - '(--textconv --no-textconv)--no-textconv[do not honor textconv filter settings]' \ + "(--textconv --no-textconv)--no-textconv[don't honor textconv filter settings]" \ '(-i --ignore-case)'{-i,--ignore-case}'[ignore case when matching]' \ - '-I[do not match pattern in binary files]' \ + "-I[don't match pattern in binary files]" \ '--max-depth=[descend at most given levels of directories]: :__git_guard_number depth' \ '(-w --word-regexp)'{-w,--word-regexp}'[match only whole words]' \ '(-v --invert-match)'{-v,--invert-match}'[select non-matching lines]' \ - '( -H)-h[supress output of filenames]' \ - '(-h )-H[show filenames]' \ + '(-H)-h[suppress output of filenames]' \ + '(-h -c --count)-H[show filenames]' \ '--full-name[output paths relative to the project top directory]' \ - '(-E --extended-regexp -G --basic-regexp -P --perl-regexp -F --fixed-strings)'{-E,--extended-regexp}'[use POSIX extended regexes]' \ - '(-E --extended-regexp -G --basic-regexp -P --perl-regexp -F --fixed-strings)'{-G,--basic-regexp}'[use POSIX basic regexes]' \ + '(-E --extended-regexp -G --basic-regexp -P --perl-regexp -F --fixed-strings)'{-E,--extended-regexp}'[use extended regular expressions]' \ + '(-E --extended-regexp -G --basic-regexp -P --perl-regexp -F --fixed-strings)'{-G,--basic-regexp}'[use basic regular expressions]' \ '(-E --extended-regexp -G --basic-regexp -P --perl-regexp -F --fixed-strings)'{-P,--perl-regexp}'[use perl-compatible regexes]' \ - '(-E --extended-regexp -G --basic-regexp -P --perl-regexp -F --fixed-strings)'{-F,--fixed-strings}'[do not interpret pattern as a regex]' \ + '(-E --extended-regexp -G --basic-regexp -P --perl-regexp -F --fixed-strings)'{-F,--fixed-strings}'[use literal strings]' \ '(-n --line-number)'{-n,--line-number}'[prefix the line number to matching lines]' \ - '(-l --files-with-matches -L --files-without-match --name-only)'{-l,--files-with-matches,--name-only}'[show only names of matching files]' \ - '(-l --files-with-matches -L --files-without-match)'{-L,--files-without-match}'[show only names of non-matching files]' \ - '(--cached -O --open-files-in-pager)'{-O+,--open-files-in-pager=}'-[open matching files in pager]:pager:_cmdstring' \ + '(-c --count)--column[show column number of first match]' \ + '(-c --count -l --files-with-matches --name-only -L --files-without-match -o --only-matching)'{-l,--files-with-matches,--name-only}'[show only names of matching files]' \ + '(-c --count -l --files-with-matches --name-only -L --files-without-match -o --only-matching)'{-L,--files-without-match}'[show only names of non-matching files]' \ + '(-c --count -o --only-matching -n --line-number --color --no-color --cached --heading -O --open-files-in-pager)'{-O,--open-files-in-pager=}'-[open matching files in pager]::pager:_cmdstring' \ '(-z --null)'{-z,--null}'[output \0 after filenames]' \ - '(-c --count)'{-c,--count}'[show number of matching lines in files]' \ - '( --no-color)--color=-[color matches]:: :__git_color_whens' \ - '(--color )--no-color[do not color matches]' \ - '--break[prefix the line number to matching lines]' \ - '--heading[show the filename above the matches]' \ - '(-A --after-context)'{-A+,--after-context=}'[show <num> trailing lines, and separate groups of matches]: :__git_guard_number lines' \ - '(-B --before-context)'{-B+,--before-context=}'[show <num> leading lines, and separate groups of matches]: :__git_guard_number lines' \ - '(-A --after-context -B --before-context -C --context)'{-C+,--context=}'[show <num> leading and trailing lines, and separate groups of matches]: :__git_guard_number lines' \ + '(-c --count -l --files-with-matches --name-only -L --files-without-match -o --only-matching)'{--only-matching,-o}'[show only matching part of line]' \ + '(-h -c --count -l --files-with-matches --name-only -L --files-without-match -o --only-matching --color --break --heading -p --show-function -W --function-context)'{-c,--count}'[show number of matching lines in files]' \ + '(--no-color -O --open-files-in-pager)--color=-[color matches]:: :__git_color_whens' \ + "(--color -O --open-files-in-pager)--no-color[don't color matches]" \ + '(-c --count -O --open-files-in-pager)--break[print an empty line between matches from different files]' \ + '(-c --count -O --open-files-in-pager)--heading[show the filename above the matches]' \ + '(-A --after-context)'{-A+,--after-context=}'[specify lines of trailing context]: :__git_guard_number lines' \ + '(-B --before-context)'{-B+,--before-context=}'[specify lines of leading context]: :__git_guard_number lines' \ + '(-A --after-context -B --before-context -C --context)'{-C+,--context=}'[specify lines of context]: :__git_guard_number lines' \ '--threads=[use specified number of threads]:number of threads' \ - '(-p --show-function)'{-p,--show-function}'[show preceding line containing function name of match]' \ - '(-W --function-context)'{-W,--function-context}'[show whole function where a match was found]' \ + '(-c --count -p --show-function)'{-p,--show-function}'[show preceding line containing function name of match]' \ + '(-c --count -W --function-context)'{-W,--function-context}'[show whole function where a match was found]' \ '(1)*-f+[read patterns from given file]:pattern file:_files' \ '(1)*-e+[use the given pattern for matching]:pattern' \ $pattern_operators \ @@ -1210,7 +1213,8 @@ _git-merge () { _arguments -S -s \ $merge_options \ - '-m+[set the commit message to be used for the merge commit]:merge message' \ + \*{-m+,--message=}'[set the commit message to be used for the merge commit]:merge message' \ + \*{-F+,--file=}'[read commit message from a file]:file' \ '(--edit --no-edit)-e[open an editor to change the commit message]' \ '( --no-rerere-autoupdate)--rerere-autoupdate[allow the rerere mechanism to update the index]' \ '(--rerere-autoupdate )--no-rerere-autoupdate[do not allow the rerere mechanism to update the index]' \ @@ -1348,10 +1352,13 @@ _git-pull () { _arguments \ $merge_options \ - '(-r --rebase --no-rebase)'{-r=-,--rebase=-}'[perform a rebase after fetching]::rebase after fetching:((true\:"rebase after fetching" - false\:"merge after fetching" - preserve\:"rebase and preserve merges" - interactive\:"allow list of commits to be edited"))' \ + '(-r --rebase --no-rebase)'{-r=-,--rebase=-}'[perform a rebase after fetching]::rebase after fetching:(( + true\:"rebase after fetching" + false\:"merge after fetching" + merges\:"try to rebase merges instead of skipping them" + preserve\:"rebase and preserve merges" + interactive\:"allow list of commits to be edited" + ))' \ '(-r --rebase )--no-rebase[do not perform a rebase after fetching]' \ '--autostash[automatically stash/stash pop before and after rebase]' \ $fetch_options \ @@ -1423,6 +1430,20 @@ _git-push () { return ret } +(( $+functions[_git-range-diff] )) || +_git-range-diff () { + local -a diff_options + __git_setup_diff_options + + _arguments -s \ + '--creation-factor=[specify weighting for creation]:weighting (percent)' \ + '--no-dual-color[use simple diff colors]' \ + $diff_options \ + '1:range 1:__git_commit_ranges' \ + '2:range 2:__git_commit_ranges' \ + '3:revision 2:__git_commits' +} + (( $+functions[_git-rebase] )) || _git-rebase () { local -a autosquash_opts @@ -1457,6 +1478,7 @@ _git-rebase () { '(-i --interactive)--whitespace=-[detect a new or modified line that has whitespace errors]: :__git_apply_whitespace_strategies' \ '(-i --interactive)--committer-date-is-author-date[use author date as committer date]' \ '(-i --interactive --ignore-whitespace --whitespace --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \ + '(-r --rebase-merges)'{-r-,--rebase-merges=-}'[try to rebase merges instead of skipping them]::option:(rebase-cousins no-rebase-cousins)' \ '(-p --preserve-merges --interactive)'{-p,--preserve-merges}'[try to recreate merges instead of ignoring them]' \ {-x+,--exec=}'[with -i\: append "exec <cmd>" after each line]:command:_command_names -e' \ '(-k --keep-empty)'{-k,--keep-empty}'[keep empty commits in the result]' \ @@ -2325,7 +2347,15 @@ __git_config_option-or-value () { color.diff.frag:'color of hunk headers::->color' color.diff.func:'color of function in hunk header::->color' color.diff.old:'color of removed lines::->color' + color.diff.oldMoved:'color of lines removed by a move::->color' + color.diff.oldMovedAlternative:'alternative color of lines removed by a move::->color' + color.diff.oldMovedAlternativeDimmed:'dimmed alternative color of lines removed by a move::->color' + color.diff.oldMovedDimmed:'dimmed color of lines removed by a move::->color' color.diff.new:'color of added lines::->color' + color.diff.newMoved:'color of lines added by a move::->color' + color.diff.newMovedAlternative:'alternative color of lines added by a move::->color' + color.diff.newMovedAlternativeDimmed:'dimmed alternative color of lines added by a move::->color' + color.diff.newMovedDimmed:'dimmed color of lines added by a move::->color' color.diff.commit:'color of commit headers::->color' color.diff.whitespace:'color of whitespace errors::->color' color.decorate.branch:'color of branches::->color' @@ -2589,9 +2619,13 @@ __git_config_option-or-value () { pull.rebase:'rebase branches on top of the fetched branch, instead of merging::->pull.rebase:false' pull.twohead:'default merge strategy to use when pulling a single branch::__git_merge_strategies' push.default:'action git push should take if no refspec is given::->push.default:simple' + push.followTags:'enable --follow-tags option by default::->bool:false' + push.gpgSign:'GPG-sign pushes::->bool:false' + push.recurseSubmodules:'ensure all submodule commits are available on a remote-tracking branch' rebase.stat:'show a diffstat of what changed upstream since last rebase::->bool:false' - rebase.autosquash:'autosquash by default::->bool:false' - rebase.autostash:'autostash by default::->bool:false' + rebase.autoSquash:'autosquash by default::->bool:false' + rebase.autoStash:'autostash by default::->bool:false' + rebase.missingCommitsCheck:'print a warning if some commits are removed' receive.autogc:'run git gc --auto after receiving data::->bool:true' receive.fsckObjects:'check all received objects::->bool:true' receive.hiderefs:'string(s) receive-pack uses to decide which refs to omit from its initial advertisement:hidden refs:->string' @@ -2718,8 +2752,12 @@ __git_config_option-or-value () { 'url.*.pushInsteadOf:string to start URLs to push to with:prefix:->string' user.email:'email address used for commits::_email_addresses -c' user.name:'full name used for commits:name:->string' + user.useConfigOnly:'avoid guessing defaults for user.email and user.name:->bool:true' user.signingkey:'default GPG key to use when creating signed tags::__git_gpg_secret_keys' - web.browser:'web browser to use::__git_browsers') + versionsort.suffix:'specify sort order of suffixes applied to tags:suffix' + web.browser:'web browser to use::__git_browsers' + worktree.guessRemote:'with add, if branch matches remote track it::->bool:true' + ) declare -a git_present_options # 'present' is an adjective git_present_options=( @@ -2962,8 +3000,11 @@ __git_config_option-or-value () { url:'URL prefixes' user:'options controlling user identity' web:'web options' + versionsort:'tag sorting options' + worktree:'git worktree options' svn:'git svn options' - svn-remote:'git svn remotes') + svn-remote:'git svn remotes' + ) () { local i for i in ${(u)git_present_options%%.*}; do @@ -3689,7 +3730,8 @@ _git-repack () { '--depth=[maximum delta depth]:maximum delta depth' \ '--threads=[limit maximum number of threads]:threads' \ '--max-pack-size=-[maximum size of each output packfile]: : __git_guard_bytes "maximum pack size"' \ - '--pack-kept-objects[repack objects in packs marked with .keep]' + '--pack-kept-objects[repack objects in packs marked with .keep]' \ + '--keep-pack=[ignore named pack]:pack' } (( $+functions[_git-replace] )) || @@ -3835,11 +3877,12 @@ _git-get-tar-commit-id () { (( $+functions[_git-help] )) || _git-help () { _arguments -S -s \ - '( -g --guides -i --info -m --man -w --web)'{-a,--all}'[show all available commands]' \ - '(-a --all -g --guides -m --man -w --web)'{-i,--info}'[display manual for the command in info format]' \ - '(-a --all -g --guides -i --info -w --web)'{-m,--man}'[display manual for the command in man format]' \ - '(-a --all -g --guides -i --info -m --man )'{-w,--web}'[display manual for the command in HTML format]' \ - '(-g --guides)'{-g,--guides}'[prints a list of useful guides on the standard output]' \ + '(-c --config -i --info -m --man -w --web)'{-a,--all}'[show all available commands]' \ + '(-)'{-c,--config}'[print all configuration variable names]' \ + '(-a --all -g --guides -c --config -m --man -w --web)'{-i,--info}'[display manual for the command in info format]' \ + '(-a --all -g --guides -c --config -i --info -w --web)'{-m,--man}'[display manual for the command in man format]' \ + '(-a --all -g --guides -c --config -i --info -m --man)'{-w,--web}'[display manual for the command in HTML format]' \ + '(-g --guides -c --config -i --info -m --man -w --web)'{-g,--guides}'[prints a list of useful guides on the standard output]' \ '(-v --verbose)'{-v,--verbose}'[print command descriptions]' \ ': : _alternative commands:command:_git_commands "guides:git guides:(attributes glossary ignore modules revisions tutorial workflows)"' } @@ -4886,6 +4929,7 @@ _git-cat-file () { '(--batch)--batch-check=-[print SHA1, type and size (or in specified format)]::format' \ '--follow-symlinks[follow in-tree symlinks (used with --batch or --batch-check)]' \ '--batch-all-objects[show all objects with --batch or --batch-check]' \ + "--unordered[don't order --batch-all-objects output]" \ '--buffer[disable flushing of output after each object]' } @@ -5698,6 +5742,7 @@ _git_commands () { notes:'add or inspect object notes' pull:'fetch from and merge with another repository or local branch' push:'update remote refs along with associated objects' + range-diff:'compare two commit ranges' rebase:'forward-port local commits to the updated upstream head' reset:'reset current HEAD to specified state' revert:'revert existing commits' @@ -7110,16 +7155,22 @@ __git_setup_diff_options () { $exclusive_diff_options'--name-only[show only names of changed files]' $exclusive_diff_options'--name-status[show only names and status of changed files]' '--submodule=-[select output format for submodule differences]::format:((short\:"show pairs of commit names" - log\:"list commits like git submodule does" - diff\:"show differences"))' - '( --no-color --color-words)--color=-[show colored diff]:: :__git_color_whens' - '(--color --color-words)--no-color[turn off colored diff]' + log\:"list commits like git submodule does" + diff\:"show differences"))' + '( --no-color --color-words --color-moved)--color=-[show colored diff]:: :__git_color_whens' + '(--color --color-words --color-moved)--no-color[turn off colored diff]' '--word-diff=-[show word diff]::mode:((color\:"highlight changed words using color" plain\:"wrap deletions and insertions with markers" porcelain\:"use special line-based format for scripts" none\:"disable word diff"))' '--word-diff-regex=-[specify what constitutes a word]:word regex' - '(--color --no-color )--color-words=-[show colored-word diff]::word regex' + '(--color --no-color )--color-words=-[show colored-word diff]::word regex' + '(--color --no-color )--color-moved=-[color moved lines differently]::mode:((no\:"do not highlith moved lines" + default\:"like zebra" + plain\:"highlight moved lines with color" + blocks\:"greedily detect blocks of moved text of at least 20 characters" + zebra\:"like blocks, with alternating colors between different blocks" + dimmed-zebra\:"like zebra, uninteresting parts are dimmed"))' '--no-renames[turn off rename detection]' $exclusive_diff_options'--check[warn if changes introduce trailing whitespace or space/tab indents]' '--full-index[show full object name of pre- and post-image blob]' diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep index 3bc8d3fe0..d3e1b1a6e 100644 --- a/Completion/Unix/Command/_grep +++ b/Completion/Unix/Command/_grep @@ -10,11 +10,11 @@ if [[ $service = *GREP_OPT* ]]; then else arguments=( '(-e --regexp -f --file)1: :_guard "^-*" pattern' ) if [[ $service = z* ]]; then - arguments+=( '*:files:_files -g "*.gz(-.)"' ) + arguments+=( '*: :_files -g "*.gz(-.)"' ) elif [[ $service = bz* ]]; then - arguments+=( '*:files:_files -g "*.bz2(-.)"' ) + arguments+=( '*: :_files -g "*.bz2(-.)"' ) else - arguments+=( '*:files:_files' ) + arguments+=( '*: :_files' ) fi command="$words[1]" fi diff --git a/Completion/Unix/Command/_host b/Completion/Unix/Command/_host new file mode 100644 index 000000000..e1174d46c --- /dev/null +++ b/Completion/Unix/Command/_host @@ -0,0 +1,23 @@ +#compdef host + +# Note: This command is closely related to (and shares some options with) dig +_arguments -s -S -A '-*' : \ + '(: * -)-V[display version information]' \ + '(-6)-4[use IPv4 only]' \ + '(-4)-6[use IPv6 only]' \ + '(-v -t)-a[query for all record types or (with -l) list all zone records]' \ + '(-d -v)'{-d,-v}'[increase output verbosity]' \ + '-c+[specify query class]:query class:compadd -M "m\:{a-z}={A-Z}" - CH CS HS IN' \ + '-C[check SOA consistency]' \ + '-l[list zone records]' \ + '-N+[specify number of dots required to consider host name absolute]:number of dots' \ + '-r[query non-recursively (clear RD bit)]' \ + '-R+[specify number of retries for UDP queries]:number of retries [1]' \ + '-s[do not try next name server after SERVFAIL]' \ + '-t+[specify query type]: :_dns_types' \ + '-T[query via TCP]' \ + '*-m+[specify memory-usage debug flag]:debug flag:(record usage trace)' \ + '(-W)-w[disable query timeout (wait forever)]' \ + '(-w)-W+[specify query timeout]:query timeout (seconds) [5 (UDP), 10 (TCP)]' \ + '1: :_hosts' \ + '2::DNS server:_hosts' diff --git a/Completion/Unix/Command/_init_d b/Completion/Unix/Command/_init_d index 03af2dc9b..cdc373297 100644 --- a/Completion/Unix/Command/_init_d +++ b/Completion/Unix/Command/_init_d @@ -80,15 +80,29 @@ else (( $+functions[_init_d_get_cmds] )) || _init_d_get_cmds() { local what magic cmds + local -a tmp - # If the file starts with `#!' we hope that this is a shell script - # and get lines looking like <space>foo|bar) with the words in $what. + [[ -x $script ]] || return 1 - what='(st(art|op|atus)|(force-|)re(start|load)|debug_(up|down)|dump(|_stats)|add|delete|clean|list)' + # If the file starts with `#!' we hope that this is a shell script + # and get lines looking like <space>foo|bar) with the words in $what. Note + # that we'll fail to match if any of the alternate patterns in the case + # clause are not enumerated (e.g., `start|stop|custom)` won't match) + tmp=( + status add delete clean list + load save show check {config,}test + standalone master graceful + debug debug{_,-}{up,down} dump{,{_,-}stats} + {force-,graceful-,try-,}{start,stop,restart,reload} + {start,stop}-htcacheclean + ) + what="((['\"]|)(${(j<|>)tmp})(['\"]|))" - [[ -x $script ]] || return 1 - read -u0 -k2 magic < $script && [[ $magic = '#!' ]] && - cmds=( ${${(j:|:s:|:)${(M)${(f)"$(< $script)"}:#[[:blank:]]#(\'|)${~what}([[:blank:]]#\|[[:blank:]]#${~what})#(\'|)\)}}//[^-a-z_]} ) + read -u0 -k2 magic < $script && [[ $magic = '#!' ]] && { + cmds=( ${(f)"$(< $script)"} ) + cmds=( ${(M)cmds:#[[:blank:]]#${~what}([[:blank:]]#\|[[:blank:]]#${~what})#[[:blank:]]#\)} ) + cmds=( ${${(j:|:s:|:)cmds}//[^-a-z_]} ) + } # This would be the pattern to use every line of the form <space>foo). # Some people say this might match too many lines... diff --git a/Completion/Unix/Command/_jq b/Completion/Unix/Command/_jq index 4ff05dab4..b8e41dd66 100644 --- a/Completion/Unix/Command/_jq +++ b/Completion/Unix/Command/_jq @@ -27,8 +27,11 @@ _arguments -S -s : \ '(-f --from-file)'{-f,--from-file}'[read filter from file]:_files' \ '-L+[prepend a directory to the module search path]:_directories' \ '(-e --exit-status)'{-e,--exit-status}'[report "false" and "null" results via exit code]' \ - '*--arg[pre-set a variable to a string]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (string): ' \ - '*--argjson[pre-set a variable to an object]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (JSON): ' \ - '*--slurpfile[pre-set a variable to contents of a file]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (filename of file containing JSON):_files' \ + '*--arg[pre-set a variable to a string]:variable name: :value (string)' \ + '*--argjson[pre-set a variable to an object]:variable name: :value (JSON)' \ + '*--slurpfile[pre-set a variable to an array of JSON texts read from a file]:variable name: :file:_files' \ + '*--rawfile[pre-set a variable to the contents of a file]:variable name: :file:_files' \ + '--args[remaining arguments are string arguments, not files]' \ + '--jsonargs[remaining arguments are JSON arguments, not files]' \ "1: :_guard '|[^-]' filter" \ "*: :_files" diff --git a/Completion/Unix/Command/_links b/Completion/Unix/Command/_links index 34bb64560..8bb9fee1c 100644 --- a/Completion/Unix/Command/_links +++ b/Completion/Unix/Command/_links @@ -1,30 +1,121 @@ -#compdef links +#compdef links links2 -local curcontext="$curcontext" state line ret=1 +local curcontext="$curcontext" state line ign ret=1 typeset -A opt_args +(( $#words > 2 )) && ign='!' _arguments -C \ - '(-help)-anonymous[restrict links so that it can run on an anonymous account]' \ - '(-help)-assume-codepage[specify default codepage to use]:codepage' \ - '(-help)-async-dns[asynchronous DNS resolver]:bool:((0\:on 1\:off))' \ - '(-help)-download-dir[default download directory]:_files -/' \ - '(-help)-driver[graphics driver to use]:graphics driver:->graphics_drivers' \ - '(-help)-dump[dump the page as pure text]' \ - '(-help)-format-cache-size[number of formatted document pages cached]:pages' \ - '(-help)-ftp-proxy[specify ftp proxy server]:proxy:->proxies' \ - '(-help)-g[run in graphics mode rather than plain text mode]' \ - '-help[prints the help screen]' \ - '(-help)-http-proxy[specify web proxy server]:proxy:->proxies' \ - '(-help)-image-cache-size[image cache memory]:memory (kilobytes)' \ - '(-help)-max-connections[maximum number of concurrent connections]:connections' \ - '(-help)-max-connections-to-host[maximum number of concurrent connection to a given host]:connections' \ - '(-help)-memory-cache-size[cache memory]:kilobytes' \ - '(-help)-no-connect[runs links as a separate instance]' \ - '(-help)-receive-timeout[timeout on receive]:timeout (seconds)' \ - '(-help)-retries[number of retries]:retries' \ - '(-help)-source[dump the source page]' \ - '(-help)-unrestartable-receive-timeout[timeout on non restartable connections]:timeout (seconds)' \ - '(-help)-version[prints the links version number and exit]' \ + "${ign}-help[prints the help screen]" \ + "${ign}(- :)-version[prints the links version number and exit]" \ + "${ign}(- 1)-lookup[do hostname lookup]:hostname:_hosts" \ + '-g[run in graphics mode rather than plain text mode]' '!-no-g' \ + '-driver[graphics driver to use]:graphics driver:->graphics_drivers' \ + '-mode[specify graphics mode]:graphics mode' \ + '-display[specify X display]:display:_x_display' \ + '-force-html[treat files with unknown type as html rather than text]' \ + '-source[dump the source page]' \ + '-dump[dump the page as pure text]' \ + '-width[specify screen width for formatting with -dump]:width' \ + '-codepage[convert output to specified character set with -dump]:codepage' \ + '-anonymous[restrict links so that it can run on an anonymous account]' \ + '-no-connect[runs links as a separate instance]' \ + '-download-dir[default download directory]:_files -/' \ + '-language[set user interface language]:language' \ + '-max-connections[specify maximum number of concurrent connections]:connections [10]' \ + '-max-connections-to-host[maximum number of concurrent connection to a given host]:connections [2]' \ + '-retries[number of retries]:retries [3]' \ + '-receive-timeout[timeout on receive]:timeout (seconds) [120]' \ + '-unrestartable-receive-timeout[timeout on non-restartable connections]:timeout (seconds) [600]' \ + '-timeout-when-trying-multiple-addresses[specify timeout for connection when trying multiple addresses]:timeout (seconds)' \ + '-bind-address[use a specific local IP address]:IP address' \ + '-bind-address-ipv6[use a specific local IPv6 address]:IPv6 address' \ + "-no-libevent[don't use libevent library]" \ + "-no-openmp[don't use OpenMP]" \ + '-async-dns[asynchronous DNS resolver]:enable:((1\:on 0\:off))' \ + '-download-utime[set time of downloaded files to last modification time reported by server]:enable:((1\:on 0\:off))' \ + '-format-cache-size[number of formatted document pages cached]:pages [5]' \ + '-memory-cache-size[cache memory]:size (bytes) [1048576]' \ + '-image-cache-size[image cache memory]:size (bytes) [1048576]' \ + '-font-cache-size[specify font cache size]:size (bytes) [2097152]' \ + "-aggressive-cache[cache everything regardless of server's caching recomendations]:enable [1]:((1\\:on 0\\:off))" \ + '-address-preference[specify IP version preference]:preference:(( + 0\:system\ default + 1\:prefer\ IPv4 + 2\:prefer\ IPv6 + 3\:use\ only\ IPv4 + 4\:use\ only\ IPv6 + ))' \ + '-http-proxy[specify web proxy server]:proxy:->proxies' \ + '-ftp-proxy[specify ftp proxy server]:proxy:->proxies' \ + '-https-proxy[specify https web proxy server]:proxy:->proxies' \ + '-socks-proxy[specify socks4a proxy server]:proxy:->sproxies' \ + '-append-text-to-dns-lookups[append text to dns lookups; useful for specifying fixed tor exit node]:text' \ + '-no-proxy-domains[use no proxy for specified domains]:domain list' \ + '-only-proxies[only initiate connections via proxy]:enable:((0\:off 1\:on))' \ + '-ssl.certificates[specify handling of invalid signatures]:handling:((0\:ignore 1\:warn 2\:reject))' \ + '-ssl.builtin-certificates[specify certificates to use]:certificates:((0\:system 1\:builtin))' \ + '-ssl.client-cert-key[specify user private key for client certificate authentication]:PEM file:_files' \ + '-ssl.client-cert-crt[specify user certificate for client certificate authentication]:PEM file:_files' \ + '-ssl.client-cert-password[specify password for the user private key]:password' \ + '-http-bugs.http10[specify HTTP version]:protocol [0]:((1\:force\ only\ HTTP\ 1.0 0\:use\ both\ HTTP\ 1.0\ and\ 1.1))' \ + '-http-bugs.allow-blacklist[use list of servers with broken HTTP/1.1 support]:allow [1]:(1 0)' \ + '-http-bugs.bug-no-accept-charset[specify sending of Accept-Charset field of HTTP header]:send [0]:(1 0)' \ + '-http-bugs.no-compression[advertise HTTP compression support]:advertise compression [0]:((0\:yes 1\:no))' \ + '-http-bugs.retry-internal-errors[retry on internal server errors (50x)]:retry [0]:((1\:yes 0\:no))' \ + '-http.fake-firefox[fake Firefox in the HTTP header]:enable [0]:((0\:no 1\:yes))' \ + '-http.do-not-track[send do not track request in the HTTP header]:enable [0]:(1 0)' \ + "-http.referer[control sending of referer URL in requests]:referer [4]:(( + 0\:don\'t\ send 1\:'send requested URL' 2\:'fake referer' 3\:'send real' + 4\:'send real only to the same server' + ))" \ + '-http.fake-user-agent[specify fake user agent value]:string' \ + '-http.extra-header[specify extra string added to HTTP header]:string' \ + '-ftp.anonymous-password[specify password for anonymous ftp access]:password' \ + '-ftp.use-passive[use ftp PASV command to bypass firewalls]:enable;(0 1)' \ + '-ftp.use-eprt-epsv[use EPRT and EPSV commands instead of PORT and PASV]:enable:(0 1)' \ + '-ftp.set-iptos[set IP type-of-service to high throughput on ftp connections]:enable:(0 1)' \ + '-smb.allow-hyperlinks-to-smb[allow hyperlinks to SMB protocol]:enable:(0 1)' \ + '-menu-font-size[specify size of font in menu]:size' \ + '-menu-background-color[specify menu background color in graphics mode]:color (0xRRGGBB)' \ + '-menu-foreground-color[specify menu foreground color in graphics mode]:color (0xRRGGBB)' \ + '-scroll-bar-area-color[set colour of scroll bar area]:colour (0xRRGGBB)' \ + '-scroll-bar-bar-color[set colour of scroll bar]:colour (0xRRGGBB)' \ + '-scroll-bar-frame-color[set colour of scroll bar frame]:colour (0xRRGGBB)' \ + '-bookmarks-file[specify file to store bookmarks]:file:_files' \ + '-bookmarks-codepage[specify character set of bookmarks file]:character set' \ + '-save-url-history[save URL history on exit]:enable:(0 1)' \ + '-display-red-gamma[specify red gamma of display]:gamma [2.2]' \ + '-display-green-gamma[specify green gamma of display]:gamma [2.2]' \ + '-display-blue-gamma[specify blue gamma of display]:gamma [2.2]' \ + '-user-gamma[specify additional gamma]:gamma [1]' \ + '-bfu-aspect[display aspect ration]' \ + '-dither-letters[do letter dithering]:enable:(0 1)' \ + '-display-optimize[optimize for display type]:display:((0\:CRT 1\:LCD\ RGB 2\:LCD\ BGR))' \ + '-gamma-correction[specify type of gamma correction]:gamma correction:((0\:8-bit 1\:16-bit 2\:auto\ detect))' \ + '-overwrite-instead-of-scroll[overwrite the screen instead of scrolling it]:enable:(0 1)' \ + '-html-assume-codepage[specify codepage to use if unspecified by server]:codepage' \ + '-html-hard-assume[always use character set from -html-assume-codepage]:enable:(0 1)' \ + '-html-tables[render tables]:enable:(0 1)' \ + '-html-frames[render frames]:enable:(0 1)' \ + '-html-images[display links to unnamed images as \[IMG\]]:enable:(0 1)' \ + '-html-image-names[display filename of an image]:enable:(0 1)' \ + '-html-display-images[display images in graphics mode]:enable:(0 1)' \ + '-html-image-scale[sScale images in graphics mode]:scaling (percent)' \ + '-html-bare-image-autoscale[autoscale images displayed on full screen]:enable:(0 1)' \ + '-html-numbered-links[number links in text mode allowing quick selection]:enable:(0 1)' \ + '-html-table-order[set ordering to walk tables]:ordering:((0\:rows 1\:columns))' \ + '-html-auto-refresh[process refresh or display link]:refresh:(1 0)' \ + '-html-target-in-new-window[allow opening new windows from html]' \ + '-html-margin[specify margin]:margin (spaces)' \ + '-html-user-font-size[specify font size in graphics mode]:size' \ + '-html-t-text-color[specify text color in text mode]:color (0..15)' \ + '-html-t-link-color[specify link color in text mode]:color (0..15)' \ + '-html-t-background-color[specify background color in text mode]:color (0..15)' \ + '-html-t-ignore-document-color[ignore colors from HTML in text mode]:ignore:(0 1)' \ + '-html-g-text-color[specify text color in graphics mode]:color (0xRRGGBB)' \ + '-html-g-link-color[specify link color in graphics mode]:color (0xRRGGBB)' \ + '-html-g-background-color[specify background color in graphics mode]:color (0xRRGGBB)' \ + '-html-g-ignore-document-color[ignore colors from HTML in graphics mode]:ignore:(0 1)' \ ':URL:->html' && ret=0 case $state in @@ -33,9 +124,15 @@ case $state in ;; graphics_drivers) local -a vals - vals=( ${=${${${(f)"$(_call_program links-graphics-drivers links -driver help 2>&1)"}[-1]}//','/''}} ) + vals=( ${=${${${(f)"$(_call_program links-graphics-drivers $words[1] -driver help 2>&1)"}[-1]}//','/''}} ) _describe -t links-graphics-drivers 'graphics driver' vals && ret=0 ;; + sproxies) + if ! compset -P '*@'; then + _message -e users 'user id' + return + fi + ;& proxies) local suf=-S: if compset -P '*:'; then diff --git a/Completion/Unix/Command/_lp b/Completion/Unix/Command/_lp index 63fbab78a..8c7ba7a8a 100644 --- a/Completion/Unix/Command/_lp +++ b/Completion/Unix/Command/_lp @@ -30,7 +30,7 @@ _lp_job_options() lopts_with_args=( media orientation-requested sides number-up scaling cpi lpi page-{bottom,left,right,top} page-ranges ) - lopts_no_args=(fitplot landscape) + lopts_no_args=(fitplot fit-to-page landscape) if [[ $service == 'lpadmin' ]]; then # Extra options from lpadmin man page. diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls index ea96de6ff..cedea1de9 100644 --- a/Completion/Unix/Command/_ls +++ b/Completion/Unix/Command/_ls @@ -37,7 +37,7 @@ if ! _pick_variant gnu=gnu unix --help; then '(-B -b -w -q)-q[hide control chars]' - '*:files:_files' + '*: :_files' ) if [[ "$OSTYPE" = (netbsd*|dragonfly*|freebsd*|openbsd*|darwin*) ]]; then arguments+=( diff --git a/Completion/Unix/Command/_luarocks b/Completion/Unix/Command/_luarocks index 363cedc8d..30bda1a9a 100644 --- a/Completion/Unix/Command/_luarocks +++ b/Completion/Unix/Command/_luarocks @@ -9,6 +9,7 @@ __luarocks_command(){ doc:'show documentation for an installed rock' download:'download a specific rock file from a rocks server' help:'help on commands' + init:'initialize a directory for a Lua project using LuaRocks' install:'install a rock' lint:'check syntax of a rockspec' list:'list currently installed rocks' @@ -20,13 +21,27 @@ __luarocks_command(){ remove:'uninstall a rock' search:'query the LuaRocks servers' show:'show information about an installed rock' + test:'run the test suite in the current directory' unpack:'unpack the contents of a rock' upload:'upload a rockspec to the public rocks repository' + which:'indicate which file corresponds to a given module name' write_rockspec:'write a template for a rockspec file' ) _describe -t commands 'command' commands "$@" } + local option_deps_modes='--deps-mode=[specify how to handle dependencies]:mode:__luarocks_deps_modes' + +local rockspec_options=( + '--license=[specify a license string]:license (e.g. "MIT/X11" or "GNU GPL v3")' + '--summary=[a short one-line description summary]:summary:{_message -e "short summary of the rock"}' + '--detailed=[a longer description string]:detailed_text:{_message -e "detailed description of the rock"}' + '--homepage=[project homepage]:URL:_urls' + '--lua-versions=[specify supported Lua versions]:lua version:_sequence compadd - 5.{1,2,3,4}' + '--rockspec-format=[rockspec format version, such as "1.0" or "1.1"]:VER: ' + '--lib=[comma separated list of C library files to link to]:library files' +) + (( $+functions[__luarocks_deps_modes] )) || __luarocks_deps_modes(){ local modes=( @@ -78,10 +93,7 @@ __luarocks_rock_version(){ i=$(( i + 1 )) done } -(( $+functions[__luarocks_lua_versions] )) || -__luarocks_lua_versions(){ - _values -s , 5.3 5.2 5.1 -} + (( $+functions[___luarocks_manually_store_cache_configs_paths] )) || ___luarocks_manually_store_cache_configs_paths(){ user_config_path="$(_call_program user_config_path luarocks config --user-config)" @@ -397,6 +409,15 @@ _luarocks_download(){ _luarocks_help(){ _arguments '1: :__luarocks_command' } + +(( $+functions[_luarocks_init] )) || +_luarocks_init(){ + _arguments $rockspec_options \ + '--reset[regenerate files if they already exist]' \ + '1: :_guard "^-*" "name"'\ + '2: :_guard "^-*" "version"' +} + # arguments: # - must: .rockspec file / external rock # - optional: version @@ -453,11 +474,11 @@ _luarocks_pack(){ # arguments: # NOTE: receives only options local path_command_options=( - '--bin[adds the system path to the output]' - '--append[appends the paths to the existing paths]' - '--lr-path[exports the Lua path (not formatted as shell command)]' - '--lr-cpath[exports the Lua cpath (not formatted as shell command)]' - '--lr-bin[exports the system path (not formatted as shell command)]' + "--no-bin[don't export the PATH variable]" + '--append[append the paths to the existing paths]' + '--lr-path[export the Lua path (not formatted as shell command)]' + '--lr-cpath[export the Lua cpath (not formatted as shell command)]' + '--lr-bin[export the system path (not formatted as shell command)]' ) (( $+functions[_luarocks_path] )) || _luarocks_path(){ @@ -495,13 +516,14 @@ _luarocks_remove(){ local search_command_options=( '--source[return only rockspecs and source rocks]' '--binary[return only pure Lua and binary rocks (rocks that can be used with the "install" command without requiring a C toolchain)]' - '--all[list all contents of the server that are suitable to this platform, do not filter by name]' + "--all[list all contents of the server that are suitable for this platform, don't filter by name]" + '--porcelain[produce machine readable output]' ) (( $+functions[_luarocks_search] )) || _luarocks_search(){ _arguments \ "${search_command_options[@]}" \ - '*:SEARCH QUERY:' + '*: :_guard "^--*" "search query"' } # arguments: # - must: installed rock @@ -509,6 +531,8 @@ local show_command_options=( '--home[home page of project]' '--modules[all modules provided by this package as used by require()]' '--deps[packages this package depends on]' + '--build-deps[show build-only dependencies for package]' + '--test-deps[show dependencies for testing package]' '--rockspec[the full path of the rockspec file]' '--mversion[the package version]' '--rock-tree[local tree where rock is installed]' @@ -520,6 +544,16 @@ _luarocks_show(){ "${show_command_options[@]}" \ "1: :{__luarocks_rock 'installed' "${opt_args[--tree]}"}" } + +(( $+functions[_luarocks_test] )) || +_luarocks_test(){ + _arguments $option_deps_modes \ + '--test-type=[specify the test suite type manually]:test suite type' \ + '--reset[regenerate files if they already exist]' \ + '1:rockspec:__luarocks_rock' \ + '*:arg' +} + # arguments: # - must: rockpack file / external rock # - optional: version (only when chossing external rock) @@ -535,8 +569,9 @@ _luarocks_unpack(){ # arguments: # - must: rockspec file local upload_command_options=( - '--skip-pack[do not pack and send source rock]' - '--api-key=[give it an API key]:KEY:{_message "api key"}' + "--skip-pack[don't pack and send source rock]" + '(--temp-key)--api-key=[use and save specified API key]:api key' + '(--api-key)--temp-key=[use specified temporary API key in this invocation only]:api key' '--force[replace existing rockspec if the same revision of a module already exists]' ) (( $+functions[_luarocks_upload] )) || @@ -545,26 +580,18 @@ _luarocks_upload(){ "${upload_command_options[@]}" \ '1: :{__luarocks_rock "rockspec"}' } -# arguments: -# - optional: name -# - optional: version -# - optional: URL / PATH -# receives as an argument a name and a version with optionally a URL/PATH -local write_rockspec_command_options=( - '--output=[write the rockspec with the given filename]:FILE:_files' - '--license=[specify a license string]:license (e.g. "MIT/X11" or "GNU GPL v3")' - '--summary=[a short one-line description summary]:summary:{_message -e "short summary of the rock"}' - '--detailed=[a longer description string]:detailed_text:{_message -e "detailed description of the rock"}' - '--homepage=[project homepage]:URL:_urls' - '--lua-version=[supported Lua versions]:LUA_VER:__luarocks_lua_versions' - '--rockspec-format=[rockspec format version, such as "1.0" or "1.1"]:VER: ' - '--tag=[tag to use. Will attempt to extract version number from it]:tag:__git_tag' - '--lib=[comma separated list of C library files to link to]:library files' -) + +(( $+functions[_luarocks_which] )) || +_luarocks_which(){ + _message -e modules 'module name' +} + (( $+functions[_luarocks_write_rockspec] )) || _luarocks_write_rockspec(){ _arguments -A "-*" \ - "${write_rockspec_command_options[@]}" \ + "${rockspec_options[@]}" \ + '--output=[write the rockspec with the given file]:file:_files' \ + '--tag=[specify tag to use. Will attempt to extract version number from it]:tag:__git_tag' \ '1:: :{_message "new rock name"}' \ '2:: :{__luarocks_rock_version "new_rock"}' \ '3:: :_urls' @@ -572,13 +599,15 @@ _luarocks_write_rockspec(){ # The real thing _arguments -C \ - '(--server --only-server)--server=[fetch rocks/rockspecs from this server]:HOST:_hosts' \ - '(--server --only-server)--only-server=[fetch rocks/rockspecs from this server only]:HOST:_hosts' \ + '--dev[enable the sub-repositories in rocks servers]' \ + '(--server --only-server)--server=[fetch rocks/rockspecs from specified server]:host:_hosts' \ + '(--server --only-server)--only-server=[fetch rocks/rockspecs from specified server only]:host:_hosts' \ '--only-sources=[restrict downloads to paths matching the given URL]:URL:_urls' \ - '--tree=[which tree to operate on]:TREE:{_files -/}' \ + '--lua-dir=[specify location of lua installation]:path:_directories' \ + '--tree=[specify which tree to operate on]:tree:_directories' \ '--local[use the tree in the user'"'"'s home directory]' \ '--verbose[display verbose output of commands executed]' \ - '--timeout=[timeout on network operations]:SECONDS:{_message "timeout (seconds)"}' \ + '--timeout=[specify timeout for network operations]:timeout (seconds)' \ '1: :__luarocks_command' \ '*::arg:->args' diff --git a/Completion/Unix/Command/_mkdir b/Completion/Unix/Command/_mkdir index 53536b01d..e4308c304 100644 --- a/Completion/Unix/Command/_mkdir +++ b/Completion/Unix/Command/_mkdir @@ -26,7 +26,7 @@ fi # Now $variant is set. case $variant in - gnu|freebsd*|dragonfly*) + gnu|freebsd*|dragonfly*|darwin*) args+=( '(-v --verbose)'{-v,--verbose}'[print message for each created directory]' ) @@ -42,8 +42,6 @@ case $variant in '(- :)--version[display version information]' ) ;; - zsh) # remove all options - ;; *) # non-GNU: remove long options args=( ${${${args:#(|*\))--*}//--[^ )]#/}/\( #\)/} ) ;; diff --git a/Completion/Unix/Command/_mkfifo b/Completion/Unix/Command/_mkfifo new file mode 100644 index 000000000..4f1d8c87e --- /dev/null +++ b/Completion/Unix/Command/_mkfifo @@ -0,0 +1,20 @@ +#compdef mkfifo gmkfifo + +local -a aopts args + +if _pick_variant gnu='Free Soft' unix --version; then + args=( + '(: * -)--help[display help information]' + '(: * -)--version[display version information]' + '(-m --mode)'{-m+,--mode=}'[specify file mode]: :_file_modes' + ) + [[ $OSTYPE == linux* ]] && args+=( + '(--context)-Z[set SELinux security context to default]' + '(-Z)--context=-[like -Z, or specify SELinux security context]:SELinux security context' + ) +else + aopts=( -A '-*' ) + args=( '-m+[specify file mode]: :_file_modes' ) +fi + +_arguments -s -S $aopts : '*:FIFO:_files' $args diff --git a/Completion/Unix/Command/_mknod b/Completion/Unix/Command/_mknod new file mode 100644 index 000000000..902f49b9f --- /dev/null +++ b/Completion/Unix/Command/_mknod @@ -0,0 +1,45 @@ +#compdef mknod gmknod + +# - @todo Major/minor device numbers could be completed using /proc/devices on +# Linux and e.g. `stat -f %Hr /dev/*` on BSD/Darwin +# - @todo Device numbers should not be completed given p or w types + +local -a aopts args + +if _pick_variant gnu='Free Soft' $OSTYPE --version; then + args=( + '(: * -)--help[display help information]' + '(: * -)--version[display version information]' + '(-m --mode)'{-m+,--mode=}'[specify file mode]: :_file_modes' + '1:special file:_files' + '2:special file type:(( + b\:"block (buffered) special file" + {c,u}\:"character (unbuffered) special file" + p\:FIFO + ))' + '3:major device number' + '4:minor device number' + ) + [[ $OSTYPE == linux* ]] && args+=( + '(--context)-Z[set SELinux security context to default]' + '(-Z)--context=-[like -Z, or specify SELinux security context]:SELinux security context' + ) +else + aopts=( -A '-*' ) + args=( + '-F+[specify device-number format]:device-number format:( + native 386bsd 4bsd bsdos freebsd hpux isc linux netbsd osf1 sco solaris + sunos svr3 svr4 ultrix + )' + '1:special file:_files' + '2:special file type:(( + b\:"block-type device" + c\:"character-type device" + w\:"whiteout node" + ))' + '3:major device number' + '4:minor device number' + ) +fi + +_arguments -s -S $aopts : $args diff --git a/Completion/Unix/Command/_mktemp b/Completion/Unix/Command/_mktemp index 4b5bf99f7..03fc89e36 100644 --- a/Completion/Unix/Command/_mktemp +++ b/Completion/Unix/Command/_mktemp @@ -30,9 +30,9 @@ fi args=( ${args:#((#s)|*\))(\*|)-t*} ) args+=( '-t[generate template relative to temp dir]' ) # Dragonfly, FreeBSD, and Darwin take an argument to -t and support any number - # of template files + # of template files. These OSes do not have -p and -V. else - args=( ${args:#((#s)|*\))(1:*|(\*|)-t*)} ) + args=( ${args:#((#s)|*\))(1:*|(\*|)-[ptV]*)} ) args+=( '-t[generate template relative to temp dir using specified prefix]:template prefix' '*: :_guard "^-*" "template name"' diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc index 4f200c69e..0f292ab4c 100644 --- a/Completion/Unix/Command/_mpc +++ b/Completion/Unix/Command/_mpc @@ -55,6 +55,7 @@ _mpc_command() { playlist:"print the current playlist" prev:"play the previous song in the current playlist" prio:"change song priorities in the queue" + queued:"show the next queued song" random:"toggle random mode, or specify state" repeat:"toggle repeat mode, or specify state" single:"toggle single mode, or specify state" @@ -69,6 +70,7 @@ _mpc_command() { findadd:"find songs and add them to the current playlist" list:"list all tags of given type" seek:"seek to the position specified in percent" + seekthrough:"seek by an amount of time within the song and playlist" shuffle:"shuffle the current playlist" stats:"display statistics about MPD" stop:"stop the currently playing playlists" @@ -82,6 +84,8 @@ _mpc_command() { waitmessage:"wait for at least one message on the specified channel" subscribe:"subscribe to the specified channel and continuously receive messages" sticker:"sticker management" + mount:"list mounts or add a new mount" + unmount:"remove a mount" ) if (( CURRENT == 1 )); then @@ -209,7 +213,11 @@ _mpc_play() { } _mpc_seek() { - _message "floating point percent value" + _message -e position 'position ([+-][HH:MM:SS]|<0-100>%%)' +} + +_mpc_seekthrough() { + _message -e position 'position ([+-][HH:MM:SS])' } _mpc_enable() { @@ -349,6 +357,7 @@ _arguments -C \ '(-p --port)'{-p,--port=}'[connect to server port]:port' \ '(-f --format)'{-f,--format=}'[specify the format of song display]:format string:->formats' \ '(-w --wait)'{-w,--wait}'[wait for operation to finish (e.g. database update)]' \ + '(-r --range)'{-r,--range=}'[operate on a range (e.g. when loading a playlist)]:<start>\:<end>' \ '*::mpc command:_mpc_command' && ret=0 if [[ $state = formats ]]; then diff --git a/Completion/Unix/Command/_npm b/Completion/Unix/Command/_npm index f5493a321..c05f61c51 100644 --- a/Completion/Unix/Command/_npm +++ b/Completion/Unix/Command/_npm @@ -2,8 +2,13 @@ # Node Package Manager completion, letting npm do all the completion work -if type npm > /dev/null; then - eval "$(npm completion)" +if (( $+commands[npm] )); then + eval "$(NPM_CONFIG_UPDATE_NOTIFIER=false npm completion)" + # Monkey-patch their function to prevent update checks + functions[_npm_completion]=" + local -x NPM_CONFIG_UPDATE_NOTIFIER=false; + ${functions[_npm_completion]} + " _npm_completion "$@" fi diff --git a/Completion/Unix/Command/_od b/Completion/Unix/Command/_od index aba400660..046018131 100644 --- a/Completion/Unix/Command/_od +++ b/Completion/Unix/Command/_od @@ -61,7 +61,7 @@ else esac fi -_arguments -C -s -S : "$args[@]" '*:files:_files' && return 0 +_arguments -C -s -S : "$args[@]" '*: :_files' && return 0 case "$state" in (format) diff --git a/Completion/Unix/Command/_pax b/Completion/Unix/Command/_pax index 7ebaa6aa5..0ae58423c 100644 --- a/Completion/Unix/Command/_pax +++ b/Completion/Unix/Command/_pax @@ -44,4 +44,4 @@ _arguments -s \ '-X[do not descend into directories that have a different device ID]' \ '-Y[ignore older files by ctime after file name mods]' \ '-Z[ignore older files after file name mods]' \ - '*:files:_files' + '*: :_files' diff --git a/Completion/Unix/Command/_ping b/Completion/Unix/Command/_ping index 2efe545c6..78fd33d92 100644 --- a/Completion/Unix/Command/_ping +++ b/Completion/Unix/Command/_ping @@ -37,7 +37,7 @@ case ${variant}:${${service#ping}:-4} in iputils:*|((free|net)bsd|darwin|dragonfly)*:4) args+=( '-a[audible bell for each packet]' ) ;| - iputils:*|(net|open)bsd*:4) + iputils:*|netbsd*:4|openbsd*) args+=( '-w+[specify timeout after which ping exits]:deadline (seconds)' ) ;| iputils:*|openbsd*:4|solaris*) @@ -58,10 +58,7 @@ case ${variant}:${${service#ping}:-4} in args+=( "-D[set the don't fragment bit]" ) ;| ((free|net)bsd|darwin|dragonfly)*:4) - args+=( - '-Q[somewhat quiet]' - '-T+[set IP Time to Live for outgoing packets]:ttl' - ) + args+=( '-Q[somewhat quiet]') ;| freebsd*:6|darwin*:6|solaris*|netbsd*) args+=( @@ -84,7 +81,7 @@ case ${variant}:${${service#ping}:-4} in (*bsd|darwin)*:6) args+=( '*-m[suppress fragmenting of packets into the minimum IPv6 MTU]' ) ;| - freebsd*|darwin*|dragonfly*|netbsd*:6) + freebsd*|darwin*|netbsd*:6) args+=( '-P+[specify IPsec policy to be used for the probe]:policy' ) ;| solaris2.<11->) @@ -101,17 +98,19 @@ case ${variant}:${${service#ping}:-4} in '-h+[specify size increment for ICMP payload for sweeping pings]:size [1]' '-M+[use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO]:ICMP:(mask time)' '-m+[set IP Time to Live for outgoing packets]:ttl' + '-T+[set IP Time to Live for multicasted packets]:ttl' '-t+[specify timeout after which ping exits]:deadline (seconds)' '-W+[specify time to wait for a response]:wait time (ms)' '-z+[specify type of service]:type of service' ) - ;; + ;| (freebsd|darwin)*:6) args+=( + '-D[disable IPv6 fragmentation]' '-R[audible bell for no packet]' '-r[audible bell for each packet]' ) - ;; + ;| freebsd*:6) args+=( '-x+[specify time to wait for a response]:wait time (ms)' @@ -124,24 +123,30 @@ case ${variant}:${${service#ping}:-4} in '-E+[specify IPsec policy to be used for the probe]:policy' '-h+[specify target host]:host:_hosts' '-P+[use a pseudo-random sequence for the data]' + '-T+[set IP Time to Live for outgoing packets]:ttl' '-t+[specify type of service]:type of service' ) ;; (dragonfly|netbsd)*:6) args+=( '-R[inject reachability confirmation hint for target host/first hop]' ) - ;| + ;; darwin*:4) - args+=( '-b+[bind the socket to specified interface for sending]:interface:_net_interfaces' ) + args+=( '-b+[bind the socket to specified interface for sending]:interface:_net_interfaces') ;| darwin*:6) args+=( '-B+[bind the socket to specified interface for sending]:interface:_net_interfaces' - '-C[prohibit socket from using cellular network interface]' + '-G+[specify max,min,increment size for ICMP payload for sweeping pings]:max,min,incr (defalt min=0 incr=1)' + '-z+[specify traffic class]:traffic class' ) ;| darwin*) args+=( + '-C[prohibit socket from using cellular network interface]' + '-K+[specify network service type for sending ICMP packets]:serviece type:(BK_SYS BK BE RV AV RD OAM VI SIG VO)' '-k+[specify traffic class to use for sending ICMP packets]:traffic class [CTL]:(BK_SYS BK BE RD OAM AV RV VI VO CTL)' + '--apple-connect[connects the socket to the destination address]' + '--apple-time[prints the time a packet was received]' ) ;; openbsd*:4) diff --git a/Completion/Unix/Command/_rar b/Completion/Unix/Command/_rar index 906e236fd..68982be60 100644 --- a/Completion/Unix/Command/_rar +++ b/Completion/Unix/Command/_rar @@ -58,7 +58,7 @@ case $service in '-n+:file to include:_files' \ '-n@+:file of files to include:_files' \ "$common[@]" \ - '*:RAR files:_files -g \*.rar\(-.\)' + '*:RAR file:_files -g \*.rar\(-.\)' fi ;; rar) @@ -126,7 +126,7 @@ case $service in '-w+[assign work directory]:work directory:_files -/' \ "$common[@]" \ '-z+[read archive comment from file]:comment file:_files' \ - '*:files:_files' + '*: :_files' fi ;; esac diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm index 912b5eadf..aa24a3fd6 100644 --- a/Completion/Unix/Command/_rm +++ b/Completion/Unix/Command/_rm @@ -5,7 +5,7 @@ args=( '(-f --force)'{-f,--force}'[ignore nonexistent files, never prompt]' '(-I --interactive)-i[prompt before every removal]' '(-r -R --recursive)'{-r,-R,--recursive}'[remove directories and their contents recursively]' - '*::files:->file' + '*:: :->file' ) if _pick_variant gnu=gnu unix --help; then opts+=(-S) diff --git a/Completion/Unix/Command/_samba b/Completion/Unix/Command/_samba index 9a2fea9d6..775543794 100644 --- a/Completion/Unix/Command/_samba +++ b/Completion/Unix/Command/_samba @@ -55,6 +55,7 @@ case $service in '(-t --timeout)'{-t+,--timeout=}'[change the per-operation timeout]:timeout (seconds)' '(2 -p --port)'{-p+,--port=}'[specify tcp port]:tcp port' '(-g --grepable)'{-g,--grepable}'[produce grepable output]' + '(-q --quiet)'{-q,--quiet}'[suppress help message]' '(-B --browse)'{-B,--browse}'[browse SMB servers using DNS]' '(2 -d --debuglevel)'{-d+,--debuglevel=}'[specify debug level]:debug level:(0 1 2 3 4 5 6 7 8 9 10)' '(2 -O --socket-options)'{-O+,--socket-options=}'[specify socket options]:socket options' diff --git a/Completion/Unix/Command/_script b/Completion/Unix/Command/_script index dfe57a796..436c9661b 100644 --- a/Completion/Unix/Command/_script +++ b/Completion/Unix/Command/_script @@ -24,6 +24,7 @@ case $OSTYPE in "(-e --return $hlp)"{-e,--return}'[return exit status of the child process]' "(-f --flush $hlp)"{-f,--flush}'[flush output after each write]' "($hlp)--force[use output file even when it is a link]" + '(-o --output-limit)'{-o+,--output-limit=}'[terminate if output files exceed specified size]:size (bytes)' "(-q --quiet $hlp)"{-q,--quiet}'[be quiet]' "(-t --timing $hlp)"{-t-,--timing=-}'[output timing data]::timing file:_files' '(- 1)'{-h,--help}'[display help information]' @@ -35,7 +36,7 @@ case $OSTYPE in '-q[be quiet: suppress display of starting and ending lines]' ) ;| - netbsd*|freebsd*) + darwin*|netbsd*|freebsd*) args+=( '(-a -r -k)-d[suppress sleeps when playing back a session]' '(-a -r -k -t)-p[play back a recorded session]' @@ -62,6 +63,9 @@ case $OSTYPE in '*:::arguments: _normal' ) ;| + darwin*|freebsd*) + args+=( '-F[send output to specified named pipe]:fifo:_files -g "*(p)"' ) + ;| *) args+=( '(-p -d)-a[append output]' diff --git a/Completion/Unix/Command/_shred b/Completion/Unix/Command/_shred new file mode 100644 index 000000000..ce583bee4 --- /dev/null +++ b/Completion/Unix/Command/_shred @@ -0,0 +1,19 @@ +#compdef shred gshred + +_arguments -s -S : \ + '(: * -)--help[display help information]' \ + '(: * -)--version[display version information]' \ + '(-f --force)'{-f,--force}'[bypass lack of write permissions]' \ + '(-n --iterations)'{-n+,--iterations=}'[specify number of overwrites]:overwrites [3]' \ + '--random-source=[get random bytes from specified file]:random source file:_files' \ + '(-s --size)'{-s+,--size=}'[shred specified number of bytes]:bytes' \ + '(--remove)-u[deallocate and remove file after overwriting]' \ + '(-u)--remove=-[like -u, or specify how to remove]::how to remove [wipesync]:(( + unlink\:"use standard unlink call" + wipe\:"like unlink, but obfuscate bytes in name first" + wipesync\:"like wipe, but sync each obfuscated byte to disk" + ))' \ + '(-v --verbose)'{-v,--verbose}'[display progress]' \ + '(-x --exact)'{-x,--exact}'[do not round file sizes up to nearest block]' \ + '(-z --zero)'{-z,--zero}'[add final overwrite with zeros]' \ + '*: :_files' diff --git a/Completion/Unix/Command/_sort b/Completion/Unix/Command/_sort index dfd43ce55..a463cf4c0 100644 --- a/Completion/Unix/Command/_sort +++ b/Completion/Unix/Command/_sort @@ -16,27 +16,27 @@ args=( '(-r --reverse)'{-r,--reverse}'[reverse the result of comparisons]' '(-b --ignore-leading-blanks)'{-b,--ignore-leading-blanks}'[ignore leading blanks]' '(-t --field-separator)'{-t+,--field-separator=}'[specify field separator instead of non-blank to blank transition]:separator' - '(-k --key)'{-k+,--key=}'[specified start and end fields for key]:key field' + \*{-k+,--key=}'[specified start and end fields for key]:key field' ) _pick_variant -r variant gnu=GNU $OSTYPE --version case $variant in - dragonfly*|netbsd*|openbsd*|freebsd*|gnu) + dragonfly*|netbsd*|openbsd*|freebsd*|darwin*|gnu) args+=( '(-s --stable)'{-s,--stable}'[preserve original order of lines with the same key]' ) ;| - netbsd*|openbsd*|freebsd*|gnu|solaris2.<11->) + netbsd*|openbsd*|freebsd*|darwin*|gnu|solaris2.<11->) args+=( "(-c --check -C)-C[check whether input is sorted silently; don't sort]" ) ;| - openbsd*|freebsd*|gnu) + openbsd*|freebsd*|darwin*|gnu) args+=( '(-z --zero-terminated)'{-z,--zero-terminated}'[end lines with 0 byte, not newline]' ) ;| - freebsd*|gnu) + freebsd*|darwin*|gnu) args+=( "(-c --check -C)--check=-[check whether input is sorted; don't sort]::bad line handling:(diagnose-first silent quiet)" "$ordering"{-g,--general-numeric-sort}'[compare according to general numeric value]' @@ -49,7 +49,7 @@ case $variant in '--random-source=[get random bytes from file]:file:_files' '--batch-size=[maximum inputs to merge]:number' '--compress-program=[specify program to compress temporary files with]:program:(gzip bzip2 lzop xz)' - '--debug[annotate the of the line used to sort]' + '--debug[annotate the part of the line used to sort]' '(*)--files0-from=[read input files from file]:file:_files' '(-S --buffer-size)'{-S+,--buffer-size=}'[specify size for main memory buffer]:size' '(- *)--help[display help and exit]' @@ -71,7 +71,7 @@ case $variant in gnu) args+=( '--parallel=[set number of sorts run concurrently]:number' ) ;; - freebsd*) + freebsd*|darwin*) args+=( --radixsort --mergesort --qsort --heapsort --mmap ) ;; *) args=( "${(@)args:#(|\(*\))(|\*)--*}" ) ;; diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 9c827d655..d1bd8f04b 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -56,7 +56,7 @@ _ssh () { '(-v)*-q[quiet operation]' \ '*-R+[specify remote port forwarding]:remote port forwarding:->forward' \ '-S+[specify location of control socket for connection sharing]:path to control socket:_files' \ - '-Q+[query parameters]:parameter type:((cipher\:"supported symmetric ciphers" cipher-auth\:"supported symmetric ciphers that support authenticated encryption" mac\:"supported message integrity codes" kex\:"key exchange algorithms" key\:"key types" protocol-version\:"supported SSH protocol versions"))' \ + '-Q+[query parameters]:query option:((cipher\:"supported symmetric ciphers" cipher-auth\:"supported symmetric ciphers that support authenticated encryption" mac\:"supported message integrity codes" kex\:"key exchange algorithms" key\:"key types" key-cert\:"certificate key types" key-plain\:"non-certificate key types" protocol-version\:"supported SSH protocol versions" sig\:"supported signature algorithms" help\:"show supported queries"))' \ '-s[invoke subsystem]' \ '(-t)-T[disable pseudo-tty allocation]' \ '(-T)-t[force pseudo-tty allocation]' \ @@ -452,6 +452,7 @@ _ssh () { CanonicalizeHostname \ CanonicalizeMaxDots \ CanonicalizePermittedCNAMEs \ + CASignatureAlgorithms \ CertificateFile \ ChallengeResponseAuthentication \ CheckHostIP \ diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip index 630140c64..e7f3418d7 100644 --- a/Completion/Unix/Command/_strip +++ b/Completion/Unix/Command/_strip @@ -42,10 +42,39 @@ if _pick_variant gnu=GNU solaris --version; then '(-)'{-V,--version}'[display version information and exit]' '(-v --verbose)'{-v,--verbose}'[list all object files modified or members of archives]') else - args=( - '-l[strip line information only]' - '-V[display version information on stderr and exit]' - '-x[do not strip the symbol table]') + case $OSTYPE in + solaris*) + args=( + '-l[strip line information only]' + '-V[display version information on stderr and exit]' + '-x[do not strip the symbol table]') + ;; + darwin*) + local -a arch + arch=( ${(z)${${"$(_call_program architectures + strings -arch - 2>&1)"}#*flags are: }%%$'\n'*} all ) + args=( + '-u[save all undefined symbols]' + '-r[save all symbols referenced dynamically]' + '-s[save global symbols listed in the specified file]:file:_files' + '-R[remove global symbols listed in the specified file]:file:_files' + '-i[ignore symbols listed in -s/-R file but are not in the object files]' + '-d[save debug symbols in files listed in the specified file]:file:_file' + '-A[save all global absolute symbols and Objective-C class symbols]' + '-n[save all N_SECT global symbols]' + '-S[remove debug symbols]' + '-X[remove local symbols whose names begin with L]' + '-T[remove Swift symbols]' + '-N[remove all nlist symbols and string tables from binaries used by dyld]' + '-x[remove all local symbols]' + '-c[remove section contents of dynamic library to create stub library]' + '-o[write the result to specified file]:output file:_files' + '-no_uuid[remove only LC_UUID load command]' + '-no_split_info[remove LC_SEGMENT_SPLIT_INFO load command]' + '-no_code_signature_warning[not warn when code signature would be invalid in the output]' + '-arch[specify the architecture]:architecture:( $arch )' ) + ;; + esac fi _arguments \ diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index d30f2e657..a066b0728 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -34,7 +34,7 @@ _svn () { typeset -gHA _svn_cmds if _cache_invalid svn-cmds || ! _retrieve_cache svn-cmds; then _svn_cmds=( - ${=${(f)${${"$(_call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z-]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} + ${=${(f)${${"$(_call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z-]##)[[:space:]]#(\([a-z, ?-]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} ) if (( $? == 0 )); then _store_cache svn-cmds _svn_cmds diff --git a/Completion/Unix/Command/_sysctl b/Completion/Unix/Command/_sysctl index c5bb26eb0..2bdcc71f5 100644 --- a/Completion/Unix/Command/_sysctl +++ b/Completion/Unix/Command/_sysctl @@ -1,20 +1,50 @@ #compdef sysctl -local -a args +local -a args sysctlvars case $OSTYPE in + linux*) + args=( + {-e,--ignore}'[ignore errors about unknown keys]' + '(-n -N --names)'{-N,--names}'[show only variable names]' + '(-N -n --values)'{-n,--values}'[show only variable values]' + '(-)'{-w,--write}'[write mode]' + '(-A -a -w --system *)'{-p,--load=}'[specify file to load sysctl settings from]:file (can be regexp):_files' + {-q,--quiet}'[do not display names and values when setting variables]' + '(-e --ignore -w --write -A -a --all *)'{-A,-a,--all}'[display all variables]' + ) + if _pick_variant ng=procps-ng procps --version; then + args+=( + '--deprecated[include deprecated parameters in --all listing]' + {-b,--binary}'[print value without new line]' + '(-p --load)--system[load settings from all system config files]' + {-r+,--pattern=}'[only apply to variables matching specified pattern]:extended regexp' + ) + else + args=( ${args:#((#s)|*\))(\*|)--*} ) # remove long options + fi + _arguments -S -A "-*" : $args \ + '(- :)'{-h,--help}'[display help text and exit]' \ + '(- :)'{-V,--version}'[display version info and exit]' \ + '*:sysctl variable:_files -W /proc/sys' + ;; + freebsd<11->.*) + args+=( + '-B[specify buffer size for reading]:buffer size' + '-t[display type of variable]' + ) + ;| freebsd<10->.*) args+=( '-f+[specify file of name/value pairs to process first]:file:_files' - '-T[display only variables that are setable via loader]' + '-T[display only variables that are settable via loader]' '-W[display only writable variables that are not statistical]' ) ;| - dragonfly*|freebsd*) - args+=( "-i[silently exit if variable doesn't exist]" ) + darwin*|freebsd*) + args+=( '-h[format output for human readability]' ) ;| - freebsd*) - local -a sysctlvars + darwin*|dragonfly*|freebsd*) sysctlvars=( $(_call_program sysctl-variables sysctl -aN) ) _arguments -s -S -A "-*" $args \ '(-a -o *)-A[equivalent to -o -a (for compatibility)]' \ @@ -22,43 +52,41 @@ case $OSTYPE in '-b[binary output]' \ '-d[print the description of the variable instead of its value]' \ '(-N -n)-e[separate name and value with =]' \ - '-h[format output for human readability]' \ + "-i[silently exit if variable doesn't exist]" \ '(-n)-N[show only variable names]' \ '(-N)-n[show only variable values]' \ '(-x)-o[show opaques as well (values suppressed)]' \ '-q[suppress some warnings]' \ '(* -o)-X[equivalent to -x -a (for compatibility)]' \ '(-o)-x[show opaques as well (entire values)]' \ - '(-a)*:sysctl variable:_multi_parts -i . sysctlvars' - ;; - darwin*|dragonfly*) - : ${(A)_cache_sysctlvars:=${${$(sysctl -A 2>/dev/null):#[^a-z]*}%%:*}} - _arguments -s -A "-*" $args \ - '(-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]' \ - '(-n -p -a -A)-w[write mode]' \ - '(-n -w -a -A *)-p[specify file to load sysctl settings from]:file:_files' \ - '(-n -w -p -A *)-a[list all]' \ - '(-n -w -p -a *)-A[list all in table form]' \ - '(-n -p -a -A)*:sysctl variable:_files -W /proc/sys' + '*:sysctl variable:_multi_parts -i -S = -q . sysctlvars' ;; openbsd*) - : ${(A)_cache_sysctlvars:=${${${(f)"$(sysctl -a 2>/dev/null)"}%%=*}:# *}} + sysctlvars=( ${${${(f)"$(_call_program sysctl-variables + sysctl -a 2>/dev/null)"}%%=*}:# *} ) _arguments -S -s -A "-*" \ '(-A -q *)-a[list all string and integer variables]' \ '(-a -q *)-A[list all known variables]' \ '-n[show only values]' \ '(-a -A)-q[suppress all output when setting a variable]' \ - '(-a -A)*:sysctl variable:_multi_parts -i -S = -q . _cache_sysctlvars' + '*:sysctl variable:_multi_parts -i -S = -q . sysctlvars' + ;; + netbsd*) + sysctlvars=( ${${${(f)"$(_call_program sysctl-variables + sysctl -a 2>/dev/null)"}%% =*}%%:*} ) + _arguments -S -s -A "-*" : \ + '(-a -f -M -q -w)-A[list all known variables]' \ + '(-A -f -M -q -w *)-a[list all string and integer variables]' \ + '(-M -w -x)-d[print the description of the variable instead of its value]' \ + '(-f -M -w)-e[separate name and value with =]' \ + '(-a -A -w *)-f[read variable from specified file]:file:_files' \ + '(-a -A -d -r -x -w)-M[print entire MIB instead of just value]' \ + '-n[show only variable values]' \ + '(-A -a -M)-q[silently ignore nonexistent variables]' \ + '(-M -x)-r[binary output]' \ + '(-a -A -d -e -f -M -r)-w[write mode]' \ + '(-d -M -r)*-x[hex output. -xx for hexdupm-like output]' \ + '*:sysctl variable:_multi_parts ${words[(r)-w]:+-S=} -i . sysctlvars' ;; *) _default diff --git a/Completion/Unix/Command/_tail b/Completion/Unix/Command/_tail index 599503ab5..3bfbe37ca 100644 --- a/Completion/Unix/Command/_tail +++ b/Completion/Unix/Command/_tail @@ -38,10 +38,13 @@ else ) ;| (freebsd*|darwin*|dragonfly*|netbsd*) - args+=( '(-f -r)-F[implies -f, but also detect file rename]' ) + args+=( + '(-f -r)-F[implies -f, but also detect file rename]' + '(-v)-q[never output headers giving file names]' + ) ;| - (freebsd*|darwin*|dragonfly*) - args+=( '-q[suppress the headers when displaying multiple files]' ) + (netbsd*) + args+=( '(-q)-v[always output headers giving file names]' ) ;; esac fi diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux index ae3446a08..0e8fe2223 100644 --- a/Completion/Unix/Command/_tmux +++ b/Completion/Unix/Command/_tmux @@ -304,7 +304,7 @@ _tmux-display-message() { _arguments -s -S \ '-c+[specify target client]:client:__tmux-clients' \ '-p[print message to stdout]' \ - '-t+[specify target client]:client:__tmux-clients' \ + '-t+[specify target pane]:pane:__tmux-panes' \ '-F+[specify output format]:format:__tmux-formats' \ ':message' } @@ -809,8 +809,9 @@ _tmux-set-window-option() { _tmux-set-hook() { [[ -n ${tmux_describe} ]] && print "set a hook to a command" && return _arguments -s \ - '-g[add hook to global list]' \ - '-u[unset a hook]' \ + '(-R)-g[add hook to global list]' \ + '(-g -u)-R[run hook immediately]' \ + '(-R)-u[unset a hook]' \ '-t+[specify target session]:session:__tmux-sessions' \ ':hook name:_tmux_hooks' \ '*:::command:= _tmux' diff --git a/Completion/Unix/Command/_toilet b/Completion/Unix/Command/_toilet index 2c2b8682a..a8867769b 100644 --- a/Completion/Unix/Command/_toilet +++ b/Completion/Unix/Command/_toilet @@ -6,7 +6,7 @@ typeset -A opt_args fontdir=$(_call_program path toilet -I2 2>/dev/null) _arguments \ - '(-f --font)'{-f,--font}'[specify font]:font:_files -W ${~opt_args[-d]\:-$fontdir} -g \*tlf\*\(-.\:r\)' \ + '(-f --font)'{-f,--font}'[specify font]:font:_files -W ${~opt_args[-d]\:-$fontdir} -g \*\[ft\]lf\*\(-.\:r\)' \ '(-d --directory)'{-d,--directory}'[specify font directory]:font directory:_files -/' \ '(-t --termwidth -w --width)'{-w,--width}'[set output width]:width:' \ '(-t --termwidth -w --width)'{-t,--termwidth}'[adapt to terminal width]' \ diff --git a/Completion/Unix/Command/_tty b/Completion/Unix/Command/_tty new file mode 100644 index 000000000..838975098 --- /dev/null +++ b/Completion/Unix/Command/_tty @@ -0,0 +1,18 @@ +#compdef tty gtty + +local -a args + +if _pick_variant gnu='Free Soft' unix --version; then + args=( + '(-)--help[display help information]' + '(-)--version[display version information]' + '(-s --quiet --silent)'{-s,--quiet,--silent}'[suppress normal output]' + ) +else + args=( '-s[suppress normal output]' ) + [[ $OSTYPE == solaris* ]] && args+=( + "-l[display terminal's synchronous line number]" + ) +fi + +_arguments -s -S : $args diff --git a/Completion/Unix/Command/_visudo b/Completion/Unix/Command/_visudo new file mode 100644 index 000000000..2cb6d85a5 --- /dev/null +++ b/Completion/Unix/Command/_visudo @@ -0,0 +1,12 @@ +#compdef visudo + +_arguments -s -S : \ + '(: * -)'{-h,--help}'[display help information]' \ + '(: * -)'{-V,--version}'[display version information]' \ + '(-f --file)'{-f+,--file=}'[specify sudoers file]:sudoers file:_files' \ + + c \ + '(x -c --check)'{-c,--check}'[check sudoers file for errors only]' \ + '(-q --quiet)'{-q,--quiet}'[suppress error messages (with -c)]' \ + '(x -s --strict)'{-s,--strict}'[enable strict checking]' \ + + '(x)' \ + '(c)'{-x+,--export=}'[export sudoers file to specified JSON output file]:JSON output file:_files' diff --git a/Completion/Unix/Command/_watch b/Completion/Unix/Command/_watch index a8d29403f..fff3d56f6 100644 --- a/Completion/Unix/Command/_watch +++ b/Completion/Unix/Command/_watch @@ -1,9 +1,42 @@ #compdef watch -# watch(1) has completely different semantics on freebsd compared to linux, hence: -case $OSTYPE in - (freebsd*|dragonfly*) _watch-snoop "$@";; - (*) _default;; +local variant ret=1 +local -a context line state state_descr +local -A opt_args + +_pick_variant -r variant procps=procps $OSTYPE --version + +case $variant in + (procps) + _arguments -s -S -A '-*' : \ + '(: * -)'{-h,--help}'[display help information]' \ + '(: * -)'{-v,--version}'[display version information]' \ + '(-b --beep)'{-b,--beep}'[beep on non-zero command exit]' \ + '(-c --color)'{-c,--color}'[interpret ANSI color/style sequences]' \ + '(-d --differences)'{-d-,--differences=-}'[highlight changes between updates]::how to highlight:(permanent)' \ + '(-e --errexit)'{-e,--errexit}'[freeze updates on non-zero command exit]' \ + '(-g --chgexit)'{-g,--chgexit}'[exit on command output change]' \ + '(-n --interval)'{-n+,--interval=}'[specify update interval]:update interval (seconds) [2]' \ + '(-p --precise)'{-p,--precise}'[run command at precise intervals]' \ + '(-t --no-title)'{-t,--no-title}'[disable header]' \ + '(-x --exec)'{-x,--exec}'[pass command to exec(2) instead of `sh -c`]' \ + '(-)*::: :->cmd' \ + && ret=0 + + [[ $state == cmd ]] && + if + (( CURRENT == 1 )) && + [[ $words[1] == (\"|\'|\$\')* ]] && + [[ -z $opt_args[(i)(-x|--exec)] ]] + then + _cmdstring && ret=0 + else + _normal && ret=0 + fi + ;; + # watch(1) has completely different semantics on freebsd compared to linux, hence: + (freebsd*|dragonfly*) _watch-snoop "$@" && ret=0 ;; + (*) _default && ret=0 ;; esac -# NOTREACHED +return ret diff --git a/Completion/Unix/Command/_xxd b/Completion/Unix/Command/_xxd index 0034be519..3a8efd664 100644 --- a/Completion/Unix/Command/_xxd +++ b/Completion/Unix/Command/_xxd @@ -41,7 +41,7 @@ arguments=( {-o+,-offset}'[add specified offset to displayed file position]:offset' {-s,-skip,-seek}'[specify file offset to dump from]: :_guard "[0-9]#" "file offset to dump from (absolute or relative)"' - ':files:_files' + ': :_files' ) _arguments -S $arguments diff --git a/Completion/Unix/Command/_zcat b/Completion/Unix/Command/_zcat index cf927507b..baa7bd791 100644 --- a/Completion/Unix/Command/_zcat +++ b/Completion/Unix/Command/_zcat @@ -1,6 +1,6 @@ #compdef zcat -if _pick_variant gz='(GNU|NetBSD)' unix --license; then +if _pick_variant gz='(GNU|NetBSD|Apple)' unix --license; then _gzip "$@" else _compress "$@" |