diff options
Diffstat (limited to 'Completion/Unix')
179 files changed, 7074 insertions, 3593 deletions
diff --git a/Completion/Unix/Command/_aap b/Completion/Unix/Command/_aap index 089a993c3..38e50f1fc 100644 --- a/Completion/Unix/Command/_aap +++ b/Completion/Unix/Command/_aap @@ -20,7 +20,7 @@ _arguments -C -s -S \ \*{-c,--command=}'[execute a command after reading the recipe]:aap command:' \ '(-k --continue)'{-k,--continue}'[continue building after an error]' \ '(-S --stop)'{-S,--stop}'[stop building at first error (default)]' \ - '(-N,--nofetch-recipe -R --fetch-recipe)'{-R,--fetch-recipe}'[fetch recipe file and child recipes]' \ + '(-N --nofetch-recipe -R --fetch-recipe)'{-R,--fetch-recipe}'[fetch recipe file and child recipes]' \ '(-R --fetch-recipe -N --nofetch-recipe)'{-N,--nofetch-recipe}'[do not fetch recipes for "fetch" target]' \ '(-a --nocache)'{-a,--nocache}"[always download files, don't use the cache]" \ '(-l --local)'{-l,--local}'[do not recurse into subdirectories]' \ diff --git a/Completion/Unix/Command/_abcde b/Completion/Unix/Command/_abcde index 361b43091..3f748d373 100644 --- a/Completion/Unix/Command/_abcde +++ b/Completion/Unix/Command/_abcde @@ -1,50 +1,41 @@ #compdef abcde -(( $+functions[_abcde_fields] )) || -_abcde_fields(){ - _values -s , field year genre -} - -(( $+functions[_abcde_actions] )) || -_abcde_actions(){ - _values -s , action cddb cue read getalbumart embedalbumart normalize encode tag move replaygain playlist clean -} - -_arguments -s \ +_arguments -s -S -A "-*" \ '(-t -T -p)-1[encode the whole CD in a single file]' \ - '-a[comma-delimited list of actions to perform]:action:_abcde_actions' \ + '-a[comma-delimited list of actions to perform]:action:_sequence compadd - cddb cue read getalbumart embedalbumart normalize encode tag move replaygain playlist clean' \ '-b[enable batch mode normalization]' \ '-B[enable automatic embedding of album art with certain containers]' \ - '-c[specify an additional configuration file to parse]:config:_files' \ - '-C[resume a session for discid when you no longer have the CD available]:discid' \ - '-d[CD-ROM block device that contains audio tracks to be read]:cd-rom-file:_files' \ + '-c+[specify an additional configuration file to parse]:config:_files' \ + '-C+[resume a session when read was completed but CD is not present]:disc id:compadd abcde.*(N:e)' \ + '-d+[specify CD device from which to read audio tracks]:CD device:_files -g "*(-%)" -P / -W /' \ '-D[capture debugging information]' \ '-e[erase information about encoded tracks from the internal status file]' \ '-f[force the removal of the temporary ABCDETEMPDIR directory]' \ "-g[enable lame's --nogap option]" \ '-G[download album art using the getalbumart function]' \ '(- :)-h[get help information]' \ - '-j[start a specified number of encoder processes at once]:number' \ + '-j+[start specified number of encoder processes at once]:number' \ '-k[keep the wav files after encoding]' \ - '-l[use the low-diskspace algorithm]' \ + '-l[use the low disk space algorithm]' \ '-L[use a local CDDB repository]' \ '-m[create DOS-style playlists, modifying the resulting one by adding CRLF line endings those to work]' \ "-n[don't query CDDB database]" \ '-N[non interactive mode]' \ - '-o[select output type]:outputtype:(vorbis ogg mp3 flac spx mpc m4a wav wv ape opus mka aiff)' \ + '-o+[select output type]:output type [vorbis]:(vorbis ogg mp3 flac spx mpc m4a wav wv ape opus mka aiff)' \ "-p[pads track numbers with 0's]" \ '-P[use Unix PIPES to read and encode in one step]' \ - '-r[remote encode on this comma-delimited list of machines using distmp3]:hosts:_sequence _hosts' \ - '-s[fields to be shown in the CDDB parsed entries]:field:_abcde_fields' \ - '-S[set the speed of the CD drive]:speed' \ - '-t[start the numbering of the tracks at a given number]:track-number' \ - '-T[start the numbering of the tracks at a given number and change internal tag numbering]:track-number' \ + '-Q+[specify CD lookup methods]:lookup method [musicbrainz]:_sequence compadd - musicbrainz cddb cdtext' \ + '-r+[remote encode on this comma-delimited list of machines using distmp3]:hosts:_sequence _hosts' \ + '-s+[fields to be shown in the CDDB parsed entries]:field:_sequence compadd - year genre' \ + '-S+[set the speed of the CD drive]:speed' \ + '-t+[start the numbering of the tracks at a given number]:track-number' \ + '-T+[start the numbering of the tracks at a given number and change internal tag numbering]:track-number' \ '-U[set CDDBPROTO to version 5]' \ '(- :)-v[show the version and exit]' \ '-V[be more verbose]' \ '-x[eject the CD when all tracks have been read]' \ - '-X[use an alternative "cue2discid" implementation]:cue2discid' \ - '-w[add a comment to the tracks ripped from the CD]:comment' \ - "-W[concatenate CD's]:cd-number" \ + '-X+[use an alternative "cue2discid" implementation]:cue2discid:_command_names -e' \ + '-w+[add a comment to the tracks ripped from the CD]:comment' \ + "-W+[concatenate CD's]:cd-number" \ '-z[debug mode]' \ - '*:tracks:' + '*: :_guard "^-*" "track list"' diff --git a/Completion/Unix/Command/_ack b/Completion/Unix/Command/_ack index e83a9330e..6dc3ab0d1 100644 --- a/Completion/Unix/Command/_ack +++ b/Completion/Unix/Command/_ack @@ -72,7 +72,7 @@ _arguments -C -s -S \ '(1)-g[print files where the relative path + filename matches the given pattern]:pattern to match against filenames' \ '--sort-files[sorts the found files lexically]' \ '--show-types[print the file types that ack associates with each file]' \ - '(--files-from -x)--files-from=[read the list of files to search from specified file]:files:_files' \ + '(--files-from -x)--files-from=[read the list of files to search from specified file]:file:_files' \ '(-x --files-from)-x[read the list of files to search from standard input]' \ '*--ignore-dir'{,ectory}'=[ignore directory]:directory:_directories' \ '*--noignore-dir'{,ectory}'=[remove directory from ignored list]:directory:_directories' \ @@ -86,7 +86,7 @@ _arguments -C -s -S \ '*--type-'{add,set}'=[files with the given extensions are recognized as being of the given type]:type-def:->type-defs' \ '*--type-del=[remove all filters associated with specified file type]: :->file-types' \ '(--env)--noenv[ignore environment variables and global ackrc files]' '!(--noenv)--env)' \ - '--ackrc=[specify an ackrc file to use]:files:_files' \ + '--ackrc=[specify an ackrc file to use]:file:_files' \ '--ignore-ack-defaults[ignore default definitions included with ack]' \ "${ign}(- 1 *)--create-ackrc[output an ackrc based on customizations]" \ "${ign}(- 1 *)"{-\?,--help}'[display usage information]' \ diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb index 75a447dfc..8a071fa8e 100644 --- a/Completion/Unix/Command/_adb +++ b/Completion/Unix/Command/_adb @@ -43,6 +43,7 @@ _adb() { "disconnect" "emu" "enable-verity" + "exec-out" "forward" "get-devpath" "get-serialno" @@ -81,11 +82,12 @@ _adb() { if ! adb ${ADB_DEVICE_SPECIFICATION} shell exit 2>/dev/null; then # early bail-out until a single valid device/emulator is specified and up-and-running [[ $words[CURRENT-1] = -s ]] || _message -r "No (started) device specified, completions do not yet work" + #TODO handle -t transport-id _arguments \ '-s[serial]: :_adb_device_serial' \ '( -e)-d[device]' \ '(-d )-e[emulator]' \ - '1:options:_adb_options_handler' \ + '1:option:_adb_options_handler' \ '*: : _default' return @@ -109,7 +111,7 @@ _adb_dispatch_command () { fi case ${curcontext} in - (*:adb-shell:) + (*:adb-shell:|*:adb-exec-out:) (( $+functions[_adb_dispatch_shell] )) && _adb_dispatch_shell ;; (*:adb-backup:) @@ -141,7 +143,7 @@ _adb_dispatch_command () { '(-d -e)-s[serial]: :_adb_device_serial' \ '(-s -e)-d[device]' \ '(-d -s)-e[emulator]' \ - '*:options:_adb_options_handler' + '*:option:_adb_options_handler' ;; esac } @@ -164,18 +166,16 @@ _adb_sanitize_context () { (( $+functions[_adb_device_specification] )) || _adb_device_specification () { - local -a word - word=($words[(R)-[des]]) - if [[ $words[(R)-s] == -s ]]; then - local i=$words[(I)-s] - word=($words[i,i+1]) + if [[ $words[2] == -[de] ]]; then + ADB_DEVICE_SPECIFICATION=($words[2]) + elif [[ $words[2] == -[st] ]]; then + ADB_DEVICE_SPECIFICATION=($words[2,3]) fi - ADB_DEVICE_SPECIFICATION=($word) } (( $+functions[_adb_dispatch_shell] )) || _adb_dispatch_shell () { - if [[ ${#words} -le 2 ]] + if [[ $CURRENT -le 2 ]] then (( $+functions[_adb_shell_commands_handler] )) && _adb_shell_commands_handler return @@ -188,6 +188,15 @@ _adb_dispatch_shell () { (pm) (( $+functions[_adb_package_manager_handler] )) && _adb_package_manager_handler ;; + (cmd) + (( $+functions[_adb_cmd_handler] )) && _adb_cmd_handler + ;; + (dumpsys) + (( $+functions[_adb_dumpsys_handler] )) && _adb_dumpsys_handler + ;; + (start|stop) + (( $+functions[_adb_startstop] )) && _adb_startstop ${words[2]} + ;; (*) _arguments '*: :_adb_remote_folder' ;; @@ -262,7 +271,7 @@ _adb_intent_handler () { (( $+functions[_adb_activity_manager_handler] )) || _adb_activity_manager_handler () { - if [[ ${#words} -le 3 ]] + if [[ $CURRENT -le 3 ]] then _wanted am_argument expl 'am argument' compadd start startservice broadcast instrument profile return @@ -318,6 +327,79 @@ _adb_package_manager_handler () { esac } +(( $+functions[_adb_cmd_handler] )) || +_adb_cmd_handler () { + local -a cmds + cmds=(${${${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out cmd -l)"}[2,-1]}##[[:space:]]##}) + _wanted dumpsys expl 'cmd command' compadd ${cmds%$'\r'} +} + +(( $+functions[_adb_dumpsys_handler] )) || +_adb_dumpsys_handler () { + if [[ $CURRENT -eq 3 ]]; then + local -a services + services=(${${${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out dumpsys -l)"}[2,-1]}##[[:space:]]##}) + _wanted dumpsys expl 'dumpsys service' compadd - ${services%$'\r'} + elif [[ $CURRENT -ge 4 && $words[3] == SurfaceFlinger ]]; then + (( CURRENT -= 2 )) + shift 2 words + typeset -A opt_args + local context state state_descr line + _arguments -R \ + '--file[start/stop continuous dumpsys to file]' \ + '--no-limit[disable wrapping around continuous dumpsys at ~20MB]' \ + '--full-dump[set fullDump = true]' \ + '--allocated_buffers[show allocated buffers dump]' \ + '--display-id[show display id dump]' \ + '--dispsync[show dispsync dump]' \ + '--edid[raw edid dump for specified hwc display (binary output)]:*:hwc display:->hwcdisplay' \ + '--latency[show latency stats]:*:layer:->layer' \ + '--latency-clear[clear latency stats]:*:layer:->layer' \ + '--list[list all layers]' \ + '--planner[pass planner dump arguments]:*:planner arguments:->planner' \ + '--static-screen[show static screen stats]' \ + '--timestats[pass time stats arguments]:*:timestats arguments:->timestats' \ + '--vsync[show vsync dump]' \ + '--wide-color[show wide color info]' \ + '--frametimeline[pass frametimeline arguments]:*:frametimeline arguments:->frametimeline' \ + '--mini[show mini dump]' + if [[ $? == 300 ]]; then + case $state in + layer) + typeset -a layers + layers=(${${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out dumpsys SurfaceFlinger --list)"}[2,-1]}) + _wanted dumpsys expl 'layers' compadd - ${layers%$'\r'} + ;; + planner) + _arguments \ + {--compare,-c}'[compare predictions of two hashes]:left: :right: :' \ + {--describe,-d}'[describe hash]:hash: :' \ + {--help,-h}'[help]' \ + {--similar,-s}'[show similar stacks matching given plan]:plan: :' \ + {--layers,-l}'[show current layers]' + ;; + timestats) + _arguments -disable -enable -clear -dump -maxlayers'[only with -dump]:int:' + ;; + frametimeline) + _arguments -jank -all + ;; + esac + fi + fi +} + +(( $+functions[_adb_startstop] )) || +_adb_startstop () { + local -a services + local -A service_status + services=(${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out getprop)"}) + service_status=( ${(s,: ,)${(j,: ,)${(M)services:#\[init.svc.*}}} ) + local -A map=(start stopped stop running) + services=( ${(k)service_status[(R)*$map[$1]*]} ) + _wanted services expl "$map[$1] services" compadd - ${${${services#\[}%\]}#init.svc.} +} + (( $+functions[_adb_dispatch_uninstall] )) || _adb_dispatch_uninstall () { _arguments \ @@ -344,12 +426,12 @@ _adb_dispatch_install () { (( $+functions[_adb_dispatch_push] )) || _adb_dispatch_push () { - if [[ ${#words} -gt 3 ]] + if [[ $CURRENT -gt 3 ]] then _message -r "Notice: you can only push a single item at a time" return fi - if [[ ${#words} -gt 2 ]] + if [[ $CURRENT -gt 2 ]] then _arguments '*: :_adb_remote_folder' else @@ -359,12 +441,12 @@ _adb_dispatch_push () { (( $+functions[_adb_dispatch_pull] )) || _adb_dispatch_pull () { - if [[ ${#words} -gt 3 ]] + if [[ $CURRENT -gt 3 ]] then _message -r "Notice: you can only pull a single item at a time" return fi - if [[ ${#words} -gt 2 ]] + if [[ $CURRENT -gt 2 ]] then _arguments '*:local file/folder:_files' else @@ -392,7 +474,7 @@ _adb_check_log_redirect () { (( $+functions[_adb_trace_opts] )) || _adb_trace_opts() { - _values -s , 'adb trace options' \ + _values -s , 'adb trace option' \ '(1 adb sockets packets rwx usb sync sysdeps transport jdwp)all' \ '(all adb sockets packets rwx usb sync sysdeps transport jdwp)1' \ 'adb' \ @@ -411,14 +493,16 @@ _adb_device_serial() { local expl local -a devices device_desc local device - devices=( $(adb devices -l | sed -n 's/^\([^[:space:]]*\)[[:space:]]*.*product:\([^[:space:]]*\).*$/\1:\2/p') ) + devices=( $(adb devices -l | sed -n -e 's/:/\\:/' -e 's/^\([^[:space:]]*\)[[:space:]]*.*product:\([^[:space:]]*\).*$/\1:\2/p') ) zstyle -a :completion:${curcontext} device-names device_desc for device in $device_desc; do if [[ -n $devices[(r)${device%:*}:*] ]]; then devices[(i)${device%:*}:*]=$device + elif [[ -n $devices[(r)*:${device%:*}] ]]; then + devices[(i)*:${device%:*}]=${${devices[(r)*:${device%:*}]}%:*}:${device#*:} fi done - _describe -t dev_serial 'available devices' devices + _describe -t dev_serial 'available device' devices } (( $+functions[_adb_logcat_filter_specification] )) || @@ -446,8 +530,8 @@ _adb_dispatch_logcat() { _arguments \ '(-c -g)-s[set default filter to silent]' \ '(-c -g)-f[log output to file (defaults to stdout)]:logfile:_files' \ - '(-c -g -d)-r[rotate log every kbytes (default 16, requires -f)]:logsize:_guard "[0-9]#" "numeric value"' \ - '(-c -g -d)-n[max number of rotated logs (default 4)]:number :_guard "[0-9]#" "numeric value"' \ + '(-c -g -d)-r[rotate log at specified size, requires -f]:log size (kbytes) [16]' \ + '(-c -g -d)-n[specify max number of rotated logs]:number [4]' \ '(-c -g -d)-v[log format]:format: _values "format" brief process tag thread raw time threadtime long' \ '(-d -t -g)-c[clear log]' \ '(-c -g)-d[dump log]' \ @@ -459,13 +543,13 @@ _adb_dispatch_logcat() { (( $+functions[_adb_options_handler] )) || _adb_options_handler() { local expl - _wanted adb_options expl 'adb options' compadd "${ALL_ADB_COMMANDS[@]}" + _wanted adb_options expl 'adb option' compadd "${ALL_ADB_COMMANDS[@]}" } (( $+functions[_adb_shell_commands_handler] )) || _adb_shell_commands_handler() { local expl - _wanted adb_shell_commands expl 'adb shell commands' compadd ls pm am mkdir rmdir rm cat + _wanted adb_shell_commands expl 'adb shell command' compadd ls pm am mkdir rmdir rm cat cmd dumpsys start stop } (( $+functions[_adb_device_available] )) || @@ -514,7 +598,7 @@ _adb_installed_packages() { _adb_users() { local -a users users=( ${${${(M)${(f)"$(adb shell pm list users)"}:#*UserInfo*}#*UserInfo\{}%:*} ) - _describe -t users 'users' users + _describe -t users 'user' users } (( $+functions[_adb_cache_policy_single_command] )) || diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible index f1e13a813..2d976b0a0 100644 --- a/Completion/Unix/Command/_ansible +++ b/Completion/Unix/Command/_ansible @@ -1,7 +1,7 @@ -#compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault -value-,ANSIBLE_STDOUT_CALLBACK,-default- +#compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault -value-,ANSIBLE_STDOUT_CALLBACK,-default- -value-,ANSIBLE_INVENTORY_ENABLED,-default- -local curcontext="$curcontext" plug plugvar ign ret=1 -local -a args state line +local curcontext="$curcontext" plug plugvar subcmd ign ret=1 +local -a args state line expl gactions local -A opt_args case $service in @@ -9,6 +9,10 @@ case $service in plug=callback state=plugins ;; + *,ANSIBLE_INVENTORY_ENABLED,*) + plug=inventory + state=plugins + ;; ansible|ansible-console|ansible-doc|ansible-playbook) args=( \*{-M+,--module-path=}'[specify path to modules]:module path:_dir_list' @@ -18,6 +22,8 @@ case $service in args+=( '(-K --ask-become-pass)'{-K,--ask-become-pass}'[ask for privilege escalation password]' '(-k --ask-pass)'{-k,--ask-pass}'[ask for connection password]' + '--list-hosts[output list of matching hosts]' + '(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts' '(-T --timeout)'{-T+,--timeout=}'[override the connection timeout]:timeout (seconds) [10]' '(-c --connection)'{-c+,--connection=}'[specify connection type]:connection type [smart]:->connect-types' '(-u --user)'{-u+,--user=}'[specify remote user for connection]:remote user:_users' @@ -40,31 +46,17 @@ case $service in '!(-R --su-user -U --sudo-user)'{-R,-U,--su-user,--sudo-user}':user [root]:_users' ) ;| - ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull|ansible-vault) - args+=( - '--ask-vault-pass[ask for vault password]' - '--vault-id=[specify vault identity to use]:vault identity' - '--vault-password-file=[specify vault password file]:vault password file:_files' - ) - ;| ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull) args+=( + --ask-vault-pass{,word}'[ask for vault password]' + '(-e --extra-vars)'{-e+,--extra-vars=}'[set additional variables]:key=value or YAML/JSON' + '--vault-id=[specify vault identity to use]:vault identity' + --vault-pass{,word}-file='[specify vault password file]:vault password file:_files' \*{-i+,--inventory=}'[specify inventory host file or host list]: : _alternative "files\:inventory file\:_files" "hosts\:host\: _sequence _hosts"' '!(-i --inventory)--inventory-file=:inventory file:_files' ) ;| - ansible|ansible-console|ansible-playbook|ansible-pull) - args+=( - '--list-hosts[output list of matching hosts]' - '(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts' - ) - ;| - ansible|ansible-playbook|ansible-pull) - args+=( - '(-e --extra-vars)'{-e+,--extra-vars=}'[set additional variables]:key=value or YAML/JSON' - ) - ;| ansible|ansible-console|ansible-inventory) args+=( '--playbook-dir=[specify substitute playbook directory]:directory:_directories' @@ -72,15 +64,20 @@ case $service in ;| ansible-playbook|ansible-pull) args+=( - '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]' + '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]:tag:->tags' "--skip-tags[only run plays and tasks whose tags don't match]" ) ;| + ansible|ansible-console) + args+=( + '--task-timeout[set the task timeout limit]:timeout (seconds)' + ) + ;| ansible) args+=( '(-a --args)'{-a+,--args=}'[specify command or module arguments]:arguments:->args' '(-B --background)'{-B+,--background=}'[run asynchronously, failing after specified time]:fail timeout (seconds)' - '(-m --module-name)'{-m+,--module-name=}'[specify module]:module:->plugins' + '(-m --module-name)'{-m+,--module-name=}'[specify action to execute]: :->plugins' '(-o --one-line)'{-o,--one-line}'[condense output]' '(-P --poll)'{-P+,--poll=}'[specify the poll interval if using -B]:interval (seconds) [15]' '(-t --tree)'{-t+,--tree=}'[specify directory for log output]:directory:_directories' @@ -106,11 +103,15 @@ 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]' - '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(become cache callback cliconf connection httpapi inventory lookup shell module strategy vars)' + '!--metadata-dump' # "internal testing only" + '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-j,--json}'[change output to json format]' + '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-l,--list}'[list available plugins]' + '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-F,--list_files}'[show plugin names and their source files without summaries]' + '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-s,--snippet}'[show playbook snippet for specified plugins]' + '(-l --list -F --list_files -s --snippet -e --entry-point)--metadata-dump[dump json metadata for all plugins]' + '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-e+,--entry-point=}'[select the entry point for roles]:entry point' + '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(become cache callback cliconf connection httpapi inventory lookup netconf shell vars module strategy role keyword)' + '(-r --roles-path)'{-r+,--roles-path=}'[specify directory containing roles]:directory:_directories' '*:plugin:->plugins' ) ;; @@ -124,15 +125,16 @@ case $service in '(-y --yaml --vars --graph)--toml[use TOML format instead of JSON]' '(-y --yaml)--vars[add variables to the graph display]' '(-y --yaml --toml --vars --graph)'{-y,--yaml}'[use YAML format instead of JSON]' + ':host or group:->hosts' ) ;; ansible-galaxy) - args+=( -A "-*" $args + args=( -A "-*" $args '--list[list integrations]' '(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]' '(-s --server)'{-s+,--server=}'[specify API server destination]:server destination' '--remove=[remove integration]:integration id' - '1:action:(delete import info init install list login remove search setup)' + '::type:(collection role)' '*::args:->galaxy' ) ;; @@ -154,7 +156,7 @@ case $service in '(-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)' - '--accept-host-key[adds the hostkey for the repo url if not already added]' + '--accept-host-key[add the hostkey for the repo url if not already added]' '--purge[purge checkout after playbook run]' '(-f --force)'{-f,--force}'[run the playbook even if the repository could not be updated]' '(-C --checkout)'{-C,--checkout}'[specify branch/tag/commit to checkout]:branch/tag/commit' @@ -168,9 +170,7 @@ case $service in ;; ansible-vault) args=( -A "-*" $args - '::action:(create decrypt edit encrypt encrypt_string rekey view)' - '--new-vault-id=[specify new vault identity to use for rekey]:vault id' - '--new-vault-password-file=[specify new vault password file to use for rekey]:file:_files' + '::action:compadd -M "r:|_=* r:|=*" - create decrypt edit encrypt encrypt_string rekey view' '*::args:->vault' ) ;; @@ -225,34 +225,82 @@ case $state in if zstyle -T ":completion:${curcontext}:plugins" verbose; then (( ${(P)#plugvar} )) || set -A ${plugvar} \ ${${(f)"$(_call_program plugins ansible-doc -t $plug -l)"}/ ##/:} - _describe -t plugins "${plug} plugin" $plugvar && ret=0 + _describe -t plugins "${plug} plugin" $plugvar -M 'r:|.=* r:|=*' && ret=0 else (( ${(P)#plugvar} )) || set -A ${plugvar} \ ${${(f)"$(_call_program plugins ansible-doc -t $plug -F)"}%% *} - _wanted plugins expl "${plug} plugin" compadd -a $plugvar && ret=0 + _wanted plugins expl "${plug} plugin" compadd -M 'r:|.=* r:|=*' -a $plugvar && ret=0 fi ;; + tags) + # The recursive glob here is questionable and perhaps there should be a style. + _sequence _wanted tags expl tag compadd - \ + ${(s.,.)${(j.,.)${(M)${(f)"$(cat **/*.yml)"}:# #tags:*}#*: }} && ret=0 + ;; galaxy) ign='' - curcontext="${curcontext%:*}-${line[1]}:" - (( $#words > 2 )) && ign='!' + gactions=( delete import info init install list remove search setup ) + case ${(j.:.)line[1,3]} in + (role|collection):*:*) + subcmd="${line[1]}-${line[2]}" + ;; + collection:*) + gactions=( init build publish install ) + subcmd=collection + ;; + role:*) subcmd=role ;; + *:*) subcmd="role-${line[1]}" ;& + [^:]#) + words=( role "$words[@]" ) + (( CURRENT++ )) + ;; + esac + curcontext="${curcontext%:*}-${subcmd}:" + (( $#words > 3 )) && 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]' + '1: :{ _wanted actions expl action compadd -a gactions }' ) - case $line[1] in - info|search|list|remove|install) + case $subcmd in + *-*) + args+=( + '(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]' + '(-s --server)'{-s+,--server=}'[specify API server destination]:server:_hosts' + --{token,api-key}='[specify ansible galaxy API key]:api key' + \*{-v,--verbose}'[verbose mode]' + ) + ;| + role-setup) # order important here, source comes before github args + args+=( ': :_guard "^-*" "source"' '*:secret' ) + ;| + role-(delete|import|setup)) + args+=( ': :_guard "^-*" "github username"' ':github repository' ) + ;| + role-(info|init|install|list|remove)) + args+=( '*: :_guard "^-*" "role name"' ) + ;| + role-(info|search|list|remove|install)) args+=( '(-p --roles-path)'{-p,--roles-path}'[specify location of roles]:path:_directories' ) ;| - info|init) + role-(info|init)) args+=( "--offline[don't query the galaxy API]" ) ;| - init|install) - args+=( '(-f --force)'{-f,--force}'[force overwriting an existing role]' ) + *-(init|build|install)) + args+=( '(-f --force)'{-f,--force}'[force overwriting an existing role or collection]' ) ;| - search) + *-install) + args+=( + '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors and continue with the next specified role/collection]' + '(-n --no-deps)'{-n,--no-deps}"[don’t download roles/collections listed as dependencies]" + "--force-with-deps[force overwriting an existing role/collection and it's dependencies]" + ) + ;| + *-init) + args+=( + '--init-path=[specify path in which the skeleton will be created]:path:_directories' + ) + ;| + role-search) args+=( '--author=[specify GitHub username]:username' '--galaxy-tags=[specify list of galaxy tags to filter by]:galaxy tags' @@ -260,29 +308,25 @@ case $state in '*: :_guard "^-*" "search term"' ) ;; - setup) + role-setup) args+=( '--list[list integrations]' '--remove=[remove integration]:integration id' ) ;; - init) + role-init) args+=( - '--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]' + '--role-skeleton=[specify path to a role skeleton that the new role should be based upon]:path:_files' '--type=[initialize using an alternate role type]:role type:(container apb network)' ) ;; - install) + role-install) args+=( - "--force-with-deps[force overwriting an existing role and it's dependencies]" - '(-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' ) ;; - import) + role-import) args+=( '--status[check the status of the most recent import request for given github_user/github_repo]' "--no-wait[don’t wait for import results]" @@ -290,34 +334,70 @@ case $state in '--role-name=[specify name the role should have]:role' ) ;; - login) + collection-build) + args+=( + '--output-path=[specify path in which the collection is built to]:path [.]:_directories' + '*:collection directory to build:_directories' + ) + ;; + collection-init) args+=( - '--github-token=[identify with github token rather than username and password]' + '--collection-skeleton=[specify path to a collection skeleton that the new role should be based upon]:path:_files' + ': :_guard "^-*" "collection name"' ) ;; + collection-publish) + args+=( + "--no-wait[don't wait for import validation results]" + '--import-timeout=[specify time to wait for import process]:time' + ':collection tarball:_files' + ) + ;; + collection-install) + args+=( + '(-p --collections-path)'{-p+,--collections-path=}'[specify directory containing collections]:_directories' + '(-r --requirements-file *)'{-r+,--requirements-file=}'[specify file containing a list of collections to install]:file:_files' + '--pre[include pre-release versions]' + '*:collection name:_files' + ) + ;; esac - _arguments -s -S $args && ret=0 + _arguments -s -S : $args && ret=0 ;; vault) + ign='' curcontext="${curcontext%:*}-${line[1]}:" - args=() + (( $#words > 2 )) && ign='!' + args=( + "${ign}(-)"{-h,--help}'[display usage information]' + --ask-vault-pass{,word}'[ask for vault password]' + '--vault-id=[specify vault identity to use]:vault identity' + --vault-pass{,word}-file='[specify vault password file]:vault password file:_files' + \*{-v,--verbose}'[verbose mode]' + ) case $line[1] in - encrypt*|edit|rekey) + create|(de|en)crypt*|edit|rekey) args+=( '--encrypt-vault-id=[specify vault id to use to encrypt (required if more than one vault-id is provided)]:vault id' ) ;| - (de|en)crypt*) args=( '--output=[specify output file name]:file:_files' ) ;| + (de|en)crypt*) args+=( '--output=[specify output file name]:file:_files' ) ;| encrypt_string) args+=( '(-p --prompt)'{-p,--prompt}'[prompt for the string to encrypt]' + "--show-input[don't hide input when prompted for the string to encrypt]" '(-n --name)'{-n+,--name=}'[specify the variable name]:variable' '--stdin-name=[specify the variable name for stdin]:variable' ) ;| create|edit|rekey|view) args+=( ':file:_files' ) ;| - (en|de)crypt) args+=( '::file:_files' ) - ;; + decrypt|rekey) + args+=( + '--new-vault-id=[specify new vault identity to use]:vault identity' + '--new-vault-password-file=[specify new vault password file]:vault password file:_files' + ) + ;| + (en|de)crypt) args+=( '::file:_files' ) ;; esac _arguments -s -S $args && ret=0 ;; diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant index 080ce6857..7401c7449 100644 --- a/Completion/Unix/Command/_ant +++ b/Completion/Unix/Command/_ant @@ -56,7 +56,7 @@ _arguments -C \ '-propertyfile[load all properties from specified file with -D properties taking precedence]:property file:_files -g "*.properties(-.)"' \ '-inputhandler[specify class which will handle input requests]:class:->class' \ '(-s -find -f -file -buildfile)'{-s,-find}'[search for specified build file towards the root of filesystem]:build file:(build.xml)' \ - '-nice[specify a niceness value for the main thread]:niceness value (default 5):({1..10})' \ + '-nice[specify a niceness value for the main thread]:niceness value [5]:({1..10})' \ '-nouserlib[run ant without using the jar files from ${user.home}/.ant/lib]' \ '-noclasspath[run ant without using CLASSPATH]' \ '-autoproxy[Java1.5+: use the OS proxy settings]' \ diff --git a/Completion/Unix/Command/_arp b/Completion/Unix/Command/_arp index 389f1099b..7727de28c 100644 --- a/Completion/Unix/Command/_arp +++ b/Completion/Unix/Command/_arp @@ -61,7 +61,7 @@ case $OSTYPE in openbsd*) args+=( '(-a -d -W)-F[overwrite existing entries]' - '(-W)-V+[select the routing domain]:routing domain' + '(-W)-V+[select the routing domain]:routing domain:_routing_domains' ) cmds+=( '(- 1)-W[send the wake on LAN frame]' diff --git a/Completion/Unix/Command/_attr b/Completion/Unix/Command/_attr index 121c0c539..efa7c5c4f 100644 --- a/Completion/Unix/Command/_attr +++ b/Completion/Unix/Command/_attr @@ -23,6 +23,7 @@ case $service in '(-e --encoding)'{-e+,--encoding=}'[encode values after retrieving them]:encoding:(text hex base64)' \ '(-h --no-dereference)'{-h,--no-dereference}"[don't follow symbolic links]" \ '(-m --match)'{-m+,--match=}'[only include attributes with names matching regex]:regular expression' \ + '--one-file-system[skip files on different filesystems]' \ "--absolute-names[don't strip leading slash characters]" \ '--only-values[dump only attribute values]' \ '(-R --recursive)'{-R,--recursive}'[list attributes of all files and directories recursively]' \ diff --git a/Completion/Unix/Command/_awk b/Completion/Unix/Command/_awk index dcb2a6c21..e8f4a2530 100644 --- a/Completion/Unix/Command/_awk +++ b/Completion/Unix/Command/_awk @@ -1,6 +1,6 @@ #compdef awk gawk nawk -# For gawk ver.3 and 4, in addition to POSIX. +# For gawk ver.3 to 5, in addition to POSIX. # # gawk's options '-W ...' (such as '-W help') are not supported. # gawk3 has some synonyms for long options (e.g., --compat is a synonym @@ -14,7 +14,7 @@ local variant curcontext="$curcontext" state state_descr line ret=1 local -A opt_args local -a args -_pick_variant -r variant gawk4='GNU Awk 4' gawk3='GNU Awk 3' posix --version +_pick_variant -r variant gawk4='GNU Awk [45]' gawk3='GNU Awk 3' posix --version args=( {-F+,--field-separator}'[define input field separator by extended regex]:extended regular expression:' diff --git a/Completion/Unix/Command/_baz b/Completion/Unix/Command/_baz index 6787f41e2..0acdc4639 100644 --- a/Completion/Unix/Command/_baz +++ b/Completion/Unix/Command/_baz @@ -38,8 +38,8 @@ _baz_revisions () { _arch_namespace baz 4 "$argv[@]" } (( $+functions[_baz_local_revisions] )) || _baz_local_revisions () { local expl1 expl2 tree_version=`$BAZ tree-version` - _description -V applied-patches expl1 "patches from this version" - _description -V other-patches expl2 "patches from other versions" + _description -V applied-patches expl1 "patch from this version" + _description -V other-patches expl2 "patch from other versions" compadd "$expl1[@]" `$BAZ logs` compadd "$expl2[@]" `$BAZ logs --full $($BAZ log-versions | grep -v $tree_version)` # This is incredibly slow. @@ -64,7 +64,7 @@ _baz_config () { if [[ -d "$root/configs" ]]; then configdir=("$root/configs") - _description files expl '%Bconfig file%b' + _description files expl 'config file' _files -W configdir "$expl[@]" && ret=0 else _message -e messages "No configs/ directory in tree whose root is $root" @@ -82,7 +82,7 @@ _baz_limit () { #presently only does push-mirror style limits if [[ $PREFIX != *--* ]]; then _description -V categories expl "categories in $archive" - compadd -q -S -- "$expl[@]" `$BAZ categories $archive` + compadd -q -S -- "$expl[@]" `$BAZ category $archive` else _baz_namespace_branches 3 fi @@ -98,7 +98,7 @@ _baz_tree_or_rev () { _baz_libraries () { local libraries expl libraries=($(_call_program baz $BAZ my-revision-library)) - _description -V libraries expl "revision libraries" + _description -V libraries expl "revision library" compadd "$expl[@]" -a libraries } @@ -115,7 +115,7 @@ _baz_my_revision_library () { _baz_log_versions () { local logs expl logs=($(_call_program baz $BAZ log-versions)) - _description -V versions expl "log versions" + _description -V versions expl "log version" compadd "$expl[@]" -a logs } @@ -238,12 +238,12 @@ methods=( cmd_tagging_method=($cmd_id_tagging_method) local cmd_add cmd_add_id cmd_add_tag -cmd_add=('*:files to add:_files') +cmd_add=('*:file to add:_files') cmd_add_id=($cmd_add) cmd_add_tag=($cmd_add) local cmd_delete cmd_delete_id cmd_delete_tag -cmd_delete=('*:files to delete:_files') +cmd_delete=('*:file to delete:_files') cmd_delete_id=($cmd_delete) cmd_delete_tag=($cmd_delete) @@ -272,7 +272,7 @@ cmd_changeset=( ':ORIG:_files -/' ':MOD:_files -/' ':DEST:_files -/' - '*:files:_files' + '*:file:_files' ) cmd_mkpatch=("$cmd_changeset[@]") @@ -288,7 +288,7 @@ local cmd_make_archive cmd_make_archive=('::name:' ':location:_files -/') local cmd_archive_setup -cmd_archive_setup=('*:versions:_baz_branches --trailing-dashes') +cmd_archive_setup=('*:version:_baz_branches --trailing-dashes') local cmd_make_category cmd_make_category=(':category:_baz_archives -S /') @@ -304,7 +304,7 @@ cmd_import=('::version:_baz_versions') cmd_imprev=($cmd_import) local cmd_commit cmd_cmtrev -cmd_commit=('*:files:_files') +cmd_commit=('*:file:_files') cmd_cmtrev=($cmd_commit) local cmd_get cmd_getrev @@ -573,7 +573,7 @@ _baz_main () { local -U cmds help=(${(f)"$($BAZ help)"}) cmds=(${${${${(M)help:#* :*}/ #: #/:}%% ##}## #}) - arguments=(':commands:(($cmds))') + arguments=(':command:(($cmds))') fi _arguments -S -A '-*' \ {"${hide_short}(: -)-V",'(: -)--version'}'[display version]' \ diff --git a/Completion/Unix/Command/_bittorrent b/Completion/Unix/Command/_bittorrent index 1f305a1c0..1fbab35ef 100644 --- a/Completion/Unix/Command/_bittorrent +++ b/Completion/Unix/Command/_bittorrent @@ -69,7 +69,7 @@ case $service in '--piece_size_pow2+[specify power of 2 to set the piece size to]:power:' \ "--comment+[specify human-readable comment to put in .torrent]:comment:"\ "--target+[specify target file for the torrent]:file:_files"\ - ':file:_files -g "*"' + ':file:_files' return ;; diff --git a/Completion/Unix/Command/_bpython b/Completion/Unix/Command/_bpython index 233e032e6..2c2ea11b8 100644 --- a/Completion/Unix/Command/_bpython +++ b/Completion/Unix/Command/_bpython @@ -41,6 +41,3 @@ case "$service" in "$gtk_opts[@]" ;; esac - - -# vim:autoindent expandtab shiftwidth=2 tabstop=2 softtabstop=2 filetype=zsh diff --git a/Completion/Unix/Command/_bzr b/Completion/Unix/Command/_bzr index 1b755b4ec..121c28166 100644 --- a/Completion/Unix/Command/_bzr +++ b/Completion/Unix/Command/_bzr @@ -65,7 +65,7 @@ case $cmd in '--no-recurse[do not recurse into subdirectories]' '(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]' '(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]' - '*:unknown files:_bzr_unknownFiles' + '*:unknown file:_bzr_unknownFiles' ) ;; @@ -74,7 +74,7 @@ case $cmd in '--all[show annotations on all lines]' '--long[show date in annotations]' '(-r --revision)'{--revision=,-r}'[the revision to show]:rev:' - '*:files:_bzr_versionedFiles' + '*:file:_bzr_versionedFiles' ) ;; @@ -100,7 +100,7 @@ case $cmd in (rename|move|mv) if (( CURRENT == 2 )); then - args+=( '*:files:_bzr_versionedFiles' ) + args+=( '*:file:_bzr_versionedFiles' ) else args=( '*:destination dir:_files -/' ) fi @@ -218,7 +218,7 @@ case $cmd in '--unchanged[include unchanged files]' '(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]' '(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]' - '*:modified files:_bzr_modifiedFiles' + '*:modified file:_bzr_modifiedFiles' ) ;; @@ -229,7 +229,7 @@ case $cmd in '--all[shelve all changes]' '(-q --quiet)'{--quiet,-q}'[be quiet]' '(-v --verbose)'{--verbose,-v}'[display more information]' - '*:modified files:_bzr_modifiedFiles' + '*:modified file:_bzr_modifiedFiles' ) ;; @@ -279,7 +279,7 @@ case $cmd in '(-r --revision)'{--revision=,-r}'[revision]:revision:' '--diff-options=[options to pass to gdiff]:diff options:' '(-p --prefix)'{--prefix,-p}'[set prefix added to old and new filenames]' - '*:files:_files' + '*:file:_files' ) ;; @@ -376,7 +376,7 @@ case $cmd in args+=( '--all[show annotations on all lines]' "--plain[don't highlight annotation lines]" - '*:files:_bzr_versionedFiles' + '*:file:_bzr_versionedFiles' ) ;; diff --git a/Completion/Unix/Command/_chmod b/Completion/Unix/Command/_chmod index 3f6db7e91..42e3fa63b 100644 --- a/Completion/Unix/Command/_chmod +++ b/Completion/Unix/Command/_chmod @@ -1,7 +1,10 @@ #compdef chmod gchmod zf_chmod local curcontext="$curcontext" state line expl ret=1 variant -local -a args privs aopts=( -A '-*' ) +local -a args privs aopts + +# usual -* pattern picks up valid non-options, e.g. -x which is like a-x +aopts=( -A '-[^gorstuwxX]*' ) args=( '*: :->files' '1: :_file_modes' ) diff --git a/Completion/Unix/Command/_cpio b/Completion/Unix/Command/_cpio index 699b1d8f2..20f8c712d 100644 --- a/Completion/Unix/Command/_cpio +++ b/Completion/Unix/Command/_cpio @@ -25,15 +25,15 @@ else '--message=:message at end of volume:' '--null' '--reset-access-time' '--verbose' '--dot' '--append' - '--block-size=:block size in 512 byte units:' + '--block-size=:block size (512 byte units)' '--dereference' - '--io-size=:block size in bytes' + '--io-size=:block size (bytes)' '--quiet' '--force-local' '--help' '--version') fi args+=( '-A[append files to archive]' '-B[block size 5120 bytes with special file]' - '-C[set block size per record]:block size in bytes:(8192)' + '-C[set block size per record]:block size (bytes)' '-F[set archive file to use]:archive file:->afile' '(-H)-c[read/write header in ASCII]' "(-c)-H[set format type for archive header]:$fmts" @@ -49,7 +49,7 @@ else '--preserve-modification-time' '--numeric' '--rename' '--list' '--swap-bytes' '--swap-halfwords' '--dot' '--unconditional' '--verbose' - '--block-size=:block size in 512 byte units:' + '--block-size=:block size (512 byte units)' '--swap-halfwords' '--io-size=:block size in bytes:' '--pattern-file=:file with list of patterns:_files' @@ -63,7 +63,7 @@ else '-b[reverse bytes in word]' '-B[block size 5120 bytes with special file]' '-d[create directories as needed]' - '-C[set block size per record]:block size in bytes:(8192)' + '-C[set block size per record]:block size (bytes)' '-E[read filenames from file]:file name for list of files:_files' '-f[only copy files not matching patterns]' '-F[set archive file to use]:archive file:->afile' diff --git a/Completion/Unix/Command/_csplit b/Completion/Unix/Command/_csplit new file mode 100644 index 000000000..5f72232bb --- /dev/null +++ b/Completion/Unix/Command/_csplit @@ -0,0 +1,51 @@ +#compdef csplit + +local curcontext=$curcontext cnt_info ret=1 +local -a state state_descr line specs optA +typeset -A opt_args + +# common specs +specs=( + '(hv -f --prefix)'{-f+,--prefix=}'[specify prefix for output file names]:prefix [xx]: ' + '(hv -n --digits -b --suffix-format)'{-n+,--digits=}'[specify number of digits in output file names]:number [2]: ' + '(hv -k --keep-files)'{-k,--keep-files}'[do not remove output files on errors]' + '(hv -s --quiet --silent)'{-s,--quiet,--silent}'[do not print counts of output file sizes]' + '(hv)1: :_files' + '(hv)*: :->patterns' +) + +if _pick_variant gnu=GNU unix --version; then + # GNU coreutils 8.32 + specs+=( + '(hv -b --suffix-format -n --digits)'{-b+,--suffix-format=}'[specify format for numbers in output file names]:format [%%02d]: ' + '(hv)--suppress-matched[suppress the lines matching the pattern]' + '(hv -z --elide-empty)'{-z,--elide-empty-files}'[remove empty output files]' + + hv + '(: * -)--help[display help and exit]' + '(: * -)--version[output version information and exit]' + ) + cnt_info="(integer or '*')" +else + # POSIX ({Free,Open}BSD, DragonFly, macOS) + specs=( ${specs:#(|*\))--*} ) # remove long options + optA=( -A '-?*' ) # a single '-' is a valid file name (stdin) +fi + +_arguments -C -s -S $optA : $specs && ret=0 + +case $state in + patterns) + if compset -P '(/?*/|%?*%)'; then + _message '[+|-]offset' && ret=0 + elif compset -P '[/%]'; then + _message 'regex' && ret=0 + elif compset -P '(|\\){'; then + _message "count $cnt_info" && ret=0 + elif compset -P '[0-9]*'; then + _message 'line number' && ret=0 + elif [[ ${words[CURRENT]} != -* ]] then + _message "line_number, '/regex/[offset]', '%%regex%%[offset]', or '{count}'" && ret=0 + fi +esac + +return ret diff --git a/Completion/Unix/Command/_ctags b/Completion/Unix/Command/_ctags new file mode 100644 index 000000000..e2b28011b --- /dev/null +++ b/Completion/Unix/Command/_ctags @@ -0,0 +1,244 @@ +#compdef ctags arduino-ctags ctags-exuberant ctags-universal + +local context state line expl +local -A opt_args +local -a arguments + +if [ -z "$_ctags_type" ]; then + local output=`ctags --version 2>&1` + if [[ "$output" = *Universal\ Ctags* ]]; then + _ctags_type="universal" + elif [[ "$output" = *Exuberant\ Ctags* ]]; then + _ctags_type="exuberant" + elif [[ "$output" = *usage:\ ctags* ]]; then + _ctags_type="bsd" + elif [[ "$output" = *Emacs* ]]; then + _ctags_type="etags" + else + _ctags_type="universal" + fi +fi + +if [ "$_ctags_type" = "etags" ]; then + _etags + return $? +fi + +_ctags_languages() { + _call_program languages $service --list-languages | sed -n 's/^\([A-Za-z][A-Za-z0-9#_+]*\).*/\1/p' +} + +if [[ "$PREFIX" = --alias-*=* ]]; then + _message pattern + return 1 +elif [[ "$PREFIX" = --extras-*=* ]]; then + _message flags + return 1 +elif [[ "$PREFIX" = --fields-*=* ]]; then + _message flags + return 1 +elif [[ "$PREFIX" = --input-encoding-*=* ]]; then + _message encoding + return 1 +elif [[ "$PREFIX" = --kinddef-*=* ]]; then + _message kind + return 1 +elif [[ "$PREFIX" = --kinds-*=* ]]; then + _message kind + return 1 +elif [[ "$PREFIX" = --map-*=* ]]; then + _message pattern + return 1 +elif [[ "$PREFIX" = --mline-regex-*=* ]]; then + _message pattern + return 1 +elif [[ "$PREFIX" = --param-*=* ]]; then + _message argument + return 1 +elif [[ "$PREFIX" = --regex-*=* ]]; then + _message pattern + return 1 +elif [[ "$PREFIX" = --roles-*.*=* ]] then + _message role + return 1 +elif [[ "$PREFIX" = --roles-*.* ]] then + _message kind + return 1 +fi + +if [ "$_ctags_type" = "universal" ]; then + arguments=( + "-a[append to tags file]" + "-B[use backward searching patterns (?...?)]" + "-D[give definition for macro]:macro definition:" + "-e[output tag file for use with emacs]" + {-f+,-o+}"[write tags to specified file]:output file:_files" + "-F[use forward searching patterns (/.../)]" + "-h[specify a list of file extensions to be treated as include files]:extensions" + "-I[specify a list of tokens to be specially handled]:identifier list" + "-L[read a list of input file names from the specified file]:input file:_files" + "-n[equivalent to --excmd=number]" + "-N[equivalent to --excmd=pattern]" + "(--recurse -R)--recurse=-[search files recursively]::bool:(yes no)" + "(--recurse -R)-R[search files recursively]" + "-u[equivalent to --sort=no]" + "-x[print a tabular cross reference file to stdout]" + "--alias--[add a pattern detecting a name, can be used as an alt name for lang]:language:->languageequals" + "--append=-[should tags be appended to existing tag file]:bool:(yes no)" + "--etags-include=-[include reference to file in emacs style tag file]:file:_files" + "--exclude=-[exclude files and directories matching pattern]:pattern" + "--exclude-exception=-[don't exclude files and directories matching pattern even if they match the pattern specified with --exclude]:pattern" + "--excmd=-[uses the specified type of ex command to locate tags]:ex command type:(number pattern mix combine)" + "--extras=-[include extra tag entries for selected information]:flags (fFgpqrs)" + "--extras--[include <lang> own extra tag entries for selected information]:language:->languageequals" + "--fields=-[include selected extension fields]:flags (aCeEfFikKlmnNpPrRsStxzZ)" + "--fields--[include selected <lang> own extension fields]:language:->languageequals" + "--filter=-[behave as a filter, reading file names from stdin and writing tags to stdout]:bool:(yes no)" + "--filter-terminator=-[specify string to print to stdout following the tags for each file parsed when --filter is enabled]:string" + "--format=-[force output of specified tag file format]:level" + "(--guess-language-eagerly -G)"{--guess-language-eagerly,-G}"[guess the language of input file more eagerly]" + {--help,-?}"[display help text]" + "--help-full[display help text with experimental features]" + "--if0=-[should code within #if 0 conditionals be parsed]:bool:(yes no)" + "--input-encoding=-[specify encoding of all input files]:encoding" + "--input-encoding--[specify encoding of the <lang> input files]:language:->languageequals" + "--kinddef--[define new kind for <lang>]:language:->languageequals" + "--kinds--[enable/disable tag kinds for <lang>]:language:->languageequals" + "--langdef=-[define a new language to be parsed with regular expressions]:name" + "--langmap=-[override default mapping of language to input file extension]:maps" + "--language-force=-[force all files to be interpreted using specified language]:language:->language" + "--languages=-[restrict files scanned to these comma-separated languages]:language:->languages" + "--license[print details of software license]" + "--line-directives=-[should #line directives be processed]:bool:(yes no)" + "--links=-[indicate whether symlinks should be followed]:bool:(yes no)" + "--list-aliases=-[list of alias patterns]:language:->language" + "--list-excludes[list of exclude patterns for files/dirs]" + "--list-extras=-[list of extra tag flags]:language:->language" + "--list-features[list of compiled features]" + "--list-fields=-[list of fields]:language:->language" + "--list-kinds=-[list of all tag kinds for lang]:language:->language" + "--list-kinds-full=-[list details of all tag kinds for lang]:language:->language" + "--list-languages[list of supported languages]" + "--list-map-extensions=-[list of language extensions in mapping]:language:->language" + "--list-map-patterns=-[list of language patterns in mapping]:language:->language" + "--list-maps=-[list of language mappings (both extensions and patterns)]:language:->language" + "--list-mline-regex-flags[list of flags which can be used in a multiline regex parser definition]" + "--list-params=-[list of language parameters. works with --machinable]:language:->language" + "--list-pseudo-tags[list of pseudo tags]" + "--list-regex-flags[list of flags which can be used in a regex parser definition]" + "--list-roles=-[list of all roles of tag kinds specified for langs]:language:->language" + "--list-subparsers=-[list of subparsers for the base lang]:language:->language" + "--machinable=-[use tab separated representation in --list-* output]:bool:(yes no)" + "--map--[set, add(+), or remove(-) the map for <lang>]:language:->languageequals" + "--maxdepth=-[specify maximum recursion depth]:depth" + "--mline-regex--[define multiline regex for locating tags in <lang>]:language:->languageequals" + "--options=-[specify file (or dir) from which command line options should be read]:file:_files" + "--options-maybe=-[same as --options but doesn't error]:file:_files" + "--optlib-dir=-[add or set dir to optlib search path]:dir:_files -/" + "--output-encoding=-[the encoding to write the tag file in]:encoding" + "--output-format=-[specify the output format]:format:(u-ctags e-ctags etags xref)" + "--param--[set <lang> specific parameter]:language:->languageequals" + "--pattern-length-limit=-[cutoff patterns of tag entries after N characters]:number" + "--print-language[don't make tags file but just print the guessed lang name for input file]" + "--pseudo-tags=-[enable/disable emitting pseudo tag named ptag. if *, enable emitting all pseudo tags]:ptag" + "--put-field-prefix[put UCTAGS as prefix for the name of fields newly introducted in universal ctags]" + "--quiet=-[don't print notice class messages]:bool:(yes no)" + "--regex--[define regex for locating tags in specific lang]:language:->languageequals" + "--roles--[enable/disable tag roles for kinds of <lang>]:language:->languagedot" + "--sort=-[should tags be sorted]:argument:(yes no foldcase)" + "--tag-relative=-[should paths be relative to location of tag file]:argument:(yes no always never)" + "--totals=-[print stats about input and tag files]:argument:(yes no extra)" + "(--verbose -V)--verbose=-[enable verbose messages describing actions]:bool:(yes no)" + "(--verbose -V)-V[enable verbose messages describing actions]" + "--version[print version]" + "--with-list-header=-[prepend the column descriptions in --list-* output]:bool:(yes no)" + "*:file:_files" + ) +elif [ "$_ctags_type" = "exuberant" ]; then + arguments=( + "-a[append to tags file]" + "-B[use backward searching patterns (?...?)]" + "-e[output tag file for use with emacs]" + {-f+,-o+}"[write tags to specified file]:output file:_files" + "-F[use forward searching patterns (/.../)]" + "-h[specify a list of file extensions to be treated as include files]:extensions" + "-I[specify a list of tokens to be specially handled]:identifier list" + "-L[read a list of input file names from the specified file]:input file:_files" + "-n[equivalent to --excmd=number]" + "-N[equivalent to --excmd=pattern]" + "(--recurse -R)--recurse=-[search files recursively]::bool:(yes no)" + "(--recurse -R)-R[search files recursively]" + "-u[equivalent to --sort=no]" + "-x[print a tabular cross reference file to stdout]" + "--append=-[should tags be appended to existing tag file]:bool:(yes no)" + "--etags-include=-[include reference to file in emacs style tag file]:file:_files" + "--exclude=-[exclude files and directories matching pattern]:pattern" + "--excmd=-[uses the specified type of ex command to locate tags]:ex command type:(number pattern mix)" + "--extra=-[include extra tag entries for selected information]:flags (fg)" + "--fields=-[include selected extension fields]:flags (afmikKlnsStz)" + "--file-scope=-[should tags scoped only for a single file be included in output]:bool:(yes no)" + "--filter=-[behave as a filter, reading file names from stdin and writing tags to stdout]:bool:(yes no)" + "--filter-terminator=-[specify string to print to stdout following the tags for each file parsed when --filter is enabled]:string" + "--format=-[force output of specified tag file format]:level" + "--help[display help text]" + "--if0=-[should code within #if 0 conditionals be parsed]:bool:(yes no)" + "--langdef=-[define a new language to be parsed with regular expressions]:name" + "--langmap=-[override default mapping of language to input file extension]:maps" + "--language-force=-[force all files to be interpreted using specified language]:language:->language" + "--languages=-[restrict files scanned to these comma-separated languages]:language:->languages" + "--license[print details of software license]" + "--line-directives=-[should #line directives be processed]:bool:(yes no)" + "--links=-[indicate whether symlinks should be followed]:bool:(yes no)" + "--list-kinds=-[list of all tag kinds for lang]:language:->language" + "--list-languages[list of supported languages]" + "--list-maps=-[list of language mappings (both extensions and patterns)]:language:->language" + "--options=-[specify file (or dir) from which command line options should be read]:file:_files" + "--regex--[define regex for locating tags in specific lang]:language:->language" + "--sort=-[should tags be sorted]:argument:(yes no foldcase)" + "--tag-relative=-[should paths be relative to location of tag file]:argument:(yes no)" + "--totals=-[print stats about input and tag files]:argument:(yes no)" + "(--verbose -V)--verbose=-[enable verbose messages describing actions]:bool:(yes no)" + "(--verbose -V)-V[enable verbose messages describing actions]" + "--version[print version]" + "*:file:_files" + ) + if [[ "$PREFIX" = -* ]]; then + local -a languages=(`_ctags_languages`) + local -a languages2 + for language in $languages; do + arguments+=("--$language-kinds=-:kinds") + done + fi +elif [ "$_ctags_type" = "bsd" ]; then + arguments=( + "-a[append to tags file]" + "-B[use backward searching patterns (?...?)]" + "-d[create tags for #defines that don't take arguments]" + "-F[use forward searching patterns (/.../)]" + "-f+[write tags to specified file]:output file:_files" + "-t[create tags for typedefs, structs, unions, and enums]" + "-u[update the specified files in the tags file]" + "-v[an index of the form expected by vgrind(1) is produced]" + "-w[suppress warning diagnostics]" + "-x[ctags produces a simple function index]" + "*:file:_files" + ) +fi + +_arguments -s $arguments + +if [ "$state" = "language" ]; then + local -a languages=(`_ctags_languages`) + _wanted languages expl language compadd -a languages +elif [ "$state" = "languageequals" ]; then + local -a languages=(`_ctags_languages`) + _wanted languages expl language compadd -S = -a languages +elif [ "$state" = "languagedot" ]; then + local -a languages=(`_ctags_languages`) + _wanted languages expl language compadd -S . -a languages +elif [ "$state" = "languages" ]; then + local -a languages=(`_ctags_languages`) + _values -s , languages $languages +fi + +return $(( compstate[nmatches] > 0 ? 0 : 1 )) diff --git a/Completion/Unix/Command/_curl b/Completion/Unix/Command/_curl index 72e2e5b53..ecccdd389 100644 --- a/Completion/Unix/Command/_curl +++ b/Completion/Unix/Command/_curl @@ -4,4 +4,4 @@ # definition is provided as a fallback, and should be installed later # in $fpath than the curl-provided definition of _curl. -_urls "$@" +_gnu_generic || _urls "$@" diff --git a/Completion/Unix/Command/_cvs b/Completion/Unix/Command/_cvs index cba3eb773..4dc5b6c60 100644 --- a/Completion/Unix/Command/_cvs +++ b/Completion/Unix/Command/_cvs @@ -371,10 +371,10 @@ _cvs_log() { '-R[print the name of RCS file in the repository]' \ '-N[don'\''t list tags]' \ '(-h)-t[header with descriptive text]' \ - '-d+[specify dates]:dates' \ + '-d+[specify dates]:date range' \ '-r-[specify revisions]:revisions' \ - '-s+[specify states]:states:(Exp Stab Rel dead)' \ - '-w-[specify logins]:logins' \ + '-s+[specify states]:state:_sequence compadd - Exp Stab Rel dead' \ + '-w-[specify logins]:login list' \ '*:file:_cvs_files' } @@ -388,10 +388,10 @@ _cvs_rlog() { '(-l)-R[recursive]' \ '-N[don'\''t list tags]' \ '(-h)-t[header with descriptive text]' \ - '-d+[specify dates]:dates' \ + '-d+[specify dates]:date range' \ '-r-[specify revisions]:revisions' \ - '-s+[specify states]:states:(Exp Stab Rel dead)' \ - '-w-[specify logins]:logins' \ + '-s+[specify states]:state:_sequence compadd - Exp Stab Rel dead' \ + '-w-[specify logins]:login list' \ '*:file:_cvs_modules' } diff --git a/Completion/Unix/Command/_date b/Completion/Unix/Command/_date index 68bd357fb..97c272830 100644 --- a/Completion/Unix/Command/_date +++ b/Completion/Unix/Command/_date @@ -61,9 +61,13 @@ else ;| freebsd*|dragonfly*|darwin*) args+=( + "*-v+[adjust and print (but don't set) date]:[+-]value[ymwdHMS]" + ) + ;| + freebsd<-12>.*|darwin*) + args+=( '-d+:daylight saving time value' '-t+:minutes west of GMT' - "*-v+[adjust and print (but don't set) date]:[+-]value[ymwdHMS]" ) ;| freebsd*|dragonfly*) diff --git a/Completion/Unix/Command/_dd b/Completion/Unix/Command/_dd index e5c5e63ce..10682bc8e 100644 --- a/Completion/Unix/Command/_dd +++ b/Completion/Unix/Command/_dd @@ -1,18 +1,19 @@ #compdef dd gdd -local -a vals conv flags +local -a vals conv flags units local variant +units=( w:word b:block k:1024 m g t ) _pick_variant -r variant gnu=GNU $OSTYPE --version vals=( - '(ibs obs)bs[block size]:block size (bytes)' - 'cbs[conversion buffer size]:buffer size (bytes)' + '(ibs obs)bs[block size]: :_numbers -u bytes "block size" $units' + 'cbs[conversion buffer size]: :_numbers -u bytes "buffer size" $units' 'conv[specify conversions to apply]: :_values -s , conversion $conv' 'count[number of input blocks to copy]:blocks' - '(bs)ibs[input block size]:block size (bytes)' + '(bs)ibs[input block size]: :_numbers -u bytes -d 512 "block size" $units' 'if[specify input file]:input file:_tilde_files' - '(bs)obs[output block size]:block size (bytes)' + '(bs)obs[output block size]: :_numbers -u bytes -d 512 "block size" $units' 'of[specify output file]:output file:_tilde_files' 'seek[output blocks initially skipped]:blocks' 'skip[input blocks initially skipped]:blocks' @@ -63,7 +64,7 @@ case $variant in freebsd*) vals+=( 'fillchar[specify padding character]:character' - 'speed[limit copying speed]:speed (bytes/second)' + 'speed[limit copying speed]: :_numbers -u bytes/second speed $units' ) conv+=( '(pareven parnone parodd parset)'{pareven,parnone,parodd,parset} @@ -75,6 +76,7 @@ case $variant in ) flags+=( fullblock noatime nocache count_bytes skip_bytes seek_bytes ) conv+=( excl nocreat fdatasync fsync ) + units=( c:1 w:2 b:512 kB:1000 K:1024 MB:1000^2 M:1024\^2 GB G TB T PB P EB E ZB Z YB Y ) ;; netbsd*) vals+=( diff --git a/Completion/Unix/Command/_dhclient b/Completion/Unix/Command/_dhclient index d5ca5b271..e22586b04 100644 --- a/Completion/Unix/Command/_dhclient +++ b/Completion/Unix/Command/_dhclient @@ -20,7 +20,6 @@ case $OSTYPE in openbsd*) args+=( '-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/_dict b/Completion/Unix/Command/_dict index 202fc5bab..928728e06 100644 --- a/Completion/Unix/Command/_dict +++ b/Completion/Unix/Command/_dict @@ -21,6 +21,8 @@ _arguments -C -S \ '(--key -k)'{--key=,-k+}'[specify key for authentication]:shared secret:' \ '(-)'{--version,-V}'[display program version]' \ '(-)'{--license,-L}'[display program license]' \ + '(-6)-4[force use of IPv4 addresses only]' \ + '(-4)-6[force use of IPv6 addresses only]' \ '(-)--help[display usage info]' \ '(--verbose -v)'{--verbose,-v}'[verbose output]' \ '(--raw -r)'{--raw,-r}'[be very verbose]' \ diff --git a/Completion/Unix/Command/_dig b/Completion/Unix/Command/_dig index d2ffb0a33..3081e2cfd 100644 --- a/Completion/Unix/Command/_dig +++ b/Completion/Unix/Command/_dig @@ -24,10 +24,12 @@ local -a alts args '*+'{no,}'ednsnegotiation[set EDNS version negotiation]' '*+ednsopt=[specify EDNS option]:code point' '*+noedns[clear EDNS options to be sent]' + '*+'{no,}'expandaaaa[expand AAAA records]' '*+'{no,}'expire[send an EDNS Expire option]' '*+'{no,}'header-only[send query without a question section]' '*+'{no,}'idnin[set processing of IDN domain names on input]' '*+'{no,}'idnout[set conversion of IDN puny code on output]' + '*+'{no,}'keepalive[request EDNS TCP keepalive]' '*+'{no,}'keepopen[keep TCP socket open between queries]' '*+'{no,}'mapped[allow mapped IPv4 over IPv6 to be used]' '*+'{no,}'recurse[set the RD (recursion desired) bit in the query]' @@ -40,12 +42,15 @@ local -a alts args '*+'{no,}'identify[print IP and port of responder]' '*+'{no,}'comments[print comment lines in output]' '*+'{no,}'stats[print statistics]' + '*+padding[set padding block size]:size [0]' '*+'{no,}'qr[print query as it was sent]' '*+'{no,}'question[print question section of a query]' + '*+'{no,}'raflag[set RA flag in the query]' '*+'{no,}'answer[print answer section of a reply]' '*+'{no,}'authority[print authority section of a reply]' '*+'{no,}'all[set all print/display flags]' '*+'{no,}'subnet[send EDNS client subnet option]:addr/prefix-length' + '*+'{no,}'tcflag[set TC flag in the query]' '*+timeout=[set query timeout]:timeout (seconds) [5]' '*+tries=[specify number of UDP query attempts]:tries' '*+retry=[specify number of UDP query retries]:retries' @@ -57,13 +62,12 @@ local -a alts args '*+'{no,}"fail[don't try next server on SERVFAIL]" '*+'{no,}'besteffort[try to parse even malformed messages]' '*+'{no,}'dnssec[request DNSSEC records]' - '*+'{no,}'sigchase[chase DNSSEC signature chains]' - '*+trusted-key=[specify file containing trusted keys]:file:_files' - '*+'{no,}'topdown[do DNSSEC validation in top down mode]' '*+'{no,}'nsid[include EDNS name server ID request in query]' '*+'{no,}'ttlid[display the TTL whening printing the record]' '*+'{no,}'ttlunits[display the TTL in human-readable units]' + '*+'{no,}'unexpected[print replies from unexpected sources]' '*+'{no,}'unknownformat[print RDATA in RFC 3597 "unknown" format]' + '*+'{no,}'yaml[present the results as YAML]' '*+'{no,}'zflag[set Z flag in query]' ) _arguments -s -C $args \ @@ -89,7 +93,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/_django b/Completion/Unix/Command/_django index 9eaa2284a..1d5cf7311 100644 --- a/Completion/Unix/Command/_django +++ b/Completion/Unix/Command/_django @@ -146,9 +146,9 @@ case $state in args+=( $locale $verbosity - {-d,--domain=}'[domain of the message files (default: "django")]:domain' + {-d,--domain=}'[domain of the message files]:domain [django]:(django djangojs)' {-a,--all}'[re-examine all code and templates]' - {-e,--extensions=}'[file extension(s) to examine (default: ".html")]:extension' + {-e,--extensions=}'[file extension(s) to examine]:extension [html]' ) ;; diff --git a/Completion/Unix/Command/_dmesg b/Completion/Unix/Command/_dmesg index 3dd059214..1aa3bc262 100644 --- a/Completion/Unix/Command/_dmesg +++ b/Completion/Unix/Command/_dmesg @@ -1,6 +1,6 @@ #compdef dmesg -local args +local -a args case $OSTYPE in linux*) args=( -S -- ) ;; @@ -27,6 +27,13 @@ case $OSTYPE in '-n[use specified kernel core]:number' ) ;; + netbsd*) + args+=( + '-d[show timestamp deltas]' + '(-t)-T[format uptime timestamps in a human readable form]' + '(-T)-t[suppress printing uptime timestamps]' + ) + ;; esac -_arguments -s $args +_arguments -s : $args diff --git a/Completion/Unix/Command/_doas b/Completion/Unix/Command/_doas index 94395557c..3ef036a88 100644 --- a/Completion/Unix/Command/_doas +++ b/Completion/Unix/Command/_doas @@ -1,7 +1,8 @@ #compdef doas -local environ e cmd +local environ e cmd cpp local -a _comp_priv_prefix +local -A opt_args zstyle -a ":completion:${curcontext}:" environ environ @@ -10,13 +11,13 @@ do local -x "$e" done cmd="$words[1]" +cpp='_comp_priv_prefix=( $cmd -n ${(kv)opt_args[(I)-u]} )' _arguments -s -S -A '-*' : \ - - optL \ - '-L[clear any persisted authorizations]' \ - - default \ - '-a+[specify authentication style]:authentication style' \ - '(-n -s)-C+[check config file and report on command matching]:config:_files' \ - '(-C)-n[non-interactive: fail rather than prompt for a password]' \ - '(-C *)-s[run a shell]' \ - '-u+[run command as specified user]:user:_users' \ - '*::arguments:{ _comp_priv_prefix=( $cmd -n ${(kv)opt_args[-u]} ) ; _normal }' + '(: * -)-L[clear any persisted authorizations]' \ + '(-L)-a+[specify authentication style]:authentication style' \ + '(-L -n -s)-C+[check config file and report on command matching]:config:_files' \ + '(-C -L)-n[non-interactive: fail rather than prompt for a password]' \ + '(-C -L *)-s[run a shell]' \ + '(-L)-u+[run command as specified user]: :_users' \ + "(-)1: :{ $cpp; _command_names -e }" \ + "*:: :{ $cpp; _normal }" diff --git a/Completion/Unix/Command/_dropbox b/Completion/Unix/Command/_dropbox new file mode 100644 index 000000000..45c77ae09 --- /dev/null +++ b/Completion/Unix/Command/_dropbox @@ -0,0 +1,66 @@ +#compdef dropbox + +if [[ CURRENT -eq 2 || $words[2] = help ]]; then + local -a line progs + + _call_program command dropbox help | + while read -A line; do + if [[ $line[1] = [a-z]## ]]; then + progs+=("${line[1]}:${line[2,-1]}") + fi + done + + _describe -t command 'Dropbox command' progs +else + local -a opts + + case $words[2] in + (exclude) + _path_files -g '*(/)' + ;; + + (filestatus) + shift words + (( CURRENT-- )) + _arguments -s : \ + '(-l --list)'{-l,--list}'[use format like ls]' \ + '(-a --all)'{-a,--all}'[do not ignore entries starting .]' \ + '*:File to list:_files' + ;; + + (ls|puburl|sharelink) + _files + ;; + + (autostart|lansync) + opts=("y:turn $words[2] on" "n:turn $words[2] off") + _describe "$words[2] behaviour" opts + ;; + + (proxy) + _arguments \ + '2:proxy mode:(none auto manual)' \ + '3:proxy type for manual mode:(http socks4 socks5)' \ + '4:proxy host for manual mode:_hosts' \ + '5:proxy port for manual mode:_ports' \ + '6:proxy user for manual mode:_users' \ + '7:proxy password for manual mode:' + ;; + + (start) + shift words + (( CURRENT-- )) + _arguments -s : '(-i --install)'{-i,--install}'[auto install dropboxd]' + ;; + + (throttle) + _arguments \ + '2:download limit (KB/s):(unlimited)' \ + '3:upload limit (KB/s):(unlimited)' + ;; + + (*) + _default + ;; + esac +fi diff --git a/Completion/Unix/Command/_dtruss b/Completion/Unix/Command/_dtruss index bd1ae8bc5..b56e713d2 100644 --- a/Completion/Unix/Command/_dtruss +++ b/Completion/Unix/Command/_dtruss @@ -2,7 +2,7 @@ _arguments -s : \ '-a[print all details]' \ - '-b+[specify dynamic variable buffer size]:buffer size (default 4m)' \ + '-b+[specify dynamic variable buffer size]:buffer size [4m]' \ '-c[print system call counts]' \ '-d[print relative timestamps]' \ '-e[print elapsed times]' \ diff --git a/Completion/Unix/Command/_ecasound b/Completion/Unix/Command/_ecasound index a39e426db..5fd9055a7 100644 --- a/Completion/Unix/Command/_ecasound +++ b/Completion/Unix/Command/_ecasound @@ -102,9 +102,9 @@ case $state in elif compset -P '*,*,'; then _message 'sampling rate' elif compset -P '*,'; then - _message 'channels' + _message 'channel' else - _values 'sampling parameters' \ + _values 'sampling parameter' \ 'u8[unsigned 8-bit]' \ 's16_le[signed 16-bit little endian]' \ 's16_be[signed 16-bit big endian]' \ diff --git a/Completion/Unix/Command/_entr b/Completion/Unix/Command/_entr index 3e2261a18..438ab179a 100644 --- a/Completion/Unix/Command/_entr +++ b/Completion/Unix/Command/_entr @@ -11,6 +11,7 @@ _arguments -s -S \ '-p[postpone first execution of the utility]' \ '(-a)-r[reload a persistent child process]' \ '(*)-s[evaluate the first argument using interpreter specified by $SHELL]' \ + '-z[exit after the utility completes]' \ '(-): :->command' \ '*::arguments:_normal' && ret=0 diff --git a/Completion/Unix/Command/_env b/Completion/Unix/Command/_env index 27978d936..a5dd49d37 100644 --- a/Completion/Unix/Command/_env +++ b/Completion/Unix/Command/_env @@ -1,6 +1,7 @@ #compdef env genv -local context state line variant args ign ret=1 +local context state line variant ign ret=1 +local -a args suf _pick_variant -r variant gnu=Free\ Soft $OSTYPE --version case $variant in @@ -20,8 +21,15 @@ case $variant in "${ign}(- *)--version[display version information]" ) ;; - freebsd*|darwin*) + freebsd*) args=( + '-0[use NUL, not newline after each variable in output]' + '-L[add variables from system login.conf(5)]: :->user-class' + '-U[add variables from user and system login.conf(5)]: :->user-class' + ) + ;| + freebsd*|darwin*|dragonfly*) + 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]:string to split' @@ -44,11 +52,23 @@ _arguments $args \ '*::arguments:->normal' && ret=0 if [[ -n $state ]]; then - while [[ $words[1] = *=* ]]; do - shift words - (( CURRENT-- )) - done - _normal && ret=0 + case $state in + normal) + while [[ $words[1] = *=* ]]; do + shift words + (( CURRENT-- )) + done + _normal && ret=0 + ;; + user-class) + if compset -P 1 '*/'; then + _login_classes && ret=0 + else + compset -S '/*' || suf=( -qS/ ) + _users $suf && ret=0 + fi + ;; + esac fi return ret diff --git a/Completion/Unix/Command/_fetchmail b/Completion/Unix/Command/_fetchmail index 31a92d984..bc5a39688 100644 --- a/Completion/Unix/Command/_fetchmail +++ b/Completion/Unix/Command/_fetchmail @@ -4,7 +4,7 @@ _arguments -S \ {--bsmtp,'(--logfile)-L','(-L)--logfile','(--fetchmailrc)-f','(-f)--fetchmailrc','(--idfile)-i','(-i)--idfile'}':file:_files' \ {--plugin,--plugout,'(--mda)-m','(-m)--mda'}':command:_command_names -e' \ {'(--username)-u','(-u)--username'}:user:_users \ - '--auth:authentication types:(password kerberos kerberos_v5)' \ + '--auth:authentication type:(password kerberos kerberos_v5)' \ {'(--protocol)-p','(-p)--protocol'}:protocol:'(auto pop2 pop3 apop rpop kpop sdps imap imap-k4 imap-gss etrn)' \ {'(--port)-P','(-P)--port'}':port number' \ '*:mail server:_hosts' \ diff --git a/Completion/Unix/Command/_ffmpeg b/Completion/Unix/Command/_ffmpeg index c0b229f35..1329939cd 100644 --- a/Completion/Unix/Command/_ffmpeg +++ b/Completion/Unix/Command/_ffmpeg @@ -6,7 +6,7 @@ typeset -A opt_args (( $+functions[_ffmpeg_presets] )) || _ffmpeg_presets() { local presets presets=(~/.ffmpeg/*.ffpreset(:t:r) "$FFMPEG_DATADIR"/*.ffpreset(:t:r)) - _wanted ffmpeg-presets expl 'select preset' compadd -a presets + _wanted ffmpeg-presets expl 'preset' compadd -a presets } (( $+functions[_ffmpeg_acodecs] )) || _ffmpeg_acodecs() { @@ -49,7 +49,7 @@ typeset -A _ffmpeg_flags (( $+functions[_ffmpeg_flag_options] )) || _ffmpeg_flag_options() { local expl - _wanted options expl 'select flags' compadd -S '' -- {-,+}${^flag_options} + _wanted options expl 'flag' compadd -S '' -- {-,+}${^flag_options} } (( $+functions[_ffmpeg_more_flag_options] )) || _ffmpeg_more_flag_options() { @@ -177,7 +177,7 @@ _arguments -C -S \ && return [[ "$state" == "vfilters" ]] && - _values -s , -S = 'video filters' \ + _values -s , -S = 'video filter' \ 'aspect:set aspect ratio (rational number X\:Y or decimal number):' \ 'crop:crop input video (x\:y\:width\:height):' \ 'format: :_sequence -s : _ffmpeg_pix_fmts' \ diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find index 916fcf2e6..74111f92b 100644 --- a/Completion/Unix/Command/_find +++ b/Completion/Unix/Command/_find @@ -89,7 +89,7 @@ case $variant in '-X[warn if filename contains characters special to xargs]' '-f[specify file hierarchy to traverse]:path:_directories' "-x[don't span filesystems]" - '*-flags:flags:_chflags' + '*-flags:flag:_chflags' ) ;| freebsd*|dragonfly*) args+=( '*-sparse' ) ;| @@ -156,11 +156,11 @@ if [[ $state = times ]]; then if zstyle -t ":completion:${curcontext}:senses" verbose; then zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=-- default=" [default exactly]" - disp=( "- $sep before" "+ $sep since" ) + disp=( "+ $sep before (older files)" "- $sep since (newer files)" ) smatch=( - + ) else disp=( before exactly since ) - smatch=( - '' + ) + smatch=( + '' - ) fi alts=( "senses:sense${default}:compadd -V times -S '' -d disp -a smatch" ) fi diff --git a/Completion/Unix/Command/_fuser b/Completion/Unix/Command/_fuser index f497729fc..05de1c529 100644 --- a/Completion/Unix/Command/_fuser +++ b/Completion/Unix/Command/_fuser @@ -50,7 +50,7 @@ case $variant in ) argf=( '*:name: _alternative "files:file:_files" "services:service:_fuser_services"' ) [[ -prefix - && -z ${${words[1,CURRENT-1]}[(r)-[A-Z][A-Z]*]} ]] && - argf[1]+=' "signal:signals:_signals -P-"' + argf[1]+=' "signals:signal:_signals -P-"' ;; freebsd*|openbsd*|solaris2.<9->) args+=( diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc index 9ec09200e..ac0e8fda3 100644 --- a/Completion/Unix/Command/_gcc +++ b/Completion/Unix/Command/_gcc @@ -1,6 +1,7 @@ #compdef gcc g++ cc c++ llvm-gcc llvm-g++ clang clang++ -value-,LDFLAGS,-default- -value-,CFLAGS,-default- -value-,CXXFLAGS,-default- -value-,CPPFLAGS,-default- -P gcc-* -P g++-* -P c++-* -local curcontext="$curcontext" state line ret=1 expl args args2 march +local curcontext="$curcontext" state line ret=1 expl i +local -a args args2 warnings arch typeset -A opt_args if [[ "$service" = -value-* ]]; then @@ -23,6 +24,7 @@ fi args=() case $MACHTYPE in + m68*) args=( -m68000 -m68020 -m68020-40 -m68030 -m68040 -m68881 @@ -56,6 +58,16 @@ amd290?0) arm) args=( -mapcs -m2 -m3 -m6 -mbsd -mxopen -mno-symrename + '-faapcs-bitfield-load[all volatile bit-field write generates at least one load]' + '-faapcs-bitfield-width[volatile bit-field width is dictated by the field container type]' + '-mcmse[allow use of CMSE]' + '-mexecute-only[disallow generation of data access to code sections]' + '-mno-movt[disallow use of movt/movw pairs]' + '-mno-neg-immediates[disallow converting instructions with negative immediates to their negation]' + '-mnocrc[disallow use of CRC instructions]' + '-mrestrict-it[disallow generation of deprecated IT blocks for ARMv8]' + '-mtp=[thread pointer access method]:arg' + '-munaligned-access[allow memory accesses to be unaligned]' ) ;; m88k) @@ -74,8 +86,8 @@ m88k) ) ;; rs6000|powerpc*) + arch=(rios1 rios2 rsc 501 603 604 power powerpc 403 common) args=( - '-mcpu=:CPU type:(rios1 rios2 rsc 501 603 604 power powerpc 403 common)' -mpower -mno-power -mpower2 -mno-power2 -mpowerpc -mno-powerpc -mpowerpc-gpopt -mno-powerpc-gpopt @@ -88,6 +100,32 @@ rs6000|powerpc*) -mtoc -mno-toc -mtraceback -mno-traceback -mlittle -mlittle-endian -mbig -mbig-endian -mcall-aix -mcall-sysv -mprototype + '-mcpu=:CPU type:->arch' + '-maltivec[altivec]' + '-mcmpb[cmpb]' + '-mcrbits[crbits]' + '-mcrypto[crypto]' + '-mdirect-move[direct move]' + '-mefpu2[efpu2]' + '-mfloat128[float128]' + '-mfprnd[fprnd]' + '-mhtm[htm]' + '-minvariant-function-descriptors[invariant function descriptors]' + '-misel[isel]' + '-mlongcall[longcall]' + '-mmfocrf[mfocrf]' + '-mmfcrf[mfcrf]' + '-mmma[mma]' + '-mpaired-vector-memops[paired vector memops]' + '-mpcrel[pcrel]' + '-mpopcntd[popcntd]' + '-mpower10-vector[power10 vector]' + '-mpower8-vector[power8 vector]' + '-mpower9-vector[power9 vector]' + '-mrop-protection[rop protection]' + '-msecure-plt[secure plt]' + '-mspe[spe]' + '-mvsx[vsx]' ) ;; romp) @@ -98,179 +136,233 @@ romp) ) ;; mips*) + arch=(r2000 r3000 r4000 r4400 r4600 r6000) args=( - '-mcpu=:CPU type:(r2000 r3000 r4000 r4400 r4600 r6000)' - -mabicalls -membedded-data - -membedded-pic -mfp32 -mfp64 -mgas -mgp32 -mgp64 - -mgpopt -mhalf-pic -mhard-float -mint64 -mips1 - -mips2 -mips3 -mlong64 -mlong-calls -mmemcpy - -mmips-as -mmips-tfile -mno-abicalls - -mno-embedded-data -mno-embedded-pic - -mno-gpopt -mno-long-calls - -mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats - -mrnames -msoft-float - -m4650 -msingle-float -mmad - -mstats -EL -EB -nocpp - '-G:maximum size for small section objects:' + -membedded-pic -mgas -mgp32 -mgp64 -mhalf-pic -mhard-float -mint64 -mips1 + -mips2 -mips3 -mlong64 -mmemcpy -mmips-as -mmips-tfile -mno-abicalls + -mno-embedded-data -mno-embedded-pic -mno-gpopt -mno-long-calls -mno-memcpy + -mno-mips-tfile -mno-rnames -mno-stats -mrnames -msoft-float -m4650 -mmad + -mstats -nocpp + '-mcpu=:CPU type:->arch' + '-mabicalls[enable SVR4-style position-independent code]' + '-mabs=[abs]:arg' + '-mcheck-zero-division[check zero division]' + '-mcompact-branches=[compact branches]:arg' + '-mdouble-float[double float]' + '-mdsp[dsp]' + '-mdspr2[dspr2]' + '-membedded-data[place constants in the .rodata section instead of the .sdata section]' + '-mextern-sdata[assume that externally defined data is in the small data]' + '-mfp32[use 32-bit floating point registers]' + '-mfp64[use 64-bit floating point registers]' + '-mginv[ginv]' + '-mgpopt[use GP relative accesses for symbols known to be in a small data section]' + '-mindirect-jump=[change indirect jump instructions to inhibit speculation]:arg' + '-mips16[ips16]' + '-mldc1-sdc1[ldc1 sdc1]' + '-mlocal-sdata[extend the -G behaviour to object local data]' + '-mmadd4[enable the generation of 4-operand madd.s, madd.d, etc]' + '-mmicromips[micromips]' + '-mmsa[enable MSA ASE]' + '-mmt[enable MT ASE]' + '-mnan=[nan]:arg' + '-mno-mips16[no mips16]' + '-msingle-float[single float]' + '-mvirt[virt]' + '-mxgot[xgot]' ) ;; i[3456]86|x86_64) - march="native i386 i486 i586 pentium pentium-mmx pentiumpro i686 pentium2 pentium3 pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx core-avx-i core-avx2 atom k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3 c3-2 geode" + arch=( + native i386 i486 i586 pentium pentium-mmx pentiumpro i686 pentium2 pentium3 + pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx + core-avx-i core-avx2 atom k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp + athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 + amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3 + c3-2 geode + ) args=( - '-mtune=-[tune code for CPU type]:CPU type:('"$march"')' - #'-mtune-ctrl=-[Fine grain control of tune features]:feature-list:' #for dev use only - '-march=-[generate instructions for CPU type]:CPU type:('"generic $march"')' - -mthreads - '-mreg-alloc=:default register allocation order:' - - # arguments with options - '-mabi=-[Generate code that conforms to the given ABI]:abi:(ms sysv)' - '-maddress-mode=-[Use given address mode]:address mode:(short long)' - '-malign-data=-[Use the given data alignment]:type:(compat abi cacheline)' - '-malign-functions=-[Function starts are aligned to this power of 2]: **2 base for function alignment: ' - '-malign-jumps=-[Jump targets are aligned to this power of 2]: **2 base for jump goal alignment: ' - '-malign-loops=-[Loop code aligned to this power of 2]: **2 base for loop alignment: ' - '-masm=-[Use given assembler dialect]:asm dialect:(att intel)' - '-mbranch-cost=-[Branches are this expensive (1-5, arbitrary units)]:branch cost (1-5): ' - '-mcmodel=-[Use given x86-64 code model]:memory model:(32 small kernel medium large)' - '-mfpmath=-[Generate floating point mathematics using given instruction set]:FPU type:(387 sse sse,387 both)' - '-mfunction-return=-[Convert function return to call and return thunk]:choice:(keep thunk thunk-inline thunk-extern)' - '-mincoming-stack-boundary=-[Assume incoming stack aligned to this power of 2]:assumed size of boundary: ' - '-mindirect-branch=-[Convert indirect call and jump to call and return thunks]:choice:(keep thunk thunk-inline thunk-extern)' - '-mlarge-data-threshold=-[Data greater than given threshold will go into .ldata section in x86-64 medium model]:threshold: ' - '-mmem'{set,cpy}'-strategy=-[Specify memcpy expansion strategy when expected size is known]:strategy:' - '-mpreferred-stack-boundary=-[Attempt to keep stack aligned to this power of 2]:size of boundary: ' - '-mrecip=-[Control generation of reciprocal estimates]::instruction:(all none div divf divd rsqrt rsqrtf rsqrtd)' #TODO comma separated and can have ! - '-mregparm=-[Number of registers used to pass integer arguments]:number of integer argument registers: ' - '-mstack-protector-guard=-[Use given stack-protector guard]:guard:(global tls)' - '-mstringop-strategy=-[Chose strategy to generate stringop using]:stringop strategy:(byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop)' - '-mtls-dialect=-[Use given thread-local storage dialect]:TLS dialect:(gnu gnu2)' - '-mveclibabi=-[Vector library ABI to use]:vector library ABI:(acml svml)' - - # arguments without options - '-m3dnow[Support 3DNow! built-in functions]' - '-m3dnowa[Support Athlon 3Dnow! built-in functions]' - '-m8bit-idiv[Expand 32bit/64bit integer divide into 8bit unsigned integer divide with run-time check]' - '-m16[Generate 16bit i386 code]' - '-m32[Generate 32bit i386 code]' - '-m64[Generate 64bit x86-64 code]' - '-m96bit-long-double[sizeof(long double) is 12]' '-m128bit-long-double[sizeof(long double) is 16]' - '-m80387[Use hardware fp]' - '-mabm[Support code generation of Advanced Bit Manipulation (ABM) instructions]' - '-maccumulate-outgoing-args[Reserve space for outgoing arguments in the function prologue]' - '-madx[Support flag-preserving add-carry instructions]' - '-maes[Support AES built-in functions and code generation]' - '-malign-double[Align some doubles on dword boundary]' - '-malign-stringops[Align destination of the string operations]' - '-mandroid[Generate code for the Android platform]' - '-mavx2[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 built-in functions and code generation]' - '-mavx256-split-unaligned-load[Split 32-byte AVX unaligned load]' - '-mavx256-split-unaligned-store[Split 32-byte AVX unaligned store]' - '-mavx512bw[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512BW built- in functions and code generation]' - '-mavx512cd[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512CD built- in functions and code generation]' - '-mavx512dq[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512DQ built- in functions and code generation]' - '-mavx512er[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512ER built- in functions and code generation]' - '-mavx512f[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F built-in functions and code generation]' - '-mavx512ifma[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512IFMA built-in functions and code generation]' - '-mavx512pf[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512PF built- in functions and code generation]' - '-mavx512vbmi[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VBMI built-in functions and code generation]' - '-mavx512vl[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VL built- in functions and code generation]' - '-mavx512vpopcntdq[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX512VPOPCNTDQ built-in functions and code generation]' - '-mavx5124fmaps[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124FMAPS built- in functions and code generation]' - '-mavx5124vnniw[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124VNNIW built- in functions and code generation]' - '-mavx[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and AVX built-in functions and code generation]' - '-mbionic[Use Bionic C library]' - '-mbmi2[Support BMI2 built-in functions and code generation]' - '-mbmi[Support BMI built-in functions and code generation]' - '-mcld[Generate cld instruction in the function prologue]' - '-mclflushopt[Support CLFLUSHOPT instructions]' - '-mclwb[Support CLWB instruction]' - '-mclzero[Support CLZERO built-in functions and code generation]' - '-mcrc32[Support code generation of crc32 instruction]' - '-mcx16[Support code generation of cmpxchg16b instruction]' - '-mdispatch-scheduler[Do dispatch scheduling if processor is bdver1, bdver2, bdver3, bdver4 or znver1 and Haifa scheduling is selected]' - '-mf16c[Support F16C built-in functions and code generation]' - '-mfancy-math-387[Generate sin, cos, sqrt for FPU]' - '-mfentry[Emit profiling counter call at function entry before prologue]' - '-mfma4[Support FMA4 built-in functions and code generation]' - '-mfma[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and FMA built-in functions and code generation]' - '-mforce-drap[Always use Dynamic Realigned Argument Pointer (DRAP) to realign stack]' - '-mfp-ret-in-387[Return values of functions in FPU registers]' - '-mfsgsbase[Support FSGSBASE built-in functions and code generation]' - '-mfxsr[Support FXSAVE and FXRSTOR instructions]' - '-mgeneral-regs-only[Generate code which uses only the general registers]' - '-mglibc[Use GNU C library]' - '-mhard-float[Use hardware fp]' - '-mhle[Support Hardware Lock Elision prefixes]' - '-miamcu[Generate code that conforms to Intel MCU psABI]' - '-mieee-fp[Use IEEE math for fp comparisons]' - '-mindirect-branch-register[Force indirect call and jump via register]' - '-minline-all-stringops[Inline all known string operations]' - '-minline-stringops-dynamically[Inline memset/memcpy string operations, but perform inline version only for small blocks]' - '-mlong-double-64[Use 64-bit long double]' - '-mlong-double-80[Use 80-bit long double]' - '-mlong-double-128[Use 128-bit long double]' - '-mlwp[Support LWP built-in functions and code generation]' - '-mlzcnt[Support LZCNT built-in function and code generation]' - '-mmitigate-rop[Attempt to avoid generating instruction sequences containing ret bytes]' - '-mmmx[Support MMX built-in functions]' - '-mmovbe[Support code generation of movbe instruction]' - '-mmpx[Support MPX code generation]' - '-mms-bitfields[Use native (MS) bitfield layout]' - '-mmusl[Use musl C library]' - '-mmwaitx[Support MWAITX and MONITORX built-in functions and code generation]' - '-mno-default[Clear all tune features]' - '-mno-sse4[Do not support SSE4.1 and SSE4.2 built-in functions and code generation]' - '-mnop-mcount[Generate mcount/__fentry__ calls as nops. To activate they need to be patched in]' - '-momit-leaf-frame-pointer[Omit the frame pointer in leaf functions]' - '-mpc32[Set 80387 floating-point precision to 32-bit]' - '-mpc64[Set 80387 floating-point precision to 64-bit]' - '-mpc80[Set 80387 floating-point precision to 80-bit]' - '-mpclmul[Support PCLMUL built-in functions and code generation]' - '-mpku[Support PKU built-in functions and code generation]' - '-mpopcnt[Support code generation of popcnt instruction]' - '-mprefer-avx128[Use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer]' - '-mprefetchwt1[Support PREFETCHWT1 built-in functions and code generation]' - '-mprfchw[Support PREFETCHW instruction]' - '-mpush-args[Use push instructions to save outgoing arguments]' - '-mrdpid[Support RDPID built-in functions and code generation]' - '-mrdrnd[Support RDRND built-in functions and code generation]' - '-mrdseed[Support RDSEED instruction]' - '-mrecip[Generate reciprocals instead of divss and sqrtss]' - '-mrecord-mcount[Generate __mcount_loc section with all mcount or __fentry__ calls]' - '-mred-zone[Use red-zone in the x86-64 code]' - '-mrtd[Alternate calling convention]' - '-mrtm[Support RTM built-in functions and code generation]' - '-msahf[Support code generation of sahf instruction in 64bit x86-64 code]' - '-msgx[Support SGX built-in functions and code generation]' - '-msha[Support SHA1 and SHA256 built-in functions and code generation]' - '-mskip-rax-setup[Skip setting up RAX register when passing variable arguments]' - '-msoft-float[Do not use hardware fp]' - '-msse2[Support MMX, SSE and SSE2 built-in functions and code generation]' - '-msse2avx[Encode SSE instructions with VEX prefix]' - '-msse3[Support MMX, SSE, SSE2 and SSE3 built-in functions and code generation]' - '-msse4.1[Support MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 built-in functions and code generation]' - '-msse4.2[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]' - '-msse4[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]' - '-msse4a[Support MMX, SSE, SSE2, SSE3 and SSE4A built-in functions and code generation]' - '-msse[Support MMX and SSE built-in functions and code generation]' - '-msseregparm[Use SSE register passing conventions for SF and DF mode]' - '-mssse3[Support MMX, SSE, SSE2, SSE3 and SSSE3 built-in functions and code generation]' - '-mstack-arg-probe[Enable stack probing]' - '-mstackrealign[Realign stack in prologue]' - '-mstv[Disable Scalar to Vector optimization pass transforming 64-bit integer computations into a vector ones]' - '-mtbm[Support TBM built-in functions and code generation]' - '-mtls-direct-seg-refs[Use direct references against %gs when accessing tls data]' - '-muclibc[Use uClibc C library]' - '-mvect8-ret-in-mem[Return 8-byte vectors in memory]' - '-mvzeroupper[Generate vzeroupper instruction before a transfer of control flow out of the function]' - '-mx32[Generate 32bit x86-64 code]' - '-mxop[Support XOP built-in functions and code generation]' - '-mxsave[Support XSAVE and XRSTOR instructions]' - '-mxsavec[Support XSAVEC instructions]' - '-mxsaveopt[Support XSAVEOPT instruction]' - '-mxsaves[Support XSAVES and XRSTORS instructions]' + '-m16[generate 16bit i386 code]' + '-m32[generate 32bit i386 code]' + '-m3dnowa[support Athlon 3Dnow! built-in functions]' + '-m3dnow[support 3DNow! built-in functions]' + '-m64[generate 64bit x86-64 code]' + '-m80387[use hardware fp]' + '-m8bit-idiv[expand 32bit/64bit integer divide into 8bit unsigned integer divide with run-time check]' + '-m96bit-long-double[sizeof(long double) is 12]' + '-mabi=-[generate code that conforms to the given ABI]:abi:(ms sysv)' + '-mabm[support code generation of Advanced Bit Manipulation (ABM) instructions]' + '-maccumulate-outgoing-args[reserve space for outgoing arguments in the function prologue]' + '-maddress-mode=-[use given address mode]:address mode:(short long)' + '-madx[support flag-preserving add-carry instructions]' + '-maes[support AES built-in functions and code generation]' + '-malign-data=-[use the given data alignment]:type:(compat abi cacheline)' + '-malign-double[align some doubles on dword boundary]' + '-malign-functions=-[function starts are aligned to this power of 2]: **2 base for function alignment: ' + '-malign-jumps=-[jump targets are aligned to this power of 2]: **2 base for jump goal alignment: ' + '-malign-loops=-[loop code aligned to this power of 2]: **2 base for loop alignment: ' + '-malign-stringops[align destination of the string operations]' + '-mamx-bf16[amx bf16]' + '-mamx-int8[amx int8]' + '-mamx-tile[amx tile]' + '-mandroid[generate code for the Android platform]' + '-march=-[generate instructions for CPU type]:CPU type:->archgeneric' + '-masm=-[use given assembler dialect]:asm dialect:(att intel)' + '-mavx256-split-unaligned-load[split 32-byte AVX unaligned load]' + '-mavx256-split-unaligned-store[split 32-byte AVX unaligned store]' + '-mavx2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 built-in functions and code generation]' + '-mavx5124fmaps[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124FMAPS built- in functions and code generation]' + '-mavx5124vnniw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124VNNIW built- in functions and code generation]' + '-mavx512bf16[avx512bf16]' + '-mavx512bitalg[avx512bitalg]' + '-mavx512bw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512BW built- in functions and code generation]' + '-mavx512cd[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512CD built- in functions and code generation]' + '-mavx512dq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512DQ built- in functions and code generation]' + '-mavx512er[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512ER built- in functions and code generation]' + '-mavx512f[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F built-in functions and code generation]' + '-mavx512ifma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512IFMA built-in functions and code generation]' + '-mavx512pf[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512PF built- in functions and code generation]' + '-mavx512vbmi2[avx512vbmi2]' + '-mavx512vbmi[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VBMI built-in functions and code generation]' + '-mavx512vl[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VL built- in functions and code generation]' + '-mavx512vnni[avx512vnni]' + '-mavx512vp2intersect[avx512vp2intersect]' + '-mavx512vpopcntdq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX512VPOPCNTDQ built-in functions and code generation]' + '-mavx[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and AVX built-in functions and code generation]' + '-mavxvnni[avxvnni]' + '-mbionic[use Bionic C library]' + '-mbmi2[support BMI2 built-in functions and code generation]' + '-mbmi[support BMI built-in functions and code generation]' + '-mbranch-cost=-[branches are this expensive (1-5, arbitrary units)]:branch cost (1-5): ' + '-mcldemote[cldemote]' + '-mcld[generate cld instruction in the function prologue]' + '-mclflushopt[support CLFLUSHOPT instructions]' + '-mclwb[support CLWB instruction]' + '-mclzero[support CLZERO built-in functions and code generation]' + '-mcmodel=-[use given x86-64 code model]:memory model:(32 small kernel medium large)' + '-mcpu=-[set CPU type]:CPU type:->arch' + '-mcrc32[support code generation of crc32 instruction]' + '-mcx16[support code generation of cmpxchg16b instruction]' + '-mdispatch-scheduler[do dispatch scheduling if processor is bdver1, bdver2, bdver3, bdver4 or znver1 and Haifa scheduling is selected]' + '-menqcmd[enqcmd]' + '-mf16c[support F16C built-in functions and code generation]' + '-mfancy-math-387[generate sin, cos, sqrt for FPU]' + '-mfentry[emit profiling counter call at function entry before prologue]' + '-mfma4[support FMA4 built-in functions and code generation]' + '-mfma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and FMA built-in functions and code generation]' + '-mforce-drap[always use Dynamic Realigned Argument Pointer (DRAP) to realign stack]' + '-mfpmath=-[generate floating point mathematics using given instruction set]:FPU type:(387 sse sse,387 both)' + '-mfp-ret-in-387[return values of functions in FPU registers]' + '-mfsgsbase[support FSGSBASE built-in functions and code generation]' + '-mfunction-return=-[convert function return to call and return thunk]:choice:(keep thunk thunk-inline thunk-extern)' + '-mfxsr[support FXSAVE and FXRSTOR instructions]' + '-mgeneral-regs-only[generate code which uses only the general registers]' + '-mgfni[gfni]' + '-mglibc[use GNU C library]' + '-mhard-float[use hardware fp]' + '-mhle[support Hardware Lock Elision prefixes]' + '-mhreset[hreset]' + '-miamcu[generate code that conforms to Intel MCU psABI]' + '-mieee-fp[use IEEE math for fp comparisons]' + '-mincoming-stack-boundary=-[assume incoming stack aligned to this power of 2]:assumed size of boundary: ' + '-mindirect-branch=-[convert indirect call and jump to call and return thunks]:choice:(keep thunk thunk-inline thunk-extern)' + '-mindirect-branch-register[force indirect call and jump via register]' + '-minline-all-stringops[inline all known string operations]' + '-minline-stringops-dynamically[inline memset/memcpy string operations, but perform inline version only for small blocks]' + '-minvpcid[invpcid]' + '-mkl[kl]' + '-mlarge-data-threshold=-[data greater than given threshold will go into .ldata section in x86-64 medium model]:threshold: ' + '-mlong-double-128[use 128-bit long double]' + '-mlong-double-64[use 64-bit long double]' + '-mlong-double-80[use 80-bit long double]' + '-mlwp[support LWP built-in functions and code generation]' + '-mlzcnt[support LZCNT built-in function and code generation]' + {'-mmemset-strategy=-','-mmemcpy-strategy=-'}'[specify memcpy expansion strategy when expected size is known]:strategy:' + '-mmitigate-rop[attempt to avoid generating instruction sequences containing ret bytes]' + '-mmmx[support MMX built-in functions]' + '-mmovbe[support code generation of movbe instruction]' + '-mmovdir64b[movdir64b]' + '-mmovdiri[movdiri]' + '-mmpx[support MPX code generation]' + '-mms-bitfields[use native (MS) bitfield layout]' + '-mmusl[use musl C library]' + '-mmwaitx[support MWAITX and MONITORX built-in functions and code generation]' + '-mno-default[clear all tune features]' + '-mnop-mcount[generate mcount/__fentry__ calls as nops. To activate they need to be patched in]' + '-mno-sse4[do not support SSE4.1 and SSE4.2 built-in functions and code generation]' + '-momit-leaf-frame-pointer[omit the frame pointer in leaf functions]' + '-mpc32[set 80387 floating-point precision to 32-bit]' + '-mpc64[set 80387 floating-point precision to 64-bit]' + '-mpc80[set 80387 floating-point precision to 80-bit]' + '-mpclmul[support PCLMUL built-in functions and code generation]' + '-mpconfig[pconfig]' + '-mpku[support PKU built-in functions and code generation]' + '-mpopcnt[support code generation of popcnt instruction]' + '-mprefer-avx128[use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer]' + '-mpreferred-stack-boundary=-[attempt to keep stack aligned to this power of 2]:size of boundary: ' + '-mprefetchwt1[support PREFETCHWT1 built-in functions and code generation]' + '-mprfchw[support PREFETCHW instruction]' + '-mptwrite[ptwrite]' + '-mpush-args[use push instructions to save outgoing arguments]' + '-mrdpid[support RDPID built-in functions and code generation]' + '-mrdrnd[support RDRND built-in functions and code generation]' + '-mrdseed[support RDSEED instruction]' + '-mrecip=-[control generation of reciprocal estimates]::instruction:(all none div divf divd rsqrt rsqrtf rsqrtd)' # TODO comma separated and can have ! + '-mrecip[generate reciprocals instead of divss and sqrtss]' + '-mrecord-mcount[generate __mcount_loc section with all mcount or __fentry__ calls]' + '-mred-zone[use red-zone in the x86-64 code]' + '-mreg-alloc=[control the default allocation order of integer registers]:default register allocation order:' + '-mregparm=-[number of registers used to pass integer arguments]:number of integer argument registers: ' + '-mretpoline-external-thunk[retpoline external thunk]' + '-mrtd[alternate calling convention]' + '-mrtm[support RTM built-in functions and code generation]' + '-msahf[support code generation of sahf instruction in 64bit x86-64 code]' + '-mserialize[serialize]' + '-msgx[support SGX built-in functions and code generation]' + '-msha[support SHA1 and SHA256 built-in functions and code generation]' + '-mshstk[shstk]' + '-mskip-rax-setup[skip setting up RAX register when passing variable arguments]' + '-msoft-float[do not use hardware fp]' + '-msse2avx[encode SSE instructions with VEX prefix]' + '-msse2[support MMX, SSE and SSE2 built-in functions and code generation]' + '-msse3[support MMX, SSE, SSE2 and SSE3 built-in functions and code generation]' + '-msse4.1[support MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 built-in functions and code generation]' + '-msse4.2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]' + '-msse4a[support MMX, SSE, SSE2, SSE3 and SSE4A built-in functions and code generation]' + '-msse4[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]' + '-msseregparm[use SSE register passing conventions for SF and DF mode]' + '-msse[support MMX and SSE built-in functions and code generation]' + '-mssse3[support MMX, SSE, SSE2, SSE3 and SSSE3 built-in functions and code generation]' + '-mstack-arg-probe[enable stack probing]' + '-mstack-protector-guard=-[use given stack-protector guard]:guard:(global tls)' + '-mstackrealign[realign stack in prologue]' + '-mstringop-strategy=-[chose strategy to generate stringop using]:stringop strategy:(byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop)' + '-mstv[disable Scalar to Vector optimization pass transforming 64-bit integer computations into a vector ones]' + '-mtbm[support TBM built-in functions and code generation]' + '-mthreads[support thread-safe exception handling on MinGW]' + '-mtls-dialect=-[use given thread-local storage dialect]:TLS dialect:(gnu gnu2)' + '-mtls-direct-seg-refs[use direct references against %gs when accessing tls data]' + '-mtsxldtrk[tsxldtrk]' + #'-mtune-ctrl=-[fine grain control of tune features]:feature-list:' #for dev use only + '-mtune=-[tune code for CPU type]:CPU type:->arch' + '-muclibc[use uClibc C library]' + '-muintr[uintr]' + '-mvaes[vaes]' + '-mveclibabi=-[vector library ABI to use]:vector library ABI:(acml svml)' + '-mvect8-ret-in-mem[return 8-byte vectors in memory]' + '-mvpclmulqdq[vpclmulqdq]' + '-mvzeroupper[generate vzeroupper instruction before a transfer of control flow out of the function]' + '-mwaitpkg[waitpkg]' + '-mwbnoinvd[wbnoinvd]' + '-mwidekl[widekl]' + '-mx32[generate 32bit x86-64 code]' + '-mx87[x87]' + '-mxop[support XOP built-in functions and code generation]' + '-mxsavec[support XSAVEC instructions]' + '-mxsaveopt[support XSAVEOPT instruction]' + '-mxsaves[support XSAVES and XRSTORS instructions]' + '-mxsave[support XSAVE and XRSTOR instructions]' ) ;; hppa*) @@ -298,6 +390,10 @@ i960) ) ;; sparc) + arch=( + v7 cypress v8 supersparc sparclite f930 f934 hypersparc sparclite86x sparclet + tsc701 v9 ultrasparc ultrasparc3 + ) args=( -mapp-regs -mno-app-regs -mfpu -mhard-float @@ -308,8 +404,8 @@ sparc) -munaligned-doubles -mfaster-structs -mno-faster-structs -mimpure-text - '-mcpu=:CPU type:(v7 cypress v8 supersparc sparclite f930 f934 hypersparc sparclite86x sparclet tsc701 v9 ultrasparc ultrasparc3)' - '-mtune=:CPU type:(cypress supersparc hypersparc f930 f934 sparclite86x tsc701 ultrasparc ultrasparc3)' + '-mcpu=:CPU type:->arch' + '-mtune=:CPU type:->arch' -mv8plus -mno-v8plus -mvis -mno-vis -mlittle-endian @@ -341,863 +437,1797 @@ h8/300) -mrelax -mh ) ;; +aarch64) + args=( + '-mmark-bti-property[add .note.gnu.property with BTI to assembly files]' + '-moutline[enable function outlining (AArch64 only)]' + '-msve-vector-bits=[specify the size in bits of an SVE vector register]:bits' + ) + ;; +amdgpu) + args=( + '-mcumode[specify CU wavefront execution mode]' + '-mtgsplit[enable threadgroup split execution mode (AMDGPU only)]' + ) + ;; +hexagon) + args=( + '-mieee-rnd-near[ieee rnd near]' + '-mmemops[enable generation of memop instructions]' + '-mnvj[enable generation of new-value jumps]' + '-mnvs[enable generation of new-value stores]' + '-mpackets[enable generation of instruction packets]' + '-mhvx[enable Hexagon Vector eXtensions]' + '-mhvx-length=[set Hexagon Vector Length]:arg' + '-mhvx=[enable Hexagon Vector eXtensions]:arg' + ) + ;; +webassembly*) + args=( + '-matomics[atomics]' + '-mbulk-memory[bulk memory]' + '-mexception-handling[exception handling]' + '-mmultivalue[multivalue]' + '-mmutable-globals[mutable globals]' + '-mnontrapping-fptoint[no ntrapping fptoint]' + '-mreference-types[reference types]' + '-msign-ext[sign ext]' + '-msimd128[simd128]' + '-mtail-call[tail call]' + '-munimplemented-simd128[unimplemented simd128]' + '-mexec-model=[execution model]:arg' + ) + ;; +riscv) + args=( + '-msave-restore[enable using library calls for save and restore]' + ) + ;; esac if [[ "$service" = clang* ]]; then - args+=( - "-flto=-[generate output files suitable for link time optimization]::style:(full thin)" - -emit-llvm - "-Qunused-arguments[don't emit warning for unused driver arguments]" - --analyze - -fshow-column -fshow-source-location -fcaret-diagnostics -fdiagnostics-fixit-info - -fdiagnostics-parseable-fixits -fdiagnostics-print-source-range-info - -fprint-source-range-info -fdiagnostics-show-option -fmessage-length - "-nostdinc[Do not search standard system directories or compiler builtin directories for include files]" - "-nostdlibinc[Do not search standard system directories for include files]" - "-nobuiltininc[Do not search builtin directory for include files]" - "--help[Display this information]" - ) + args+=( + '-all_load[undocumented option]' + '-allowable_client[undocumented option]:argument' + '--analyzer-no-default-checks[analyzer does no default checks]' + '--analyzer-output[static analyzer report output format]:format:(html plist plist-multi-file plist-html sarif sarif-html text)' + '--analyze[run the static analyzer]' + '-arch[arch]:argument' + '-arch_errors_fatal[arch errors fatal]' + '-arch_only[arch only]:argument' + '-arcmt-migrate-emit-errors[emit ARC errors even if the migrator can fix them]' + '-arcmt-migrate-report-output[output path for the plist report]:file:_files' + '-a-[undocumented option]:argument' + '--autocomplete=[autocomplete]:argument' + '-bind_at_load[bind at load]' + '--bootclasspath=[bootclasspath]:arg' + '-bundle[bundle]' + '-bundle_loader[bundle loader]:argument' + '--CLASSPATH=[CLASSPATH]:arg' + '--classpath=[classpath]:arg' + '-cl-denorms-are-zero[allow denormals to be flushed to zero]' + '-cl-fast-relaxed-math[cl fast relaxed math]' + '-cl-finite-math-only[allow floating-point optimizations]' + '-cl-fp32-correctly-rounded-divide-sqrt[specify that divide and sqrt are correctly rounded]' + '-client_name[client name]:argument' + '-cl-kernel-arg-info[generate kernel argument metadata]' + '-cl-mad-enable[allow use of less precise MAD computations]' + '-cl-no-signed-zeros[allow use of no signed zeros computations]' + '-cl-no-stdinc[disables all standard includes]' + '-cl-opt-disable[disables all optimizations]' + '-cl-single-precision-constant[treat double float constant as single precision]' + '-cl-std=[openCL language standard to compile for]:arg' + '-cl-strict-aliasing[this option is added for compatibility with OpenCL 1.0]' + '-cl-uniform-work-group-size[defines that the global work-size be uniform]' + '-cl-unsafe-math-optimizations[allow unsafe floating-point optimizations]' + '-compatibility_version[compatibility version]:compatibility version' + '--config[specifies configuration file]:configuration file:_files' + '--constant-cfstrings[use constant cfstrings]' + '--coverage[coverage]' + '-coverage[coverage]' + '-cpp[cpp]' + '--cuda-compile-host-device[compile CUDA code for both host and device]' + '--cuda-device-only[compile CUDA code for device only]' + '--cuda-gpu-arch=[cUDA offloading device architecture]:arg' + '--cuda-host-only[compile CUDA code for host only]' + '*--cuda-include-ptx=[include ptx for the following gpu architecture]:argument' + '--cuda-noopt-device-debug[enable device-side debug info generation]' + '--cuda-path=[cUDA installation path]:arg' + '--cuda-path-ignore-env[ignore environment variables to detect CUDA installation]' + '-cuid=[an id for compilation unit]:argument' + '-current_version[current version]:current version' + '-cxx-isystem[add directory to the C++ SYSTEM include search path]:directory:_files -/' + '-dead_strip[dead strip]' + '-dependency-dot[file to write dot-formatted header dependencies to]:file:_files' + '-dependency-file[file to write dependency output to]:file:_files' + '--dyld-prefix=[dyld prefix]:prefix' + '--dylib_file[dyld file]:file:_files' + '-dylinker[dylinker]' + '-dylinker_install_name[dylinker install name]:name' + '-dynamic[dynamic]' + '-dynamiclib[dynamic lib]' + '-EB[big endian]' + '-EL[little endian]' + '-emit-ast[emit Clang AST files for source inputs]' + '-emit-interface-stubs[generate Interface Stub Files]' + '-emit-llvm[use the LLVM representation for assembler and object files]' + '-emit-merged-ifs[generate Interface Stub Files, emit merged text not binary]' + '--emit-static-lib[enable linker job to emit a static library]' + #'-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang[trivial automatic variable initialization to zero is only here for benchmarks]' + '--encoding=[encoding]:arg' + '-exported_symbols_list[exported symbols list]:argument' + '--extdirs=[extdirs]:arg' + '--extra-warnings[enable extra warnings]' + '-faccess-control[access control]' + '*-F+[add directory to framework search path]:framework directory:_files -/' + '-faddrsig[emit an address-significance table]' + '-faggressive-function-elimination[aggressive function elimination]' + '-falign-commons[align commons]' + '-faligned-allocation[aligned allocation]' + '-faligned-new[enable C++17 aligned allocation functions]' + '-fall-intrinsics[all intrinsics]' + '-fallow-editor-placeholders[treat editor placeholders as valid source code]' + '-fallow-unsupported[allow unsupported]' + '-falternative-parameter-statement[enable the old style PARAMETER statement]' + '-faltivec[altivec]' + '-fansi-escape-codes[use ANSI escape codes for diagnostics]' + "-fapple-kext[use Apple's kernel extensions ABI]" + '-fapple-link-rtlib[force linking the clang builtins runtime library]' + '-fapple-pragma-pack[enable Apple GCC-compatible #pragma pack handling]' + '-fapplication-extension[restrict code to those available for App Extensions]' + '-fasm-blocks[asm blocks]' + '-fassume-sane-operator-new[assume sane operator new]' + '-fast[ast]' + '-fastcp[astcp]' + '-fastf[astf]' + '-fautolink[autolink]' + '-fautomatic[automatic]' + '-fauto-profile-accurate[auto profile accurate]' + '-fauto-profile=[enable sample-based profile guided optimizations]::arg' + '-fbackslash[change the interpretation of backslashes in string literals]' + '-fbacktrace[backtrace]' + '-fbasic-block-sections=[generate labels for each basic block]:arg' + '-fbinutils-version=[produced object files can use all ELF features supported by this version]:major.minor' + '-fblas-matmul-limit=[blas matmul limit]:arg' + '-fblocks[enable the blocks language feature]' + '-fbootclasspath=[bootclasspath]:arg' + '-fborland-extensions[accept non-standard constructs supported by the Borland compiler]' + '-fbracket-depth=[bracket depth]:arg' + '-fbuild-session-file=[use the last modification time of <file> as the build session timestamp]:file:_files' + '-fbuild-session-timestamp=[time when the current build session started]:time since Epoch in seconds' + '-fbuiltin-module-map[load the clang builtins module map file]' + '-fcaret-diagnostics[show diagnostic messages using a caret]' + '-fcf-protection=[instrument control-flow architecture protection]::arg (options\: return, branch, full, none)' + '-fcf-runtime-abi=[cf runtime abi]:arg' + '-fchar8_t[enable C++ builtin type char8_t]' + '-fcheck-array-temporaries[check array temporaries]' + '-fcheck=[check]:arg' + '-fclang-abi-compat=[attempt to match the ABI of Clang <version>]:version' + '-fclasspath=[classpath]:arg' + '-fcoarray=[coarray]:arg' + '-fcolor-diagnostics[enable colors in diagnostics]' + '-fcomment-block-commands=[treat each comma separated argument in <arg> as a documentation comment block command]:arg' + '-fcompile-resource=[compile resource]:arg' + '-fcomplete-member-pointers[require member pointer base types to be complete if they would be significant under the Microsoft ABI]' + '-fconstant-cfstrings[constant cfstrings]' + '-fconstant-string-class=[constant string class]:arg' + '-fconstexpr-backtrace-limit=[constexpr backtrace limit]:arg' + '-fconstexpr-depth=[constexpr depth]:arg' + '-fconstexpr-steps=[constexpr steps]:arg' + '-fconvergent-functions[assume functions may be convergent]' + '-fconvert=[convert]:arg' + '-fcoroutines-ts[enable support for the C++ Coroutines TS]' + '-fcoverage-compilation-dir=[the compilation directory to embed in the coverage mapping]:arg' + '-fcoverage-mapping[generate coverage mapping to enable code coverage analysis]' + '-fcoverage-prefix-map=[remap file source paths in coverage mapping]:arg' + '-fcrash-diagnostics-dir=[crash diagnostics dir]:arg' + '-fcray-pointer[cray pointer]' + '-fcreate-profile[create profile]' + '-fcs-profile-generate[generate instrumented code to collect context sensitive execution counts]' + '-fcs-profile-generate=[generate instrumented code to collect context sensitive execution counts]:directory:_files -/' + '-fc\+\+-static-destructors[c++ static destructors]' + '-fcuda-approx-transcendentals[use approximate transcendental functions]' + '-fcuda-flush-denormals-to-zero[flush denormal floating point values to zero in CUDA device mode]' + '-fcuda-rdc[cuda rdc]' + '-fcuda-short-ptr[use 32-bit pointers for accessing const/local/shared address spaces]' + '-fcxx-exceptions[enable C++ exceptions]' + '-fcxx-modules[cxx modules]' + '-fdebug-compilation-dir=[the compilation directory to embed in the debug info]:arg' + '-fdebug-default-version=[default DWARF version to use]:arg' + '-fdebug-dump-parse-tree[dump the parse tree]' + '-fdebug-dump-provenance[dump provenance]' + '-fdebug-dump-symbols[dump symbols after the semantic analysis]' + '-fdebug-info-for-profiling[emit extra debug info to make sample profile more accurate]' + '-fdebug-macro[emit macro debug information]' + '-fdebug-measure-parse-tree[measure the parse tree]' + '-fdebug-pass-arguments[debug pass arguments]' + '-fdebug-pass-structure[debug pass structure]' + '-fdebug-pre-fir-tree[dump the pre-FIR tree]' + '-fdebug-ranges-base-address[use DWARF base address selection entries in .debug_ranges]' + '-fdebug-unparse[unparse and stop]' + '-fdebug-unparse-with-symbols[unparse and stop]' + '-fdeclspec[allow __declspec as a keyword]' + '-fdefault-double-8[set the default double precision kind to an 8 byte wide type]' + '-fdefault-integer-8[set the default integer kind to an 8 byte wide type]' + '-fdefault-real-8[set the default real kind to an 8 byte wide type]' + '-fdelayed-template-parsing[parse templated function definitions at the end of the translation unit]' + '-fdenormal-fp-math=[denormal fp math]:arg' + '-fdepfile-entry=[depfile entry]:arg' + '-fdiagnostics-absolute-paths[print absolute paths in diagnostics]' + '-fdiagnostics-fixit-info[supply fixit into with diagnostic messages]' + '-fdiagnostics-format=[diagnostics format]:arg' + '-fdiagnostics-hotness-threshold=[prevent optimization remarks from being output if they do not meet threshold]:value' + '-fdiagnostics-parseable-fixits[print fixits in a machine parseable form]' + '-fdiagnostics-print-source-range-info[print source range spans in numeric form]' + '-fdiagnostics-show-category=[diagnostics show category]:arg' + '-fdiagnostics-show-hotness[enable profile hotness information in diagnostic line]' + '-fdiagnostics-show-note-include-stack[display include stacks for diagnostic notes]' + '-fdiagnostics-show-option[enable -Woption information in diagnostic line]' + '-fdiagnostics-show-template-tree[print a template comparison tree for differing templates]' + '-fdigraphs[enable alternative token representations]' + "-fdirect-access-external-data[don't use GOT indirection to reference external data symbols]" + '-fdiscard-value-names[discard value names in LLVM IR]' + '-fd-lines-as-code[d lines as code]' + '-fd-lines-as-comments[d lines as comments]' + '-fdollar-ok[dollar ok]' + '-fdouble-square-bracket-attributes[enable double square bracket attributes]' + '-fdump-fortran-optimized[dump fortran optimized]' + '-fdump-fortran-original[dump fortran original]' + '-fdump-parse-tree[dump parse tree]' + '-fdwarf-directory-asm[DWARF directory asm]' + '-fdwarf-exceptions[use DWARF style exceptions]' + '-felide-constructors[elide constructors]' + '-felide-type[elide types when printing diagnostics]' + '-fembed-bitcode=[embed LLVM bitcode (option: off, all, bitcode, marker)]:option' + '-fembed-bitcode[equivalent to -fembed-bitcode=all]' + '-fembed-bitcode-marker[equivalent to -fembed-bitcode=marker]' + '-femit-all-decls[emit all declarations]' + '-femulated-tls[use emutls functions to access thread_local variables]' + '-fenable-matrix[enable matrix data type and related builtin functions]' + '-fencoding=[encoding]:arg' + '-ferror-limit=[error limit]:arg' + '-fescaping-block-tail-calls[escaping block tail calls]' + '-fexperimental-isel[experimental isel]' + '-fexperimental-new-constant-interpreter[enable the experimental new constant interpreter]' + '-fexperimental-relative-c\+\+-abi-vtables[use the experimental C++ class ABI for classes with vtables]' + '-fexperimental-strict-floating-point[enables experimental strict floating point in LLVM]' + '-fextdirs=[extdirs]:arg' + '-fexternal-blas[external blas]' + '-ff2c[f2c]' + '-ffile-compilation-dir=[the compilation directory to embed in the debug info]:arg' + '-ffile-prefix-map=[remap file source paths in debug info and predefined preprocessor macros]:arg' + '-ffine-grained-bitfield-accesses[use separate accesses for consecutive bitfield runs with legal widths and alignments]' + '-ffinite-loops[assume all loops are finite]' + '-ffixed-form[process source files in fixed form]' + '-ffixed-line-length=[set column after which characters are ignored]:arg' + '-ffixed-point[enable fixed point types]' + '-fforce-dwarf-frame[always emit a debug frame section]' + '-fforce-emit-vtables[emits more virtual tables to improve devirtualization]' + '-fforce-enable-int128[enable support for int128_t type]' + '-ffor-scope[for scope]' + '-ffpe-trap=[fpe trap]:arg' + '-ffp-exception-behavior=[specifies the exception behavior of floating-point operations]:arg' + '-ffp-model=[controls the semantics of floating-point calculations]:arg' + '-ffree-form[process source files in free form]' + '-ffree-line-length-[free line length]:arg' + '-ffrontend-optimize[frontend optimize]' + '-fglobal-isel[enables the global instruction selector]' + '-fgnuc-version=[sets various macros to claim compatibility with the given GCC version]:version' + '-fgnu-inline-asm[gnu inline asm]' + '-fgnu-keywords[allow GNU-extension keywords regardless of language standard]' + '-fgnu-runtime[generate output compatible with the standard GNU Objective-C runtime]' + '-fgpu-allow-device-init[allow device side init function in HIP]' + '-fgpu-defer-diag[defer host/device related diagnostic messages for CUDA/HIP]' + '-fgpu-rdc[generate relocatable device code, also known as separate compilation mode]' + '-fgpu-sanitize[enable sanitizer for AMDGPU target]' + '-fheinous-gnu-extensions[heinous GNU extensions]' + '-fhip-new-launch-api,[-fno-hip-new-launch-api Use new kernel launching API for HIP]' + '-fhonor-infinites[honor infinites]' + '-fhonor-infinities[honor infinities]' + '-fhonor-nans[honor nans]' + '-fignore-exceptions[enable support for ignoring exception handling constructs]' + '-filelist[ilelist]:arg' + '-fimplicit-module-maps[implicit module maps]' + '-fimplicit-modules[implicit modules]' + '-fimplicit-none[no implicit typing allowed unless overridden by IMPLICIT statements]' + '-findirect-virtual-calls[indirect virtual calls]' + '-finit-character=[init character]:arg' + '-finit-integer=[init integer]:arg' + '-finit-local-zero[init local zero]' + '-finit-logical=[init logical]:arg' + '-finit-real=[init real]:arg' + '-finline-hint-functions[inline functions which are (explicitly or implicitly) marked inline]' + '-finstrument-function-entry-bare[instrument function entry only]' + '-finstrument-functions-after-inlining[insert the calls after inlining]' + '-finteger-4-integer-8[integer 4 integer 8]' + '-fintegrated-as[enable the integrated assembler]' + '-fintegrated-cc1[run cc1 in-process]' + '-fintrinsic-modules-path[intrinsic modules path]' + '-flarge-sizes[use INTEGER(KIND=8) for the result type in size-related intrinsics]' + '-flat_namespace[flat namespace]' + '-flegacy-pass-manager[use the legacy pass manager in LLVM]' + '-flimited-precision=[limited precision]:arg' + '-flogical-abbreviations[enable logical abbreviations]' + '-flto=-[generate output files suitable for link time optimization]::style:(full thin)' + '-flto-jobs=[controls the backend parallelism]:arg' + '-fmacro-backtrace-limit=[macro backtrace limit]:limit' + '-fmacro-prefix-map=[remap file source paths in predefined preprocessor macros]:arg' + '-fmax-array-constructor=[max array constructor]:arg' + '-fmax-identifier-length[max identifier length]' + '-fmax-stack-var-size=[max stack var size]:arg' + '-fmax-subrecord-length=[max subrecord length]:arg' + '-fmax-tokens=[max total number of preprocessed tokens for -Wmax-tokens]:number' + '-fmax-type-align=[specify the maximum alignment to enforce on pointers lacking an explicit alignment]:arg' + '-fmemory-profile=[enable heap memory profiling and dump results into <directory>]::directory:_files -/' + '-fmodule-file-deps[module file deps]' + '-fmodule-file=[specify the mapping of module name to precompiled module file]:file:_files' + '-fmodule-implementation-of[module implementation of]:name' + '-fmodule-map-file=[load this module map file]:file:_files' + '-fmodule-maps[implicitly search the file system for module map files.]' + '-fmodule-name=[specify the name of the module to build]:name' + '-fmodule-private[module private]' + '-fmodules-cache-path=[specify the module cache path]:directory:_files -/' + '-fmodules-decluse[require declaration of modules used within a module]' + '-fmodules-disable-diagnostic-validation[disable validation of the diagnostic options when loading the module]' + '-fmodules[enable the modules language feature]' + '-fmodules-ignore-macro=[ignore the definition of the given macro when building and loading modules]:macro' + '-fmodules-prune-after=[specify the interval after which a module file will be considered unused]:seconds' + '-fmodules-prune-interval=[specify the interval between attempts to prune the module cache]:seconds' + '-fmodules-search-all[search even non-imported modules to resolve references]' + '-fmodules-strict-decluse[requires all headers to be in modules]' + '-fmodules-ts[enable support for the C++ Modules TS]' + '-fmodules-user-build-path[specify the module user build path]:directory:_files -/' + '-fmodules-validate-input-files-content[validate PCM input files based on content if mtime differs]' + "-fmodules-validate-once-per-build-session[don't verify input files for the modules]" + '-fmodules-validate-system-headers[validate the system headers that a module depends on when loading the module]' + '-fms-compatibility[enable full Microsoft Visual C++ compatibility]' + '-fms-compatibility-version=[microsoft compiler version number]:arg' + '-fmsc-version=[microsoft compiler version number to report]:arg' + '-fms-memptr-rep=[ms memptr rep]:arg' + '-fms-volatile[ms volatile]' + '-fnested-functions[nested functions]' + '-fnew-alignment=[specifies the largest alignment guaranteed]:align' + '-fnext-runtime[next runtime]' + '-fno-builtin-[disable implicit builtin knowledge of a specific function]:arg' + '-fno-crash-diagnostics[disable auto-generation of preprocessed source files and a script for reproduction during a clang crash]' + '-fno-limit-debug-info[no limit debug info]' + '-fno-max-type-align[no max type align]' + '-fno_modules-validate-input-files-content[no modules validate input files content]' + '-fno_pch-validate-input-files-content[no pch validate input files content]' + '-fno-strict-modules-decluse[no strict modules decluse]' + '-fno-temp-file[directly create compilation output files]' + '-fno-working-directory[no working directory]' + '-fnoxray-link-deps[no xray link deps]' + '-fobjc-abi-version=-[set Objective-C ABI version]:version' + '-fobjc-arc-exceptions[use EH-safe code when synthesizing retains and releases in -fobjc-arc]' + '-fobjc-arc[synthesize retain and release calls for Objective-C pointers]' + '-fobjc-convert-messages-to-runtime-calls[convert messages to runtime calls]' + '-fobjc-encode-cxx-class-template-spec[fully encode C++ class template specialization]' + '-fobjc-exceptions[enable Objective-C exceptions]' + '-fobjc-infer-related-result-type[infer related result type]' + '-fobjc-legacy-dispatch[use legacy dispatch]' + '-fobjc-link-runtime[set link runtime]' + '-fobjc-nonfragile-abi[set nonfragile abi]' + '-fobjc-nonfragile-abi-version=-[set nonfragile abi version]:version' + '-fobjc-runtime=-[specify the target Objective-C runtime kind and version]:runtime' + '-fobjc-sender-dependent-dispatch[set sender dependent dispatch]' + '-fobjc-weak[enable ARC-style weak references in Objective-C]' + '-fopenmp-targets=[specify comma-separated list of triples OpenMP offloading targets to be supported]:targets' + '-fopenmp-version=[openmp version]:version' + '-foperator-arrow-depth=[operator arrow depth]:arg' + '-foperator-names[treat C++ operator name keywords as synonyms for operators]' + '-foptimization-record-file=[specify the output name of the file containing the optimization remarks]:file:_files' + '-foptimization-record-passes=[only include passes which match a specified regex]:regex' + '-force_cpusubtype_ALL[force cpusubtype all]' + '-force_flat_namespace[force flat namespace]' + '--force-link=[force link]:arg' + '-force_load[force load]:argument' + '-forder-file-instrumentation[generate instrumented code to collect order file]' + '-foutput-class-dir=[output class dir]:arg' + '-fpack-derived[pack derived]' + '-fparse-all-comments[parse all comments]' + '-fpascal-strings[recognize and construct Pascal-style string literals]' + '-fpass-plugin=[load pass plugin from a dynamic shared object file]:dsopath' + '-fpatchable-function-entry=[generate NOPs around function entry]:N,M' + '-fpch-codegen[generate code for uses of this PCH]' + '-fpch-debuginfo[generate debug info for types in an object file built from this PCH]' + '-fpch-instantiate-templates[instantiate templates already while building a PCH]' + '-fpch-validate-input-files-content[validate PCH input files based on content]' + '-fprebuilt-implicit-modules[look up implicit modules]' + '-fprebuilt-module-path=[specify the prebuilt module path]:directory:_files -/' + '-fpreserve-as-comments[preserve as comments]' + '-fproc-stat-report=[save subprocess statistics to the given file]:arg' + '-fprofile-exclude-files=[exclude files from profile]:arg' + '-fprofile-filter-files=[filter files for profile]:arg' + '-fprofile-instr-generate=[generate instrumented profile into file]::file:_files' + '-fprofile-instr-use=[use instrumentation data for profile-guided optimization]::arg' + '-fprofile-list=[filename defining the list of items to instrument]:file:_files' + '-fprofile-remapping-file=[use the remappings described in file in profile]:file:_files' + '-fprofile-sample-accurate[specifies that the sample profile is accurate]' + '-fprofile-sample-use=[profile sample use]::arg' + '-fprofile-update=[set update method of profile counters]:method' + '-fprotect-parens[protect parens]' + '-fpseudo-probe-for-profiling[emit pseudo probes for sample profiling]' + '*-framework[include framework found in search path]:framework:->framework' + '-frange-check[range check]' + '-freal-4-real-10[real 4 real 10]' + '-freal-4-real-16[real 4 real 16]' + '-freal-4-real-8[real 4 real 8]' + '-freal-8-real-10[real 8 real 10]' + '-freal-8-real-16[real 8 real 16]' + '-freal-8-real-4[real 8 real 4]' + '-frealloc-lhs[realloc lhs]' + '-frecord-command-line[record command line]' + '-frecord-marker=[record marker]:arg' + '-frecursive[recursive]' + '-fregister-global-dtors-with-atexit[use atexit to register global destructors]' + '-frelaxed-template-template-args[enable C++17 relaxed template template argument matching]' + '-frepack-arrays[repack arrays]' + '-freroll-loops[turn on loop reroller]' + '-fretain-comments-from-system-headers[retain comments from system headers]' + '-frewrite-imports[rewrite imports]' + '-frewrite-includes[rewrite includes]' + '-frewrite-map-file=[rewrite map file]:arg' + '-fropi[generate read-only position independent code (ARM only)]' + '-frtlib-add-rpath[add -rpath with architecture-specific resource directory to the linker flags]' + '-frtti-data[rtti data]' + '-frwpi[generate read-write position independent code (ARM only)]' + '-fsanitize-address-destructor-kind=[set destructor type used in ASan instrumentation]:kind' + '-fsanitize-address-field-padding=[level of field padding for AddressSanitizer]:arg' + '-fsanitize-address-globals-dead-stripping[enable linker dead stripping of globals in AddressSanitizer]' + '-fsanitize-address-poison-custom-array-cookie[enable poisoning array cookies when using custom operator new in AddressSanitizer]' + '-fsanitize-address-use-after-scope[enable use-after-scope detection in AddressSanitizer]' + '-fsanitize-address-use-odr-indicator[enable ODR indicator globals]' + '-fsanitize-blacklist=[path to blacklist file for sanitizers]:arg' + '-fsanitize-cfi-canonical-jump-tables[make the jump table addresses canonical in the symbol table]' + '-fsanitize-cfi-cross-dso[enable control flow integrity (CFI) checks for cross-DSO calls]' + '-fsanitize-cfi-icall-generalize-pointers[generalize pointers in CFI indirect call type signature checks]' + '-fsanitize-coverage-allowlist=[sanitize coverage allowlist]:arg' + '-fsanitize-coverage-blacklist=[disable sanitizer coverage instrumentation]:arg' + '-fsanitize-coverage-blocklist=[sanitize coverage blocklist]:arg' + '-fsanitize-coverage=[specify the type of coverage instrumentation for Sanitizers]:arg' + '-fsanitize-coverage-whitelist=[restrict sanitizer coverage instrumentation]:arg' + '-fsanitize-hwaddress-abi=[select the HWAddressSanitizer ABI to target]:arg' + '-fsanitize-link-c\+\+-runtime[sanitize link c++ runtime]' + '-fsanitize-link-runtime[sanitize link runtime]' + '-fsanitize-memory-track-origins=[enable origins tracking in MemorySanitizer]::arg' + '-fsanitize-memory-use-after-dtor[enable use-after-destroy detection in MemorySanitizer]' + '-fsanitize-minimal-runtime[sanitize minimal runtime]' + '-fsanitize-recover=[enable recovery for specified sanitizers]::arg' + '-fsanitize-stats[enable sanitizer statistics gathering]' + '-fsanitize-system-blacklist[path to system blacklist file for sanitizers]:file:_files' + '-fsanitize-thread-atomics[enable atomic operations instrumentation in ThreadSanitizer (default)]' + '-fsanitize-thread-func-entry-exit[enable function entry/exit instrumentation in ThreadSanitizer]' + '-fsanitize-thread-memory-access[enable memory access instrumentation in ThreadSanitizer]' + '-fsanitize-trap=[enable trapping for specified sanitizers]::arg' + '-fsanitize-undefined-strip-path-components=[strip a given number of path components when emitting check metadata]:number' + '-fsanitize-undefined-trap-on-error[equivalent to -fsanitize-trap=undefined]' + '-fsave-optimization-record=[generate an optimization record file in a specific format]::format' + '-fsecond-underscore[second underscore]' + '-fseh-exceptions[use SEH style exceptions]' + '-fsemantic-interposition[semantic interposition]' + '-fshow-column[show the column]' + '-fshow-overloads=[which overload candidates to show when overload resolution fails]:arg' + '-fshow-source-location[show source location]' + '-fsignaling-math[signaling math]' + '-fsign-zero[sign zero]' + '-fsized-deallocation[enable C++14 sized global deallocation functions]' + '-fsjlj-exceptions[use SjLj style exceptions]' + '-fslp-vectorize[enable the superword-level parallelism vectorization passes]' + '-fspell-checking-limit=[spell checking limit]:arg' + '-fspell-checking[spell checking]' + '-fsplit-dwarf-inlining[provide minimal debug info in the object]' + '-fsplit-lto-unit[enables splitting of the LTO unit]' + '-fsplit-machine-functions[enable late function splitting using profile information]' + '-fstack-arrays[stack arrays]' + '-fstack-clash-protection[enable stack clash protection]' + '-fstack-size-section[emit section containing metadata on function stack sizes]' + '-fstandalone-debug[emit full debug info for all types used by the program]' + '-fstrict-float-cast-overflow[assume that overflowing float-to-int casts are undefined]' + '-fstrict-return[strict return]' + '-fstrict-vtable-pointers[enable optimizations based on the strict vtables]' + '-fstruct-path-tbaa[struct path tbaa]' + '-fsycl[enable SYCL kernels compilation for device]' + '-fsymbol-partition=[symbol partition]:arg' + '-fsystem-module[build this module as a system module. only used with -emit-module]' + '-ftemplate-backtrace-limit=[template backtrace limit]:arg' + '-ftemplate-depth--[template depth]:arg' + '-ftemplate-depth=[template depth]:arg' + '-fterminated-vtables[terminated vtables]' + '-fthin-link-bitcode=[write minimized bitcode to <file>]:file:_files' + '-fthinlto-index=[perform ThinLTO importing using provided index]:arg' + '-fthreadsafe-statics[threadsafe statics]' + '-ftime-trace-granularity=[minimum time granularity traced by time profiler]:microseconds' + '-ftime-trace[turn on time profiler]' + '-ftrap-function=[issue call to specified function rather than a trap instruction]:function name' + '-ftrapv-handler=[specify the function to be called on overflow]:function name' + '-ftrigraphs[process trigraph sequences]' + '-ftrivial-auto-var-init=[initialize trivial automatic stack variables]:arg' + '-ftrivial-auto-var-init-stop-after=[stop initializing trivial automatic stack variables after the specified number of instances]:arg' + '-funderscoring[underscoring]' + '-funique-basic-block-section-names[use unique names for basic block sections]' + '-funique-internal-linkage-names[uniqueify Internal Linkage Symbol Names]' + '-funique-section-names[unique section names]' + '-funit-at-a-time[unit at a time]' + '-fuse-cuid=[method to generate ids for compilation units for single source offloading languages CUDA and HIP]:argument' + '-fuse-cxa-atexit[use cxa atexit]' + '-fuse-init-array[use init array]' + '-fuse-line-directives[use #line in preprocessed output]' + '-fvalidate-ast-input-files-content[compute and store the hash of input files used to build an AST]' + '-fveclib=[use the given vector functions library]:arg' + '-fvectorize[enable the loop vectorization passes]' + '-fvirtual-function-elimination[enables dead virtual function elimination optimization]' + '-fvisibility-dllexport=[the visibility for dllexport definitions]:arg' + '-fvisibility-externs-dllimport=[the visibility for dllimport external declarations]:arg' + '-fvisibility-externs-nodllstorageclass=[the visibility for external declarations without an explicit DLL dllstorageclass]:arg' + '-fvisibility-from-dllstorageclass[set the visibility of symbols in the generated code from their DLL storage class]' + '-fvisibility-global-new-delete-hidden[give global C++ operator new and delete declarations hidden visibility]' + '-fvisibility-inlines-hidden[give inline C++ member functions hidden visibility by default]' + '-fvisibility-inlines-hidden-static-local-var[visibility inlines hidden static local var]' + '-fvisibility-ms-compat[give global types and functions a specific visibility]' + '-fvisibility-nodllstorageclass=[the visibility for defintiions without an explicit DLL export class]:arg' + '-fwasm-exceptions[use WebAssembly style exceptions]' + '-fwhole-file[whole file]' + '-fwhole-program-vtables[enables whole-program vtable optimization]' + '-fwritable-strings[store string literals as writable data]' + '-fxl-pragma-pack[enable IBM XL #pragma pack handling]' + '-fxor-operator[enable .XOR. as a synonym of .NEQV.]' + '-fxray-always-emit-customevents[always emit xray customevent calls]' + '-fxray-always-emit-typedevents[always emit xray typedevents calls]' + '-fxray-always-instrument=[file defining xray always instrument]:file:_files' + '-fxray-attr-list=[file defining the list of xray attributes]:file:_files' + '-fxray-function-groups=[only instrument 1 of N groups]:arg' + '-fxray-function-index[xray function index]' + "-fxray-ignore-loops[don't instrument functions with loops unless they also meet the minimum function size]" + '-fxray-instruction-threshold=[sets the minimum function size to instrument with XRay]:arg' + '-fxray-instrumentation-bundle=[select which XRay instrumentation points to emit]:arg' + '-fxray-instrument[generate XRay instrumentation sleds on function entry and exit]' + '-fxray-link-deps[tells clang to add the link dependencies for XRay]' + '-fxray-modes=[list of modes to link in by default into XRay instrumented binaries]:arg' + '-fxray-never-instrument=[file defining the whitelist for Xray attributes]:file:_files' + '-fxray-selected-function-group=[select which group of functions to instrument]:arg' + '-fzvector[enable System z vector language extension]' + {-gcc-toolchain=,--gcc-toolchain=}'[use the gcc toolchain at the given directory]:directory:_files -/' + '-gcodeview[generate CodeView debug information]' + {-gcodeview-ghash,-gno-codeview-ghash}'[emit type record hashes is a .debug section]' + '-gcolumn-info[column info]' + '-gdwarf-aranges[DWARF aranges]' + '-gembed-source[embed source text in DWARF debug sections]' + '-gfull[emit debugging information for all symbols and types]' + {-G-,-G=-,-msmall-data-limit=,-msmall-data-threshold}'[put objects of at most size bytes into small data section]:size' + '-ggnu-pubnames[gnu pubnames]' + '-ginline-line-tables[inline line tables]' + '-gline-directives-only[emit debug line info directives only]' + '-gline-tables-only[line tables only]' + '-glldb[lldb]' + '-gmlt[emit debug line number tables only]' + '-gmodules[generate debug info with external references]' + '-gno-column-info[no column info]' + '-gno-embed-source[no embed source]' + '-gno-gnu-pubnames[no gnu pubnames]' + '-gno-inline-line-tables[no inline line tables]' + '-gno-record-command-line[no record command line]' + '--gpu-instrument-lib=[instrument device library for HIP]:argument' + '--gpu-max-threads-per-block=[default max threads per block for kernel launch bounds for HIP]' + '-grecord-command-line[record command line]' + '-gsce[sce]' + '-gused[emit debugging information for symbols that are used]' + '-gz=[DWARF debug sections compression type]::arg' + '-headerpad_max_install_names[headerpad max install names]:argument' + '-help[display this information]' + '--help-hidden[display help for hidden options]' + '--hip-device-lib=[hIP device library]:arg' + '--hip-device-lib-path=[hip device lib path]:arg' + '--hip-link[link clang-offload-bundler bundles for HIP]' + '--hip-version=[HIP version in the format of major.minor.patch]' + '-ibuiltininc[enable builtin #include directories even when -nostdinc is used before or after -ibuiltininc]' + '-iframework[add directory to SYSTEM framework search path]:directory:_files -/' + '-iframeworkwithsysroot[add directory to SYSTEM framework search path, absolute paths are relative to -isysroot]:directory:_files -/' + '-image_base[image base]:argument' + '-include-pch[include precompiled header file]:file:_files' + '-index-header-map[make the next included directory (-I or -F) an indexer header map]' + '-init[init]:arg' + '-install_name[install name]:arg' + '-integrated-as[integrated as]' + '-interface-stub-version=[interface stub version]:arg' + '-isystem-after[add directory to end of the SYSTEM include search path]:directory:_files -/' + '-ivfsoverlay[overlay the virtual filesystem described by file over the real file system]:arg' + '-iwithsysroot[add directory to SYSTEM include search path]:directory:_files -/' + '-J[this option specifies where to put .mod files for compiled modules]:arg' + '-keep_private_externs[keep private externs]' + '*-lazy_framework[lazy framework]:framework:->framework' + '*-lazy_library[lazy library]:arg' + '--ld-path=[ld path]:arg' + '--libomptarget-amdgcn-bc-path=[path to libomptarget-amdgcn bitcode library]:arg' + '--libomptarget-nvptx-bc-path=[path to libomptarget-nvptx bitcode library]:arg' + '--library-directory=[add directory to library search path]:directory:_files -/' + '-maix-struct-return[return all structs in memory]' + "-malign-branch-boundary=[specify the boundary's size to align branches]:size" + '-malign-branch=[specify types of branches to align]:arg' + '-mappletvos-version-min=[appletvos version min]:arg' + '-mappletvsimulator-version-min=[appletvsimulator version min]:arg' + '-mbackchain[link stack frames through backchain on System Z]' + '-mbig-endian[big endian]' + '-mbranches-within-32B-boundaries[align selected branches within 32-byte boundary]' + '-mbranch-protection=[enforce targets of indirect branches and function returns]:arg' + '-mcode-object-v3[legacy option to specify code object ABI V3]' + '-mcode-object-version=[specify code object ABI version]:version' + '-mconsole[console]:arg' + '-mcrc[allow use of CRC instructions]' + '-mdefault-build-attributes[default build attributes]:arg' + '-mdll[dll]:arg' + '-mdouble=[force double to be 32 bits or 64 bits]:arg' + '-mdynamic-no-pic[dynamic no pic]:arg' + '-meabi[set EABI type]:arg' + '-menable-experimental-extensions[enable use of experimental RISC-V extensions]' + '-menable-unsafe-fp-math[allow unsafe floating-point math optimizations which may decrease precision]' + '-mfix-cortex-a53-835769[workaround Cortex-A53 erratum 835769]' + '-mfloat-abi=[float abi]:arg' + '-mfpu=[fpu]:arg' + '-mglobal-merge[enable merging of globals]' + '-mharden-sls=[select straight-line speculation hardening scope]:arg' + '--mhwdiv=[hwdiv]:arg' + '-mhwdiv=[hwdiv]:arg' + '-mhwmult=[hwmult]:arg' + '-mignore-xcoff-visibility[do not emit the visibility attribute for asm]' + '--migrate[run the migrator]' + '-mimplicit-float[implicit float]' + '-mimplicit-it=[implicit it]:arg' + '-mincremental-linker-compatible[emit an object file which can be used with an incremental linker]' + '-mios-simulator-version-min=[ios simulator version min]:arg' + '-mios-version-min=[ios version min]:arg' + '-miphoneos-version-min=[iphoneos version min]:arg' + '-miphonesimulator-version-min=[iphonesimulator version min]:arg' + '-mkernel[kernel]' + '-mlinker-version=[linker version]:arg' + '-mlittle-endian[little endian]' + "-mllvm[additional arguments to forward to LLVM's option processing]:arg" + '-mlong-calls[generate branches with extended addressability]' + '-mlvi-cfi[enable only control-flow mitigations for Load Value Injection]' + '-mlvi-hardening[enable all mitigations for Load Value Injection]' + '-mmacos-version-min=[set Mac OS X deployment target]:arg' + '-mmacosx-version-min=[macosx version min]:arg' + '-mmcu=[mcu]:arg' + '-module-dependency-dir[directory to dump module dependencies to]:arg' + '-module-dir[odule dir]:dir' + '-module-file-info[provide information about a particular module file]' + '-moslib=[oslib]:arg' + '-moutline-atomics[generate local calls to out-of-line atomic operations]' + '-mpacked-stack[use packed stack layout]' + '-mpad-max-prefix-size=[specify maximum number of prefixes to use for padding]:arg' + '-mpie-copy-relocations[pie copy relocations]' + '-mprefer-vector-width=[specifies preferred vector width]:arg' + '-mqdsp6-compat[enable hexagon-qdsp6 backward compatibility]' + '-mrelax-all[relax all machine instructions]' + '-mrelax[enable linker relaxation]' + '-mretpoline[retpoline]' + '-mseses[enable speculative execution side effect suppression (SESES)]' + '-msign-return-address=[select return address signing scope]:arg' + '-msim[sim]' + '-mspeculative-load-hardening[speculative load hardening]' + '-mstack-alignment=[set the stack alignment]:arg' + '-mstack-probe-size=[set the stack probe size]:size' + '-mstack-protector-guard-offset=[use the given offset for addressing the stack-protector guard]:arg' + '-mstack-protector-guard-reg=[use the given reg for addressing the stack-protector guard]:reg' + '-msvr4-struct-return[return small structs in registers]' + '-mthread-model[the thread model to use]:arg' + '-mthumb[thumb]' + '-mtls-size=[specify bit size of immediate TLS offsets]:arg' + '-mtvos-simulator-version-min=[tvos simulator version min]:arg' + '-mtvos-version-min=[tvos version min]:arg' + '-multi_module[multi module]' + '-multiply_defined[multiply defined]:arg' + '-multiply_defined_unused[multiply defined unused]:arg' + '-municode[unicode]:arg' + '-munsafe-fp-atomics[enable unsafe floating point atomic instructions]' + '-mv55[equivalent to -mcpu=hexagonv55]' + '-mv5[equivalent to -mcpu=hexagonv5]' + '-mv60[equivalent to -mcpu=hexagonv60]' + '-mv62[equivalent to -mcpu=hexagonv62]' + '-mv65[equivalent to -mcpu=hexagonv65]' + '-mv66[equivalent to -mcpu=hexagonv66]' + '-mv67[equivalent to -mcpu=hexagonv67]' + '-mv67t[equivalent to -mcpu=hexagonv67t]' + '-mv68[equivalent to -mcpu=hexagonv68]' + '-mvx[vx]' + '-mwarn-nonportable-cfstrings[warn nonportable cfstrings]' + '-mwatchos-simulator-version-min=[watchos simulator version min]:arg' + '-mwatchos-version-min=[watchos version min]:arg' + '-mwatchsimulator-version-min=[watchsimulator version min]:arg' + '-mwavefrontsize64[specify wavefront size 64 mode]' + '-mwindows[windows]:arg' + '-mzvector[zvector]' + '-nobuiltininc[do not search builtin directory for include files]' + '-nocpp[no cpp]' + '-nocudainc[do not add include paths for CUDA/HIP and do not include the default CUDA/HIP wrapper headers]' + '*--no-cuda-include-ptx=[do not include ptx for the following gpu architecture]:argument' + '-nocudalib[do not link device library for CUDA/HIP device compilation]' + '--no-cuda-noopt-device-debug[disable device-side debug info generation]' + "--no-cuda-version-check[don't error out if the detected version of the CUDA install is too low for the requested CUDA gpu architecture]" + '-no_dead_strip_inits_and_terms[no dead strip inits and terms]' + '-nofixprebinding[no fixprebinding]' + '-nogpuinc[no gpuinc]' + '-nogpulib[no gpulib]' + '--no-integrated-cpp[no integrated cpp]' + '-no-integrated-cpp[no integrated cpp]' + '-nolibc[no libc]' + '-nomultidefs[no multidefs]' + '--no-offload-arch=[no offload arch]:arg' + '-no-pie[no pie]' + '-nopie[no pie]' + '-noprebind[no prebind]' + '-noprofilelib[no profilelib]' + '-no-pthread[no pthread]' + '-noseglinkedit[no seglinkedit]' + '--no-standard-libraries[no standard libraries]' + '-nostdinc\+\+[disable standard #include directories for the C++ standard library]' + '-nostdlibinc[do not search standard system directories for include files]' + '-nostdlib\+\+[no stdlib++]' + '--no-system-header-prefix=[no system header prefix]:prefix' + '--no-undefined[no undefined]' + '-objcmt-atomic-property[make migration to atomic properties]' + '-objcmt-migrate-all[enable migration to modern ObjC]' + '-objcmt-migrate-annotation[enable migration to property and method annotations]' + '-objcmt-migrate-designated-init[enable migration to infer NS_DESIGNATED_INITIALIZER for initializer methods]' + '-objcmt-migrate-instancetype[enable migration to infer instancetype for method result type]' + '-objcmt-migrate-literals[enable migration to modern ObjC literals]' + '-objcmt-migrate-ns-macros[enable migration to NS_ENUM/NS_OPTIONS macros]' + '-objcmt-migrate-property-dot-syntax[enable migration of setter/getter messages to property-dot syntax]' + '-objcmt-migrate-property[enable migration to modern ObjC property]' + '-objcmt-migrate-protocol-conformance[enable migration to add protocol conformance on classes]' + '-objcmt-migrate-readonly-property[enable migration to modern ObjC readonly property]' + '-objcmt-migrate-readwrite-property[enable migration to modern ObjC readwrite property]' + '-objcmt-migrate-subscripting[enable migration to modern ObjC subscripting]' + "-objcmt-ns-nonatomic-iosonly[enable migration to use NS_NONATOMIC_IOSONLY macro for setting property's atomic attribute]" + '-objcmt-returns-innerpointer-property[enable migration to annotate property with NS_RETURNS_INNER_POINTER]' + '-objcmt-whitelist-dir-path=[objcmt whitelist dir path]:arg' + '-objcmt-white-list-dir-path=[only modify files with a filename contained in the provided directory path]:arg' + '-ObjC[treat source files as Objective-C]' + '-ObjC\+\+[treat source files as Objective-C++]' + '-object[object]' + '--offload-arch=[offload arch]:arg' + '--output-class-directory=[output class directory]:arg' + '-pagezero_size[pagezero size]:arg' + '-pg[enable mcount instrumentation]' + {-p,--profile}'[enable function profiling for prof]' + '-prebind_all_twolevel_modules[prebind all twolevel modules]' + '-prebind[prebind]' + '--precompile[only precompile the input]' + '-preload[preload]' + '--print-diagnostic-categories[print diagnostic categories]' + '-print-effective-triple[print effective triple]' + '--print-effective-triple[print the effective target triple]' + '--print-file-name=[print the full library path of <file>]:file:_files' + '-print-ivar-layout[enable Objective-C Ivar layout bitmap print trace]' + '--print-libgcc-file-name[print the library path for the currently used compiler runtime library]' + '--print-multi-directory[print multi directory]' + '--print-multi-lib[print multi lib]' + '--print-prog-name=[print the full program path of <name>]:name' + '-print-resource-dir[print resource dir]' + '--print-resource-dir[print the resource directory pathname]' + '--print-search-dirs[print the paths used for finding libraries and programs]' + '--print-supported-cpus[print supported cpus]' + '-print-supported-cpus[print supported cpus]' + '-print-targets[print targets]' + '--print-targets[print the registered targets]' + '-print-target-triple[print target triple]' + '--print-target-triple[print the normalized target triple]' + '-private_bundle[private bundle]' + '--profile-blocks[undocumented option]' + '-pthreads[pthreads]' + '-pthread[support POSIX threads in generated code]' + '--ptxas-path=[path to ptxas (used for compiling CUDA code)]:arg' + "-Qunused-arguments[don't emit warning for unused driver arguments]" + '-read_only_relocs[read only relocs]:arg' + '-relocatable-pch[relocatable pch]' + '--relocatable-pch[whether to build a relocatable precompiled header]' + '-R[enable the specified remark]:remark' + '--resource=[resource]:arg' + '-rewrite-legacy-objc[rewrite Legacy Objective-C source to C++]' + '-rewrite-objc[rewrite Objective-C source to C++]' + '--rocm-device-lib-path=[rOCm device library path]:arg' + '--rocm-path=[rOCm installation path]:arg' + '-Rpass-analysis=[report transformation analysis from optimization passes]:regex' + '-Rpass-missed=[report missed transformations by optimization passes]:arg' + '-Rpass=[report transformations performed by optimization passes]:arg' + '-rpath[rpath]:arg' + '-r[product a relocatable object as output]' + '--rtlib=[compiler runtime library to use]:arg' + '-rtlib=[rtlib]:arg' + '--save-stats=[save llvm statistics]:arg' + '-sectalign[sectalign]:arg' + '-sectcreate[sectcreate]:arg' + '-sectobjectsymbols[sectobjectsymbols]:arg' + '-sectorder[sectorder]:arg' + '-seg1addr[seg1addr]:arg' + '-segaddr[segaddr]:arg' + '-seg_addr_table_filename[seg addr table filename]:arg' + '-seg_addr_table[seg addr table]:arg' + '-segcreate[segcreate]:arg' + '-seglinkedit[seglinkedit]' + '-segprot[segprot]:arg' + '-segs_read_only_addr[segs read only addr]:arg' + '-segs_read_[segs read]:arg' + '-segs_read_write_addr[segs read write addr]:arg' + '--serialize-diagnostics[serialize compiler diagnostics to a file]:arg' + '-serialize-diagnostics[serialize diagnostics]:arg' + '-shared-libasan[dynamically link the sanitizer runtime]' + '-shared-libsan[shared libsan]' + '--shared[shared]' + '--signed-char[signed char]' + '-single_module[single module]' + '--specs=[specs]:arg' + '-static-libgfortran[static libgfortran]' + '-static-libsan[statically link the sanitizer runtime]' + '-static-libstdc\+\+[static libstdc++]' + '-static-openmp[use the static host OpenMP runtime while linking.]' + '-static-pie[static pie]' + '--static[static]' + '-std-default=[std default]:arg' + '--stdlib=[c++ standard library to use]:arg' + '-stdlib\+\+-isystem[use directory as the C++ standard library include path]:directory:_files -/' + '-stdlib=[stdlib]:arg' + '-sub_library[sub library]:arg' + '-sub_umbrella[sub umbrella]:arg' + '-sycl-std=[SYCL language standard to compile for]:standard' + '--system-header-prefix=[treat all #include paths starting with <prefix> as including a system header]:prefix' + '-target[generate code for the given target]:arg' + '--target=[target]:arg' + '-Tbss[set starting address of BSS to <addr>]:addr' + '-Tdata[set starting address of DATA to <addr>]:addr' + '--traditional[traditional]' + '-traditional[traditional]' + '-Ttext[set starting address of TEXT to <addr>]:addr' + '-t[undocumented option]' + '-twolevel_namespace_hints[twolevel namespace hints]' + '-twolevel_namespace[twolevel namespace]' + '-umbrella[umbrella]:arg' + '-undefined[undefined]:arg' + '-unexported_symbols_list[unexported symbols list]:arg' + '--unsigned-char[unsigned char]' + '--unwindlib=[unwind library to use]:arg' + '-unwindlib=[unwindlib]:arg' + '--verify-debug-info[verify the binary representation of debug output]' + '-verify-pch[load and verify that a pre-compiled header file is not stale]' + '--warn-=-[enable the specified warning]:warning:->warning' + '*-weak_framework[weak framework]:framework:->framework' + '*-weak_library[weak library]:arg' + '-weak-l[weak l]:arg' + '-weak_reference_mismatches[weak reference mismatches]:arg' + '-whatsloaded[whatsloaded]' + '-whyload[whyload]' + '-working-directory=[resolve file paths relative to the specified directory]:arg' + '-Xanalyzer[pass <arg> to the static analyzer]:arg' + '-Xarch_device[pass arg to CUDA/HIP device compilation]:argument' + '-Xarch_host[pass arg to CUDA/HIP host compilation]:argument' + '-Xclang[pass <arg> to the clang compiler]:arg' + '-Xcuda-fatbinary[pass arg to fatbinary invocation]:argument' + '-Xcuda-ptxas[pass arg to the ptxas assemler]:argument' + '-Xflang[pass <arg> to the flang compiler]:arg' + '-Xopenmp-target[pass arg to the the target offloading toolchain]:argument' + '-y[the action to perform on the input]:arg' + '-Z-[undocumented option]:argument' + ) else - args+=( - '-flto=-[Enable link-time optimization]::jobs:' - '*--help=-[Display this information]:class:->help' - ) + args+=( + '--dump=[dump information]:argument' + '-flto=-[enable link-time optimization]::jobs:' + '*--help=-[display this information]:class:->help' + ) fi local -a sanitizers - sanitizers=( - address alignment bool bounds enum float-cast-overflow float-divide-by-zero - integer-divide-by-zero memory nonnull-attribute null nullability-arg nullability-assign - nullability-return object-size pointer-overflow return unsigned-integer-overflow - returns-nonnull-attribute shift signed-integer-overflow unreachable vla-bound vptr - ) +sanitizers=( + address alignment bool bounds enum float-cast-overflow float-divide-by-zero + integer-divide-by-zero memory nonnull-attribute null nullability-arg + nullability-assign nullability-return object-size pointer-overflow return + unsigned-integer-overflow returns-nonnull-attribute shift signed-integer-overflow + unreachable vla-bound vptr +) local -a languages languages=( - c c-header cpp-output - c++ c++-header c++-cpp-output - objective-c objective-c-header objective-c-cpp-output - objective-c++ objective-c++-header objective-c++-cpp-output - assembler assembler-with-cpp - ada - f77 f77-cpp-input f95 f95-cpp-input - go - java - brig - none -) - -# generic options (from --help) -args+=( - '-###[print commands to run this compilation]' - '-o:output file:_files -g "^*.(c|h|cc|C|cxx)(-.)"' - '-x[Specify the language of the following input files]:input file language:('"$languages"')' - '+e-:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))' - '-d-:dump:->dump' - '-g-::debugging information type or level:(0 1 2 3 gdb coff stabs stabs+ dwarf dwarf+ dwarf-2 dwarf-3 dwarf-4 xcoff xcoff+)' - '-O-::optimization level:((0 1 2 3 g\:optimize\ for\ debugging\ experience s\:optimize\ for\ space fast\:optimize\ for\ speed\ disregarding\ exact\ standards\ compliance))' - '*-M-::output dependencies:((M\:only\ user\ header\ files MD\:output\ to\ file G\:treat\ missing\ header\ files\ as\ generated))' - '*-A-:define assertion:' - '*-D-:define macro:' - '*-U-:undefine macro:' - '-C[do not discard comments during preprocess]' - '-CC[do not discard comments, including macro expansion]' - '-P[inhibit generation of linkemakers during preprocess]' - '-H[print name of each header file used]' - '-E[Preprocess only; do not compile, assemble or link]' - '-S[Compile only; do not assemble or link]' - '-c[Compile and assemble, but do not link]' - '*-Wp,-:preprocessor option:' - '*-Wl,-:linker option:' - '*-Xpreprocessor:preprocessor option:' - '*-Xlinker:linker option:' - '*-Xassembler:assembler option:' - '*-u:pretend symbol to be undefined:' - '*-Wa,-:assembler option:' - '*-l:library:->library' - '*-L-:library search path:_files -/' - '*-I-:header file search path:_files -/' - '-B-[Add <prefix> to the compiler'\''s search paths]:executable prefix:_files -/' - '-b:target machine:' - '-V:specify compiler version:' - '--version[Display compiler version information]' - '-print-file-name=-[Display the full path to library <library>]:library:->library' - '-print-prog-name=-[Display the full path to compiler component <program>]:program:' - '*-specs=-[Override built-in specs with the contents of <file>]:file:_files' - '-std=-[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899\:1990 iso9899\:199409 c99 iso9899\:1999 c11 iso9899\:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899\:2017 gnu++17 c++2a gnu++2a)' - '*-include:include file:_files -g \*.h\(-.\)' - '*-imacros:macro input file:_files -g \*.h\(-.\)' - '*-idirafter:second include path directory:_files -/' - '*-iprefix:prefix:_files' - '*-iwithprefix:second include path directory:_files -/' - '*-iwithprefixbefore:main include path directory:_files -/' - '*-isystem:second include path directory (system):_files -/' - '--sysroot=-[Use <directory> as the root directory for headers and libraries]:directory:_files -/' - '-pass-exit-codes[Exit with highest error code from a phase]' - '--target-help[Display target specific command line options]' - '-dumpspecs[Display all of the built in spec strings]' - '-dumpversion[Display the version of the compiler]' - '-dumpmachine[Display the compiler'\''s target processor]' - '-print-search-dirs[Display the directories in the compiler'\''s search path]' - '-print-libgcc-file-name[Display the name of the compiler'\''s companion library]' - '-print-multiarch[Display the target'\''s normalized GNU triplet, used as a component in the library path]' - '-print-multi-directory[Display the root directory for versions of libgcc]' - '-print-multi-lib[Display the mapping between command line options and multiple library search directories]' - '-print-multi-os-directory[Display the relative path to OS libraries]' - '-print-sysroot[Display the target libraries directory]' - '-print-sysroot-headers-suffix[Display the sysroot suffix used to find headers]' - '-save-stats=-[Save code generation statistics]:location:(cwd obj)' - '-save-temps[Do not delete intermediate files]' - '-no-canonical-prefixes[Do not canonicalize paths when building relative prefixes to other gcc components]' - '-pipe[Use pipes rather than intermediate files]' - '-pie[Create a position independent executable]' - '-shared[Create a shared library]' - '-time[Time the execution of each subprocess]' + c c-header cpp-output c++ c++-header c++-cpp-output objective-c objective-c-header + objective-c-cpp-output objective-c++ objective-c++-header objective-c++-cpp-output + assembler assembler-with-cpp ada f77 f77-cpp-input f95 f95-cpp-input go java + brig none ) # warnings (from --help=warnings), note some -W options are listed by --help=common instead -args+=( -# --help=warnings,^joined - '-W[This switch is deprecated; use -Wextra instead]' - '-Wabi-tag[Warn if a subobject has an abi_tag attribute that the complete object type does not have]' - '-Wabi[Warn about things that will change when compiling with an ABI-compliant compiler]' - '-Waddress[Warn about suspicious uses of memory addresses]' - '-Waggregate-return[Warn about returning structures, unions or arrays]' - '-Waggressive-loop-optimizations[Warn if a loop with constant number of iterations triggers undefined behavior]' - '-Waliasing[Warn about possible aliasing of dummy arguments]' - '-Walign-commons[Warn about alignment of COMMON blocks]' - '-Wall[Enable most warning messages]' - '-Walloc-zero[Warn for calls to allocation functions that specify zero bytes]' - '-Walloca[Warn on any use of alloca]' - '-Wampersand[Warn about missing ampersand in continued character constants]' - '-Wargument-mismatch[Warn about type and rank mismatches between arguments and parameters]' - '-Warray-bounds[Warn if an array is accessed out of bounds]' - '-Warray-temporaries[Warn about creation of array temporaries]' - '-Wassign-intercept[Warn whenever an Objective-C assignment is being intercepted by the garbage collector]' - '-Wattributes[Warn about inappropriate attribute usage]' - '-Wbad-function-cast[Warn about casting functions to incompatible types]' - '-Wbool-compare[Warn about boolean expression compared with an integer value different from true/false]' - '-Wbool-operation[Warn about certain operations on boolean expressions]' - '-Wbuiltin-declaration-mismatch[Warn when a built-in function is declared with the wrong signature]' - '-Wbuiltin-macro-redefined[Warn when a built-in preprocessor macro is undefined or redefined]' - '-Wc++-compat[Warn about C constructs that are not in the common subset of C and C++]' - '-Wc++0x-compat[Deprecated in favor of -Wc++11-compat]' - '-Wc++1z-compat[Warn about C++ constructs whose meaning differs between ISO C++ 2014 and (forthcoming) ISO C++ 201z(7?)]' - '-Wc++11-compat[Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011]' - '-Wc++14-compat[Warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014]' - '-Wc-binding-type[Warn if the type of a variable might be not interoperable with C]' - '-Wc90-c99-compat[Warn about features not present in ISO C90, but present in ISO C99]' - '-Wc99-c11-compat[Warn about features not present in ISO C99, but present in ISO C11]' - '-Wcast-align[Warn about pointer casts which increase alignment]' - '-Wcast-qual[Warn about casts which discard qualifiers]' - '-Wchar-subscripts[Warn about subscripts whose type is "char"]' - '-Wcharacter-truncation[Warn about truncated character expressions]' - '-Wchkp[Warn about memory access errors found by Pointer Bounds Checker]' - '-Wclobbered[Warn about variables that might be changed by "longjmp" or "vfork"]' - '-Wcomment[Warn about possibly nested block comments, and C++ comments spanning more than one physical line]' - '-Wcomments[Synonym for -Wcomment]' - '-Wcompare-reals[Warn about equality comparisons involving REAL or COMPLEX expressions]' - '-Wconditionally-supported[Warn for conditionally-supported constructs]' - '-Wconversion-extra[Warn about most implicit conversions]' - '-Wconversion-null[Warn for converting NULL from/to a non-pointer type]' - '-Wconversion[Warn for implicit type conversions that may change a value]' - '-Wcoverage-mismatch[Warn in case profiles in -fprofile-use do not match]' - '-Wcpp[Warn when a #warning directive is encountered]' - '-Wctor-dtor-privacy[Warn when all constructors and destructors are private]' - '-Wdangling-else[Warn about dangling else]' - '-Wdate-time[Warn about __TIME__, __DATE__ and __TIMESTAMP__ usage]' - '-Wdeclaration-after-statement[Warn when a declaration is found after a statement]' - '-Wdelete-incomplete[Warn when deleting a pointer to incomplete type]' - '-Wdelete-non-virtual-dtor[Warn about deleting polymorphic objects with non- virtual destructors]' - '-Wdeprecated-declarations[Warn about uses of __attribute__((deprecated)) declarations]' - '-Wdeprecated[Warn if a deprecated compiler feature, class, method, or field is used]' - '-Wdesignated-init[Warn about positional initialization of structs requiring designated initializers]' - '-Wdisabled-optimization[Warn when an optimization pass is disabled]' - '-Wdiscarded-array-qualifiers[Warn if qualifiers on arrays which are pointer targets are discarded]' - '-Wdiscarded-qualifiers[Warn if type qualifiers on pointers are discarded]' - '-Wdiv-by-zero[Warn about compile-time integer division by zero]' - '-Wdouble-promotion[Warn about implicit conversions from "float" to "double"]' - '-Weffc\+\+[Warn about violations of Effective C++ style rules]' - '-Wduplicate-decl-specifier[Warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier]' - '-Wduplicated-branches[Warn about duplicated branches in if-else statements]' - '-Wduplicated-cond[Warn about duplicated conditions in an if-else-if chain]' - '-Weffc++[Warn about violations of Effective C++ style rules]' - '-Wempty-body[Warn about an empty body in an if or else statement]' - '-Wendif-labels[Warn about stray tokens after #else and #endif]' - '-Wenum-compare[Warn about comparison of different enum types]' -#this still exists but makes completing -Werror= less convenient - #'-Werror-implicit-function-declaration[This switch is deprecated; use -Werror=implicit-fun - '-Wexpansion-to-defined[Warn if "defined" is used outside #if]' - '-Wextra[Print extra (possibly unwanted) warnings]' - '-Wfloat-conversion[Warn for implicit type conversions that cause loss of floating point precision]' - '-Wfloat-equal[Warn if testing floating point numbers for equality]' - '-Wformat-contains-nul[Warn about format strings that contain NUL bytes]' - '-Wformat-extra-args[Warn if passing too many arguments to a function for its format string]' - '-Wformat-nonliteral[Warn about format strings that are not literals]' - '-Wformat-overflow[Warn about function calls with format strings that write past the end of the destination region]' - '-Wformat-security[Warn about possible security problems with format functions]' - '-Wformat-signedness[Warn about sign differences with format functions]' - '-Wformat-truncation[Warn about calls to snprintf and similar functions that truncate output. Same as -Wformat- truncation=1. Same as -Wformat-truncation=]' - '-Wformat-y2k[Warn about strftime formats yielding 2-digit years]' - '-Wformat-zero-length[Warn about zero-length formats]' - '-Wformat[Warn about printf/scanf/strftime/strfmon format string anomalies]' - '-Wframe-address[Warn when __builtin_frame_address or __builtin_return_address is used unsafely]' - '-Wfree-nonheap-object[Warn when attempting to free a non-heap object]' - '-Wfunction-elimination[Warn about function call elimination]' - '-Whsa[Warn when a function cannot be expanded to HSAIL]' - '-Wignored-attributes[Warn whenever attributes are ignored]' - '-Wignored-qualifiers[Warn whenever type qualifiers are ignored]' - '-Wimplicit-function-declaration[Warn about implicit function declarations]' - '-Wimplicit-int[Warn when a declaration does not specify a type]' - '-Wimplicit-interface[Warn about calls with implicit interface]' - '-Wimplicit-procedure[Warn about called procedures not explicitly declared]' - '-Wimplicit[Warn about implicit declarations]' - '-Wincompatible-pointer-types[Warn when there is a conversion between pointers that have incompatible types]' - '-Winherited-variadic-ctor[Warn about C++11 inheriting constructors when the base has a variadic constructor]' - '-Winit-self[Warn about variables which are initialized to themselves]' - '-Winline[Warn when an inlined function cannot be inlined]' - '-Wint-conversion[Warn about incompatible integer to pointer and pointer to integer conversions]' - '-Wint-in-bool-context[Warn for suspicious integer expressions in boolean context]' - '-Wint-to-pointer-cast[Warn when there is a cast to a pointer from an integer of a different size]' - '-Winteger-division[Warn about constant integer divisions with truncated results]' - '-Wintrinsic-shadow[Warn if a user-procedure has the same name as an intrinsic]' - '-Wintrinsics-std[Warn on intrinsics not part of the selected standard]' - '-Winvalid-memory-model[Warn when an atomic memory model parameter is known to be outside the valid range]' - '-Winvalid-offsetof[Warn about invalid uses of the "offsetof" macro]' - '-Winvalid-pch[Warn about PCH files that are found but not used]' - '-Wjump-misses-init[Warn when a jump misses a variable initialization]' - '-Wline-truncation[Warn about truncated source lines]' - '-Wliteral-suffix[Warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore]' - '-Wlogical-not-parentheses[Warn when logical not is used on the left hand side operand of a comparison]' - '-Wlogical-op[Warn when a logical operator is suspiciously always evaluating to true or false]' - '-Wlong-long[Do not warn about using "long long" when -pedantic]' - '-Wlto-type-mismatch[During link time optimization warn about mismatched types of global declarations]' - '-Wmain[Warn about suspicious declarations of "main"]' - '-Wmaybe-uninitialized[Warn about maybe uninitialized automatic variables]' - '-Wmemset-elt-size[Warn about suspicious calls to memset where the third argument contains the number of elements not multiplied by the element size]' - '-Wmemset-transposed-args[Warn about suspicious calls to memset where the third argument is constant literal zero and the second is not]' - '-Wmisleading-indentation[Warn when the indentation of the code does not reflect the block structure]' - '-Wmissing-braces[Warn about possibly missing braces around initializers]' - '-Wmissing-declarations[Warn about global functions without previous declarations]' - '-Wmissing-field-initializers[Warn about missing fields in struct initializers]' - '-Wmissing-include-dirs[Warn about user-specified include directories that do not exist]' - '-Wmissing-parameter-type[Warn about function parameters declared without a type specifier in K&R-style functions]' - '-Wmissing-prototypes[Warn about global functions without prototypes]' - '-Wmudflap[Warn about constructs not instrumented by -fmudflap]' - '-Wmultichar[Warn about use of multi-character character constants]' - '-Wmultiple-inheritance[Warn on direct multiple inheritance]' - '-Wnamespaces[Warn on namespace definition]' - '-Wnarrowing[Warn about narrowing conversions within { } that are ill-formed in C++11]' - '-Wnested-externs[Warn about "extern" declarations not at file scope]' - '-Wnoexcept-type[Warn if C++1z noexcept function type will change the mangled name of a symbol]' - '-Wnoexcept[Warn when a noexcept expression evaluates to false even though the expression can''t actually throw]' - '-Wnon-template-friend[Warn when non-templatized friend functions are declared within a template]' - '-Wnon-virtual-dtor[Warn about non-virtual destructors]' - '-Wnonnull-compare[Warn if comparing pointer parameter with nonnull attribute with NULL]' - '-Wnonnull[Warn about NULL being passed to argument slots marked as requiring non-NULL]' - '-Wnull-dereference[Warn if dereferencing a NULL pointer may lead to erroneous or undefined behavior]' - '-Wodr[Warn about some C++ One Definition Rule violations during link time optimization]' - '-Wold-style-cast[Warn if a C-style cast is used in a program]' - '-Wold-style-declaration[Warn for obsolescent usage in a declaration]' - '-Wold-style-definition[Warn if an old-style parameter definition is used]' - '-Wopenmp-simd[Warn if a simd directive is overridden by the vectorizer cost model]' - '-Woverflow[Warn about overflow in arithmetic expressions]' - '-Woverlength-strings[Warn if a string is longer than the maximum portable length specified by the standard]' - '-Woverloaded-virtual[Warn about overloaded virtual function names]' - '-Woverride-init-side-effects[Warn about overriding initializers with side effects]' - '-Woverride-init[Warn about overriding initializers without side effects]' - '-Wpacked-bitfield-compat[Warn about packed bit-fields whose offset changed in GCC 4.4]' - '-Wpacked[Warn when the packed attribute has no effect on struct layout]' - '-Wpadded[Warn when padding is required to align structure members]' - '-Wparentheses[Warn about possibly missing parentheses]' - '-Wpedantic[Issue warnings needed for strict compliance to the standard]' - '-Wplacement-new[Warn for placement new expressions with undefined behavior. Same as -Wplacement-new=]' - '-Wpmf-conversions[Warn when converting the type of pointers to member functions]' - '-Wpointer-arith[Warn about function pointer arithmetic]' - '-Wpointer-compare[Warn when a pointer is compared with a zero character constant]' - '-Wpointer-sign[Warn when a pointer differs in signedness in an assignment]' - '-Wpointer-to-int-cast[Warn when a pointer is cast to an integer of a different size]' - '-Wpoison-system-directories[Warn for -I and -L options using system directories if cross compiling]' - '-Wpragmas[Warn about misuses of pragmas]' - '-Wproperty-assign-default[Warn if a property for an Objective-C object has no assign semantics specified]' - '-Wprotocol[Warn if inherited methods are unimplemented]' - '-Wreal-q-constant[Warn about real-literal-constants with '\'q\'' exponent-letter]' - '-Wrealloc-lhs-all[Warn when a left-hand-side variable is reallocated]' - '-Wrealloc-lhs[Warn when a left-hand-side array variable is reallocated]' - '-Wredundant-decls[Warn about multiple declarations of the same object]' - '-Wregister[Warn about uses of register storage specifier]' - '-Wreorder[Warn when the compiler reorders code]' - '-Wrestrict[Warn when an argument passed to a restrict- qualified parameter aliases with another argument]' - '-Wreturn-local-addr[Warn about returning a pointer/reference to a local or temporary variable]' - '-Wreturn-type[Warn whenever a function'\''s return type defaults to "int" (C), or about inconsistent return types (C++)]' - '-Wscalar-storage-order[Warn on suspicious constructs involving reverse scalar storage order]' - '-Wselector[Warn if a selector has multiple methods]' - '-Wsequence-point[Warn about possible violations of sequence point rules]' - '-Wshadow-ivar[Warn if a local declaration hides an instance variable]' - '-Wshadow[Warn when one variable shadows another. Same as -Wshadow=global]' - '-Wshift-count-negative[Warn if shift count is negative]' - '-Wshift-count-overflow[Warn if shift count >= width of type]' - '-Wshift-negative-value[Warn if left shifting a negative value]' - '-Wshift-overflow[Warn if left shift of a signed value overflows. Same as -Wshift-overflow=]' - '-Wsign-compare[Warn about signed-unsigned comparisons]' - '-Wsign-conversion[Warn for implicit type conversions between signed and unsigned integers]' - '-Wsign-promo[Warn when overload promotes from unsigned to signed]' - '-Wsized-deallocation[Warn about missing sized deallocation functions]' - '-Wsizeof-array-argument[Warn when sizeof is applied on a parameter declared as an array]' - '-Wsizeof-pointer-memaccess[Warn about suspicious length parameters to certain string functions if the argument uses sizeof]' - '-Wstack-protector[Warn when not issuing stack smashing protection for some reason]' - '-Wstrict-aliasing[Warn about code which might break strict aliasing rules]' - '-Wstrict-null-sentinel[Warn about uncasted NULL used as sentinel]' - '-Wstrict-overflow[Warn about optimizations that assume that signed overflow is undefined]' - '-Wstrict-prototypes[Warn about unprototyped function declarations]' - '-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]' +warnings+=( + '-Wabi-tag[warn if a subobject has an abi_tag attribute that the complete object type does not have]' + '-Wabi[warn about things that will change when compiling with an ABI-compliant compiler]::' + '-Waddress[warn about suspicious uses of memory addresses]' + '-Waggregate-return[warn about returning structures, unions or arrays]' + '-Waggressive-loop-optimizations[warn if a loop with constant number of iterations triggers undefined behavior]' + '-Waliasing[warn about possible aliasing of dummy arguments]' + '-Walign-commons[warn about alignment of COMMON blocks]' + '-Waligned-new=[warn even if '\'new\'' uses a class member allocation function]:none|global|all: ' + '-Wall[enable most warning messages]' + '-Walloca-larger-than=[warn on unbounded uses of alloca, and on bounded uses of alloca whose bound can be larger than <number> bytes]:bytes: ' + '-Walloca[warn on any use of alloca]' + '-Walloc-size-larger-than=[warn for calls to allocation functions that attempt to allocate objects larger than the specified number of bytes]:bytes: ' + '-Walloc-zero[warn for calls to allocation functions that specify zero bytes]' + '-Wampersand[warn about missing ampersand in continued character constants]' + '-Wargument-mismatch[warn about type and rank mismatches between arguments and parameters]' + '-Warray-bounds[warn if an array is accessed out of bounds]' + '-Warray-bounds=[warn if an array is accessed out of bounds]:level:(1 2)' + '-Warray-temporaries[warn about creation of array temporaries]' + '-Wassign-intercept[warn whenever an Objective-C assignment is being intercepted by the garbage collector]' + '-Wattributes[warn about inappropriate attribute usage]' + '-Wbad-function-cast[warn about casting functions to incompatible types]' + '-Wbool-compare[warn about boolean expression compared with an integer value different from true/false]' + '-Wbool-operation[warn about certain operations on boolean expressions]' + '-Wbuiltin-declaration-mismatch[warn when a built-in function is declared with the wrong signature]' + '-Wbuiltin-macro-redefined[warn when a built-in preprocessor macro is undefined or redefined]' + '-Wc++0x-compat[deprecated in favor of -Wc++11-compat]' + '-Wc++11-compat[warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011]' + '-Wc++14-compat[warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014]' + '-Wc++1z-compat[warn about C++ constructs whose meaning differs between ISO C++ 2014 and (forthcoming) ISO C++ 201z(7?)]' + '-Wc90-c99-compat[warn about features not present in ISO C90, but present in ISO C99]' + '-Wc99-c11-compat[warn about features not present in ISO C99, but present in ISO C11]' + '-Wcast-align[warn about pointer casts which increase alignment]' + '-Wcast-qual[warn about casts which discard qualifiers]' + '-Wc-binding-type[warn if the type of a variable might be not interoperable with C]' + '-Wc++-compat[warn about C constructs that are not in the common subset of C and C++]' + '-Wcharacter-truncation[warn about truncated character expressions]' + '-Wchar-subscripts[warn about subscripts whose type is "char"]' + '-Wchkp[warn about memory access errors found by Pointer Bounds Checker]' + '-Wclobbered[warn about variables that might be changed by "longjmp" or "vfork"]' + '-Wcomments[synonym for -Wcomment]' + '-Wcomment[warn about possibly nested block comments, and C++ comments spanning more than one physical line]' + '-Wcompare-reals[warn about equality comparisons involving REAL or COMPLEX expressions]' + '-Wconditionally-supported[warn for conditionally-supported constructs]' + '-Wconversion-extra[warn about most implicit conversions]' + '-Wconversion-null[warn for converting NULL from/to a non-pointer type]' + '-Wconversion[warn for implicit type conversions that may change a value]' + '-Wcoverage-mismatch[warn in case profiles in -fprofile-use do not match]' + '-Wcpp[warn when a #warning directive is encountered]' + '-Wctor-dtor-privacy[warn when all constructors and destructors are private]' + '-Wdangling-else[warn about dangling else]' + '-Wdate-time[warn about __TIME__, __DATE__ and __TIMESTAMP__ usage]' + '-Wdeclaration-after-statement[warn when a declaration is found after a statement]' + '-Wdelete-incomplete[warn when deleting a pointer to incomplete type]' + '-Wdelete-non-virtual-dtor[warn about deleting polymorphic objects with non- virtual destructors]' + '-Wdeprecated-declarations[warn about uses of __attribute__((deprecated)) declarations]' + '-Wdeprecated[warn if a deprecated compiler feature, class, method, or field is used]' + '-Wdesignated-init[warn about positional initialization of structs requiring designated initializers]' + '-Wdisabled-optimization[warn when an optimization pass is disabled]' + '-Wdiscarded-array-qualifiers[warn if qualifiers on arrays which are pointer targets are discarded]' + '-Wdiscarded-qualifiers[warn if type qualifiers on pointers are discarded]' + '-Wdiv-by-zero[warn about compile-time integer division by zero]' + '-Wdouble-promotion[warn about implicit conversions from "float" to "double"]' + '-Wduplicated-branches[warn about duplicated branches in if-else statements]' + '-Wduplicated-cond[warn about duplicated conditions in an if-else-if chain]' + '-Wduplicate-decl-specifier[warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier]' + '-Weffc\+\+[warn about violations of Effective C++ style rules]' + '-Wempty-body[warn about an empty body in an if or else statement]' + '-Wendif-labels[warn about stray tokens after #else and #endif]' + '-Wenum-compare[warn about comparison of different enum types]' + # '-Werror-implicit-function-declaration[this switch is deprecated; use -Werror=implicit-fun]' # this still exists but makes completing -Werror= less convenient + '-Wexpansion-to-defined[warn if "defined" is used outside #if]' + '-Wextra[print extra (possibly unwanted) warnings]' + '-Wfloat-conversion[warn for implicit type conversions that cause loss of floating point precision]' + '-Wfloat-equal[warn if testing floating point numbers for equality]' + '-Wformat-contains-nul[warn about format strings that contain NUL bytes]' + '-Wformat-extra-args[warn if passing too many arguments to a function for its format string]' + '-Wformat-nonliteral[warn about format strings that are not literals]' + '-Wformat-overflow[warn about function calls with format strings that write past the end of the destination region]' + '-Wformat-overflow=[warn about function calls with format strings that write past the end of the destination region]:level:(1 2)' + '-Wformat-security[warn about possible security problems with format functions]' + '-Wformat-signedness[warn about sign differences with format functions]' + '-Wformat-truncation[warn about calls to snprintf and similar functions that truncate output. Same as -Wformat- truncation=1. Same as -Wformat-truncation=]' + '-Wformat-truncation=[warn about calls to snprintf and similar functions that truncate output]:level:(1 2)' + '-Wformat=[warn about printf/scanf/strftime/strfmon format string anomalies]::level:(1 2)' + '-Wformat-y2k[warn about strftime formats yielding 2-digit years]' + '-Wformat-zero-length[warn about zero-length formats]' + '-Wframe-address[warn when __builtin_frame_address or __builtin_return_address is used unsafely]' + '-Wframe-larger-than=[warn if a function'\''s stack frame requires more than <number> bytes]:bytes: ' + '-Wfree-nonheap-object[warn when attempting to free a non-heap object]' + '-Wfunction-elimination[warn about function call elimination]' + '-Whsa[warn when a function cannot be expanded to HSAIL]' + '-Wignored-attributes[warn whenever attributes are ignored]' + '-Wignored-qualifiers[warn whenever type qualifiers are ignored]' + '-Wimplicit-fallthrough=[warn when a switch case falls through]:level:(1 2 3 4 5)' + '-Wimplicit-function-declaration[warn about implicit function declarations]' + '-Wimplicit-interface[warn about calls with implicit interface]' + '-Wimplicit-int[warn when a declaration does not specify a type]' + '-Wimplicit-procedure[warn about called procedures not explicitly declared]' + '-Wimplicit[warn about implicit declarations]' + '-Wimport[warn about imports]' + '-Wincompatible-pointer-types[warn when there is a conversion between pointers that have incompatible types]' + '-Winherited-variadic-ctor[warn about C++11 inheriting constructors when the base has a variadic constructor]' + '-Winit-self[warn about variables which are initialized to themselves]' + '-Winline[warn when an inlined function cannot be inlined]' + '-Wint-conversion[warn about incompatible integer to pointer and pointer to integer conversions]' + '-Winteger-division[warn about constant integer divisions with truncated results]' + '-Wint-in-bool-context[warn for suspicious integer expressions in boolean context]' + '-Wintrinsic-shadow[warn if a user-procedure has the same name as an intrinsic]' + '-Wintrinsics-std[warn on intrinsics not part of the selected standard]' + '-Wint-to-pointer-cast[warn when there is a cast to a pointer from an integer of a different size]' + '-Winvalid-memory-model[warn when an atomic memory model parameter is known to be outside the valid range]' + '-Winvalid-offsetof[warn about invalid uses of the "offsetof" macro]' + '-Winvalid-pch[warn about PCH files that are found but not used]' + '-Wjump-misses-init[warn when a jump misses a variable initialization]' + '-Wlarger-than=[warn if an object is larger than <number> bytes]:bytes: ' + '-Wline-truncation[warn about truncated source lines]' + '-Wliteral-suffix[warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore]' + '-Wlogical-not-parentheses[warn when logical not is used on the left hand side operand of a comparison]' + '-Wlogical-op[warn when a logical operator is suspiciously always evaluating to true or false]' + '-Wlong-long[do not warn about using "long long" when -pedantic]' + '-Wlto-type-mismatch[during link time optimization warn about mismatched types of global declarations]' + '-Wmain[warn about suspicious declarations of "main"]' + '-Wmaybe-uninitialized[warn about maybe uninitialized automatic variables]' + '-Wmemset-elt-size[warn about suspicious calls to memset where the third argument contains the number of elements not multiplied by the element size]' + '-Wmemset-transposed-args[warn about suspicious calls to memset where the third argument is constant literal zero and the second is not]' + '-Wmisleading-indentation[warn when the indentation of the code does not reflect the block structure]' + '-Wmissing-braces[warn about possibly missing braces around initializers]' + '-Wmissing-declarations[warn about global functions without previous declarations]' + '-Wmissing-field-initializers[warn about missing fields in struct initializers]' + '-Wmissing-include-dirs[warn about user-specified include directories that do not exist]' + '-Wmissing-parameter-type[warn about function parameters declared without a type specifier in K&R-style functions]' + '-Wmissing-prototypes[warn about global functions without prototypes]' + '-Wmudflap[warn about constructs not instrumented by -fmudflap]' + '-Wmultichar[warn about use of multi-character character constants]' + '-Wmultiple-inheritance[warn on direct multiple inheritance]' + '-Wnamespaces[warn on namespace definition]' + '-Wnarrowing[warn about narrowing conversions within { } that are ill-formed in C++11]' + '-Wnested-externs[warn about "extern" declarations not at file scope]' + '-Wnoexcept-type[warn if C++1z noexcept function type will change the mangled name of a symbol]' + '-Wnoexcept[warn when a noexcept expression evaluates to false even though the expression can''t actually throw]' + '-Wnonnull-compare[warn if comparing pointer parameter with nonnull attribute with NULL]' + '-Wnonnull[warn about NULL being passed to argument slots marked as requiring non-NULL]' + '-Wnonportable-cfstrings[warn on CFStrings containing nonportable characters]' + '-Wnon-template-friend[warn when non-templatized friend functions are declared within a template]' + '-Wnon-virtual-dtor[warn about non-virtual destructors]' + '-Wnormalized=-[warn about non-normalised Unicode strings]:normalization:((id\:allow\ some\ non-nfc\ characters\ that\ are\ valid\ identifiers nfc\:only\ allow\ NFC nfkc\:only\ allow\ NFKC none\:allow\ any\ normalization)): ' + '-Wnull-dereference[warn if dereferencing a NULL pointer may lead to erroneous or undefined behavior]' + '-Wodr[warn about some C++ One Definition Rule violations during link time optimization]' + '-Wold-style-cast[warn if a C-style cast is used in a program]' + '-Wold-style-declaration[warn for obsolescent usage in a declaration]' + '-Wold-style-definition[warn if an old-style parameter definition is used]' + '-Wopenmp-simd[warn if a simd directive is overridden by the vectorizer cost model]' + '-Woverflow[warn about overflow in arithmetic expressions]' + '-Woverlength-strings[warn if a string is longer than the maximum portable length specified by the standard]' + '-Woverloaded-virtual[warn about overloaded virtual function names]' + '-Woverride-init-side-effects[warn about overriding initializers with side effects]' + '-Woverride-init[warn about overriding initializers without side effects]' + '-Wpacked-bitfield-compat[warn about packed bit-fields whose offset changed in GCC 4.4]' + '-Wpacked[warn when the packed attribute has no effect on struct layout]' + '-Wpadded[warn when padding is required to align structure members]' + '-Wparentheses[warn about possibly missing parentheses]' + '-Wpedantic[issue warnings needed for strict compliance to the standard]' + '-Wplacement-new=[warn for placement new expressions with undefined behavior]::level:(1 2)' + '-Wpmf-conversions[warn when converting the type of pointers to member functions]' + '-Wpointer-arith[warn about function pointer arithmetic]' + '-Wpointer-compare[warn when a pointer is compared with a zero character constant]' + '-Wpointer-sign[warn when a pointer differs in signedness in an assignment]' + '-Wpointer-to-int-cast[warn when a pointer is cast to an integer of a different size]' + '-Wpoison-system-directories[warn for -I and -L options using system directories if cross compiling]' + '-Wpragmas[warn about misuses of pragmas]' + '-Wproperty-assign-default[warn if a property for an Objective-C object has no assign semantics specified]' + '-Wprotocol[warn if inherited methods are unimplemented]' + '-Wpsabi[warn about psabi]' + '-Wrealloc-lhs-all[warn when a left-hand-side variable is reallocated]' + '-Wrealloc-lhs[warn when a left-hand-side array variable is reallocated]' + '-Wreal-q-constant[warn about real-literal-constants with '\'q\'' exponent-letter]' + '-Wredundant-decls[warn about multiple declarations of the same object]' + '-Wregister[warn about uses of register storage specifier]' + '-Wreorder[warn when the compiler reorders code]' + '-Wrestrict[warn when an argument passed to a restrict- qualified parameter aliases with another argument]' + '-Wreturn-local-addr[warn about returning a pointer/reference to a local or temporary variable]' + '-Wreturn-type[warn whenever a function'\''s return type defaults to "int" (C), or about inconsistent return types (C++)]' + '-Wscalar-storage-order[warn on suspicious constructs involving reverse scalar storage order]' + '-Wselector[warn if a selector has multiple methods]' + '-Wsequence-point[warn about possible violations of sequence point rules]' + '-Wshadow-ivar[warn if a local declaration hides an instance variable]' + '-Wshadow[warn when one variable shadows another. Same as -Wshadow=global]' + '-Wshift-count-negative[warn if shift count is negative]' + '-Wshift-count-overflow[warn if shift count >= width of type]' + '-Wshift-negative-value[warn if left shifting a negative value]' + '-Wshift-overflow[warn if left shift of a signed value overflows. Same as -Wshift-overflow=]' + '-Wshift-overflow=[warn if left shift of a signed value overflows]:level:(1 2)' + '-Wsign-compare[warn about signed-unsigned comparisons]' + '-Wsign-conversion[warn for implicit type conversions between signed and unsigned integers]' + '-Wsign-promo[warn when overload promotes from unsigned to signed]' + '-Wsized-deallocation[warn about missing sized deallocation functions]' + '-Wsizeof-array-argument[warn when sizeof is applied on a parameter declared as an array]' + '-Wsizeof-pointer-memaccess[warn about suspicious length parameters to certain string functions if the argument uses sizeof]' + '-Wstack-protector[warn when not issuing stack smashing protection for some reason]' + '-Wstack-usage=[warn if stack usage might be larger than specified amount]:bytes: ' + '-Wstrict-aliasing[warn about code which might break strict aliasing rules]' + '-Wstrict-aliasing=-[warn about code which might break strict aliasing rules]:level of checking (higher is more accurate):(1 2 3)' + '-Wstrict-null-sentinel[warn about uncasted NULL used as sentinel]' + '-Wstrict-overflow[warn about optimizations that assume that signed overflow is undefined]' + '-Wstrict-overflow=-[warn about optimizations that assume that signed overflow is undefined]:level of checking (higher finds more cases):(1 2 3 4 5)' + '-Wstrict-prototypes[warn about unprototyped function declarations]' + '-Wstrict-selector-match[warn if type signatures of candidate methods do not match exactly]' + '-Wstringop-overflow=[under the control of Object Size type, warn about buffer overflow in string manipulation functions like memcpy and strcpy]:level:(1 2 3 4)' + '-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 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]' - '-Wsurprising[Warn about "suspicious" constructs]' - '-Wswitch-bool[Warn about switches with boolean controlling expression]' - '-Wswitch-default[Warn about enumerated switches missing a "default-" statement]' - '-Wswitch-enum[Warn about all enumerated switches missing a specific case]' - '-Wswitch-unreachable[Warn about statements between switch'\''s controlling expression and the first case]' - '-Wswitch[Warn about enumerated switches, with no default, missing a case]' - '-Wsync-nand[Warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used]' - '-Wsynth[Deprecated. This switch has no effect]' - '-Wsystem-headers[Do not suppress warnings from system headers]' - '-Wtabs[Permit nonconforming uses of the tab character]' - '-Wtarget-lifetime[Warn if the pointer in a pointer assignment might outlive its target]' - '-Wtautological-compare[Warn if a comparison always evaluates to true or false]' - '-Wtemplates[Warn on primary template declaration]' - '-Wterminate[Warn if a throw expression will always result in a call to terminate()]' - '-Wtraditional-conversion[Warn of prototypes causing type conversions different from what would happen in the absence of prototype]' - '-Wtraditional[Warn about features not present in traditional C]' - '-Wtrampolines[Warn whenever a trampoline is generated]' - '-Wtrigraphs[Warn if trigraphs are encountered that might affect the meaning of the program]' - '-Wtype-limits[Warn if a comparison is always true or always false due to the limited range of the data type]' - '-Wundeclared-selector[Warn about @selector()s without previously declared methods]' - '-Wundef[Warn if an undefined macro is used in an #if directive]' - '-Wundefined-do-loop[Warn about an invalid DO loop]' - '-Wunderflow[Warn about underflow of numerical constant expressions]' - '-Wuninitialized[Warn about uninitialized automatic variables]' - '-Wunknown-pragmas[Warn about unrecognized pragmas]' - '-Wunsafe-loop-optimizations[Warn if the loop cannot be optimized due to nontrivial assumptions]' - '-Wunsuffixed-float-constants[Warn about unsuffixed float constants]' - '-Wunused-but-set-parameter[Warn when a function parameter is only set, otherwise unused]' - '-Wunused-but-set-variable[Warn when a variable is only set, otherwise unused]' - '-Wunused-const-variable[Warn when a const variable is unused. Same as -Wunused-const-variable=]' - '-Wunused-dummy-argument[Warn about unused dummy arguments]' - '-Wunused-function[Warn when a function is unused]' - '-Wunused-label[Warn when a label is unused]' - '-Wunused-local-typedefs[Warn when typedefs locally defined in a function are not used]' - '-Wunused-macros[Warn about macros defined in the main file that are not used]' - '-Wunused-parameter[Warn when a function parameter is unused]' - '-Wunused-result[Warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value]' - '-Wunused-value[Warn when an expression value is unused]' - '-Wunused-variable[Warn when a variable is unused]' - '-Wunused[Enable all -Wunused- warnings]' - '-Wuse-without-only[Warn about USE statements that have no ONLY qualifier]' - '-Wuseless-cast[Warn about useless casts]' - '-Wvarargs[Warn about questionable usage of the macros used to retrieve variable arguments]' - '-Wvariadic-macros[Warn about using variadic macros]' - '-Wvector-operation-performance[Warn when a vector operation is compiled outside the SIMD]' - '-Wvirtual-inheritance[Warn on direct virtual inheritance]' - '-Wvirtual-move-assign[Warn if a virtual base has a non-trivial move assignment operator]' - '-Wvla[Warn if a variable length array is used]' - '-Wvolatile-register-var[Warn when a register variable is declared volatile]' - '-Wwrite-strings[In C++, nonzero means warn about deprecated conversion from string literals to '\''char *'\''. In C, similar warning, except that the conversion is]' - '-Wzero-as-null-pointer-constant[Warn when a literal '\''0'\'' is used as null pointer]' - '-Wzerotrip[Warn about zero-trip DO loops]' - '-frequire-return-statement[Functions which return values must end with return statements]' -# --help=warnings,joined - '-Wabi=[Warn about things that change between the current -fabi-version and the specified version]:: ' - '-Waligned-new=[Warn even if '\'new\'' uses a class member allocation function]:none|global|all: ' - '-Walloc-size-larger-than=[Warn for calls to allocation functions that attempt to allocate objects larger than the specified number of bytes]:bytes: ' - '-Walloca-larger-than=[Warn on unbounded uses of alloca, and on bounded uses of alloca whose bound can be larger than <number> bytes]:bytes: ' - '-Warray-bounds=[Warn if an array is accessed out of bounds]:level:(1 2)' - '-Wformat-overflow=[Warn about function calls with format strings that write past the end of the destination region]:level:(1 2)' - '-Wformat-truncation=[Warn about calls to snprintf and similar functions that truncate output]:level:(1 2)' - '-Wformat=[Warn about printf/scanf/strftime/strfmon format string anomalies]:level:(1 2)' - '-Wframe-larger-than=[Warn if a function'\''s stack frame requires more than <number> bytes]:bytes: ' - '-Wimplicit-fallthrough=[Warn when a switch case falls through]:level:(1 2 3 4 5)' - '-Wlarger-than=[Warn if an object is larger than <number> bytes]:bytes: ' - '-Wnormalized=-[Warn about non-normalised Unicode strings]:normalization:((id\:allow\ some\ non-nfc\ characters\ that\ are\ valid\ identifiers nfc\:only\ allow\ NFC nfkc\:only\ allow\ NFKC none\:allow\ any\ normalization)): ' - '-Wplacement-new=[Warn for placement new expressions with undefined behavior]:level:(1 2)' - '-Wshift-overflow=[Warn if left shift of a signed value overflows]:level:(1 2)' - '-Wstack-usage=[Warn if stack usage might be larger than specified amount]:bytes: ' - '-Wstrict-aliasing=-[Warn about code which might break strict aliasing rules]:level of checking (higher is more accurate):(1 2 3)' - '-Wstrict-overflow=-[Warn about optimizations that assume that signed overflow is undefined]:level of checking (higher finds more cases):(1 2 3 4 5)' - '-Wstringop-overflow=[Under the control of Object Size type, warn about buffer overflow in string manipulation functions like memcpy and strcpy]:level:(1 2 3 4)' - '-Wunused-const-variable=[Warn when a const variable is unused]:level:(1 2)' - '-Wvla-larger-than=[Warn on unbounded uses of variable-length arrays, and on bounded uses of variable-length arrays whose bound can be larger than <number> bytes]:bytes: ' -# -W options from --help=common,^warnings - '-Werror=-[Treat specified warning as error (or all if none specified)]::warning:->werror' - '-Wfatal-errors[Exit on the first error occurred]' + '-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]' + '-Wsurprising[warn about "suspicious" constructs]' + '-Wswitch-bool[warn about switches with boolean controlling expression]' + '-Wswitch-default[warn about enumerated switches missing a "default-" statement]' + '-Wswitch-enum[warn about all enumerated switches missing a specific case]' + '-Wswitch-unreachable[warn about statements between switch'\''s controlling expression and the first case]' + '-Wswitch[warn about enumerated switches, with no default, missing a case]' + '-Wsync-nand[warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used]' + '-Wsynth[deprecated. This switch has no effect]' + '-Wsystem-headers[do not suppress warnings from system headers]' + '-Wtabs[permit nonconforming uses of the tab character]' + '-Wtarget-lifetime[warn if the pointer in a pointer assignment might outlive its target]' + '-Wtautological-compare[warn if a comparison always evaluates to true or false]' + '-Wtemplates[warn on primary template declaration]' + '-Wterminate[warn if a throw expression will always result in a call to terminate()]' + '-W[this switch is deprecated; use -Wextra instead]' + '-Wtraditional-conversion[warn of prototypes causing type conversions different from what would happen in the absence of prototype]' + '-Wtraditional[warn about features not present in traditional C]' + '-Wtrampolines[warn whenever a trampoline is generated]' + '-Wtrigraphs[warn if trigraphs are encountered that might affect the meaning of the program]' + '-Wtype-limits[warn if a comparison is always true or always false due to the limited range of the data type]' + '-Wundeclared-selector[warn about @selector()s without previously declared methods]' + '-Wundefined-do-loop[warn about an invalid DO loop]' + '-Wundef[warn if an undefined macro is used in an #if directive]' + '-Wunderflow[warn about underflow of numerical constant expressions]' + '-Wuninitialized[warn about uninitialized automatic variables]' + '-Wunknown-pragmas[warn about unrecognized pragmas]' + '-Wunsafe-loop-optimizations[warn if the loop cannot be optimized due to nontrivial assumptions]' + '-Wunsuffixed-float-constants[warn about unsuffixed float constants]' + '-Wunused-but-set-parameter[warn when a function parameter is only set, otherwise unused]' + '-Wunused-but-set-variable[warn when a variable is only set, otherwise unused]' + '-Wunused-const-variable[warn when a const variable is unused. Same as -Wunused-const-variable=]' + '-Wunused-const-variable=[warn when a const variable is unused]:level:(1 2)' + '-Wunused-dummy-argument[warn about unused dummy arguments]' + '-Wunused[enable all -Wunused- warnings]' + '-Wunused-function[warn when a function is unused]' + '-Wunused-label[warn when a label is unused]' + '-Wunused-local-typedefs[warn when typedefs locally defined in a function are not used]' + '-Wunused-macros[warn about macros defined in the main file that are not used]' + '-Wunused-parameter[warn when a function parameter is unused]' + '-Wunused-result[warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value]' + '-Wunused-value[warn when an expression value is unused]' + '-Wunused-variable[warn when a variable is unused]' + '-Wuseless-cast[warn about useless casts]' + '-Wuse-without-only[warn about USE statements that have no ONLY qualifier]' + '-Wvarargs[warn about questionable usage of the macros used to retrieve variable arguments]' + '-Wvariadic-macros[warn about using variadic macros]' + '-Wvector-operation-performance[warn when a vector operation is compiled outside the SIMD]' + '-Wvirtual-inheritance[warn on direct virtual inheritance]' + '-Wvirtual-move-assign[warn if a virtual base has a non-trivial move assignment operator]' + '-Wvla-larger-than=[warn on unbounded uses of variable-length arrays, and on bounded uses of variable-length arrays whose bound can be larger than <number> bytes]:bytes: ' + '-Wvla[warn if a variable length array is used]' + '-Wvolatile-register-var[warn when a register variable is declared volatile]' + '-Wwrite-strings[in C++, nonzero means warn about deprecated conversion from string literals to '\''char *'\''. In C, similar warning, except that the conversion is]' + '-Wzero-as-null-pointer-constant[warn when a literal '\''0'\'' is used as null pointer]' + '-Wzerotrip[warn about zero-trip DO loops]' ) + # clang specific warnings if [[ "$service" = clang* ]]; then - args+=( - '-Wunreachable-code[Warn on code that will not be executed]' - '-Wunreachable-code-aggressive[Controls -Wunreachable-code, -Wunreachable-code-break, -Wunreachable-code-return]' - '-Wunreachable-code-break[Warn when break will never be executed]' - '-Wunreachable-code-loop-increment[Warn when loop will be executed only once]' - '-Wunreachable-code-return[Warn when return will not be executed]' + warnings+=( + '-Wlarge-by-value-copy=[warn on large by value copy]:argument' + '-Wunreachable-code-aggressive[controls -Wunreachable-code, -Wunreachable-code-break, -Wunreachable-code-return]' + '-Wunreachable-code-break[warn when break will never be executed]' + '-Wunreachable-code-loop-increment[warn when loop will be executed only once]' + '-Wunreachable-code-return[warn when return will not be executed]' + '-Wunreachable-code[warn on code that will not be executed]' ) else - args+=( - '-Wunreachable-code[Does nothing. Preserved for backward compatibility]' + warnings+=( + '-Wunreachable-code[does nothing. Preserved for backward compatibility]' ) fi -# optimizers (from --help=optimizers), except for -O -args+=( -# --help=optimizers,^joined - '-faggressive-loop-optimizations[Aggressively optimize loops using language constraints]' - '-falign-functions[Align the start of functions]' - '-falign-jumps[Align labels which are only reached by jumping]' - '-falign-labels[Align all labels]' - '-falign-loops[Align the start of loops]' - '-fassociative-math[Allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]' - '-fasynchronous-unwind-tables[Generate unwind tables that are exact at each instruction boundary]' - '-fauto-inc-dec[Generate auto-inc/dec instructions]' - '-fbranch-count-reg[Replace add, compare, branch with branch on count register]' - '-fbranch-probabilities[Use profiling information for branch probabilities]' - '-fbranch-target-load-optimize2[Perform branch target load optimization after prologue / epilogue threading]' - '-fbranch-target-load-optimize[Perform branch target load optimization before prologue / epilogue threading]' - '-fbtr-bb-exclusive[Restrict target load migration not to re-use registers in any basic block]' - '-fcaller-saves[Save registers around function calls]' - '-fcode-hoisting[Enable code hoisting]' - '-fcombine-stack-adjustments[Looks for opportunities to reduce stack adjustments and stack references]' - '-fcommon[Do not put uninitialized globals in the common section]' - '-fcompare-elim[Perform comparison elimination after register allocation has finished]' - '-fconserve-stack[Do not perform optimizations increasing noticeably stack usage]' - '-fcprop-registers[Perform a register copy-propagation optimization pass]' - '-fcrossjumping[Perform cross-jumping optimization]' - '-fcse-follow-jumps[When running CSE, follow jumps to their targets]' - '-fcx-fortran-rules[Complex multiplication and division follow Fortran rules]' - '-fcx-limited-range[Omit range reduction step when performing complex division]' - '-fdata-sections[Place data items into their own section]' - '-fdce[Use the RTL dead code elimination pass]' - '-fdefer-pop[Defer popping functions args from stack until later]' - '-fdelayed-branch[Attempt to fill delay slots of branch instructions]' - '-fdelete-dead-exceptions[Delete dead instructions that may throw exceptions]' - '-fdelete-null-pointer-checks[Delete useless null pointer checks]' - '-fdevirtualize-speculatively[Perform speculative devirtualization]' - '-fdevirtualize[Try to convert virtual calls to direct ones]' - '-fdse[Use the RTL dead store elimination pass]' - '-fearly-inlining[Perform early inlining]' - '-fexceptions[Enable exception handling]' - '-fexpensive-optimizations[Perform a number of minor, expensive optimizations]' - '-ffinite-math-only[Assume no NaNs or infinities are generated]' - '-ffloat-store[Don'\''t allocate floats and doubles in extended- precision registers]' - '-fforward-propagate[Perform a forward propagation pass on RTL]' - '-ffp-int-builtin-inexact[Allow built-in functions ceil, floor, round, trunc to raise "inexact" exceptions]' - '-ffunction-cse[Allow function addresses to be held in registers]' - '-fgcse-after-reload[Perform global common subexpression elimination after register allocation has finished]' - '-fgcse-las[Perform redundant load after store elimination in global common subexpression elimination]' - '-fgcse-lm[Perform enhanced load motion during global common subexpression elimination]' - '-fgcse-sm[Perform store motion after global common subexpression elimination]' - '-fgcse[Perform global common subexpression elimination]' - '-fgraphite-identity[Enable Graphite Identity transformation]' - '-fgraphite[Enable in and out of Graphite representation]' - '-fguess-branch-probability[Enable guessing of branch probabilities]' - '-fhoist-adjacent-loads[Enable hoisting adjacent loads to encourage generating conditional move instructions]' - '-fif-conversion2[Perform conversion of conditional jumps to conditional execution]' - '-fif-conversion[Perform conversion of conditional jumps to branchless equivalents]' - '-findirect-inlining[Perform indirect inlining]' - '-finline-atomics[Inline __atomic operations when a lock free instruction sequence is available]' - '-finline-functions-called-once[Integrate functions only required by their single caller]' - '-finline-functions[Integrate functions not declared "inline" into their callers when profitable]' - '-finline-small-functions[Integrate functions into their callers when code size is known not to grow]' - '-finline[Enable inlining of function declared "inline", disabling disables all inlining]' - '-fipa-bit-cp[Perform interprocedural bitwise constant propagation]' - '-fipa-cp-clone[Perform cloning to make Interprocedural constant propagation stronger]' - '-fipa-cp[Perform interprocedural constant propagation]' - '-fipa-icf-functions[Perform Identical Code Folding for functions]' - '-fipa-icf-variables[Perform Identical Code Folding for variables]' - '-fipa-icf[Perform Identical Code Folding for functions and read-only variables]' - '-fipa-profile[Perform interprocedural profile propagation]' - '-fipa-pta[Perform interprocedural points-to analysis]' - '-fipa-pure-const[Discover pure and const functions]' - '-fipa-ra[Use caller save register across calls if possible]' - '-fipa-reference[Discover readonly and non addressable static variables]' - '-fipa-sra[Perform interprocedural reduction of aggregates]' - '-fipa-vrp[Perform IPA Value Range Propagation]' - '-fira-hoist-pressure[Use IRA based register pressure calculation in RTL hoist optimizations]' - '-fira-loop-pressure[Use IRA based register pressure calculation in RTL loop optimizations]' - '-fira-share-save-slots[Share slots for saving different hard registers]' - '-fira-share-spill-slots[Share stack slots for spilled pseudo-registers]' - '-fisolate-erroneous-paths-attribute[Detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a returns_nonnull or]' - '-fisolate-erroneous-paths-dereference[Detect paths that trigger erroneous or undefined behavior due to dereferencing a null pointer. Isolate those paths from the main]' - '-fivopts[Optimize induction variables on trees]' - '-fjump-tables[Use jump tables for sufficiently large switch statements]' - '-flifetime-dse[Tell DSE that the storage for a C++ object is dead when the constructor starts and when the destructor finishes]' - '-flive-range-shrinkage[Relief of register pressure through live range shrinkage]' - '-floop-nest-optimize[Enable the loop nest optimizer]' - '-floop-parallelize-all[Mark all loops as parallel]' - '-flra-remat[Do CFG-sensitive rematerialization in LRA]' - '-fmath-errno[Set errno after built-in math functions]' - '-fmerge-all-constants[Attempt to merge identical constants and constant variables]' - '-fmerge-constants[Attempt to merge identical constants across compilation units]' - '-fmodulo-sched-allow-regmoves[Perform SMS based modulo scheduling with register moves allowed]' - '-fmodulo-sched[Perform SMS based modulo scheduling before the first scheduling pass]' - '-fmove-loop-invariants[Move loop invariant computations out of loops]' - '-fno-threadsafe-statics[Do not generate thread-safe code for initializing local statics]' - '-fnon-call-exceptions[Support synchronous non-call exceptions]' - '-fnothrow-opt[Treat a throw() exception specification as noexcept to improve code size]' - '-fomit-frame-pointer[When possible do not generate stack frames]' - '-fopt-info[Enable all optimization info dumps on stderr]' - '-foptimize-sibling-calls[Optimize sibling and tail recursive calls]' - '-foptimize-strlen[Enable string length optimizations on trees]' - '-fpack-struct[Pack structure members together without holes]' - '-fpartial-inlining[Perform partial inlining]' - '-fpeel-loops[Perform loop peeling]' - '-fpeephole2[Enable an RTL peephole pass before sched2]' - '-fpeephole[Enable machine specific peephole optimizations]' - '-fplt[Use PLT for PIC calls (-fno-plt- load the address from GOT at call site)]' - '-fpredictive-commoning[Run predictive commoning optimization]' - '-fprefetch-loop-arrays[Generate prefetch instructions, if available, for arrays in loops]' - '-fprintf-return-value[Treat known sprintf return values as constants]' - '-freciprocal-math[Same as -fassociative-math for expressions which include division]' - '-freg-struct-return[Return small aggregates in registers]' - '-frename-registers[Perform a register renaming optimization pass]' - '-freorder-blocks-and-partition[Reorder basic blocks and partition into hot and cold sections]' - '-freorder-blocks[Reorder basic blocks to improve code placement]' - '-freorder-functions[Reorder functions to improve code placement]' - '-frerun-cse-after-loop[Add a common subexpression elimination pass after loop optimizations]' - '-freschedule-modulo-scheduled-loops[Enable/Disable the traditional scheduling in loops that already passed modulo scheduling]' - '-frounding-math[Disable optimizations that assume default FP rounding behavior]' - '-frtti[Generate run time type descriptor information]' - '-fsched-critical-path-heuristic[Enable the critical path heuristic in the scheduler]' - '-fsched-dep-count-heuristic[Enable the dependent count heuristic in the scheduler]' - '-fsched-group-heuristic[Enable the group heuristic in the scheduler]' - '-fsched-interblock[Enable scheduling across basic blocks]' - '-fsched-last-insn-heuristic[Enable the last instruction heuristic in the scheduler]' - '-fsched-pressure[Enable register pressure sensitive insn scheduling]' - '-fsched-rank-heuristic[Enable the rank heuristic in the scheduler]' - '-fsched-spec-insn-heuristic[Enable the speculative instruction heuristic in the scheduler]' - '-fsched-spec-load-dangerous[Allow speculative motion of more loads]' - '-fsched-spec-load[Allow speculative motion of some loads]' - '-fsched-spec[Allow speculative motion of non-loads]' - '-fsched-stalled-insns-dep[Set dependence distance checking in premature scheduling of queued insns]' - '-fsched-stalled-insns[Allow premature scheduling of queued insns]' - '-fsched2-use-superblocks[If scheduling post reload, do superblock scheduling]' - '-fschedule-fusion[Perform a target dependent instruction fusion optimization pass]' - '-fschedule-insns2[Reschedule instructions after register allocation]' - '-fschedule-insns[Reschedule instructions before register allocation]' - '-fsection-anchors[Access data in the same section from shared anchor points]' - '-fsel-sched-pipelining-outer-loops[Perform software pipelining of outer loops during selective scheduling]' - '-fsel-sched-pipelining[Perform software pipelining of inner loops during selective scheduling]' - '-fsel-sched-reschedule-pipelined[Reschedule pipelined regions without pipelining]' - '-fselective-scheduling2[Run selective scheduling after reload]' - '-fselective-scheduling[Schedule instructions using selective scheduling algorithm]' - '-fshort-enums[Use the narrowest integer type possible for enumeration types]' - '-fshort-wchar[Force the underlying type for "wchar_t" to be "unsigned short"]' - '-fshrink-wrap-separate[Shrink-wrap parts of the prologue and epilogue separately]' - '-fshrink-wrap[Emit function prologues only before parts of the function that need it, rather than at the top of the function]' - '-fsignaling-nans[Disable optimizations observable by IEEE signaling NaNs]' - '-fsigned-zeros[Disable floating point optimizations that ignore the IEEE signedness of zero]' - '-fsingle-precision-constant[Convert floating point constants to single precision constants]' - '-fsplit-ivs-in-unroller[Split lifetimes of induction variables when loops are unrolled]' - '-fsplit-loops[Perform loop splitting]' - '-fsplit-paths[Split paths leading to loop backedges]' - '-fsplit-wide-types[Split wide types into independent registers]' - '-fssa-backprop[Enable backward propagation of use properties at the SSA level]' - '-fssa-phiopt[Optimize conditional patterns using SSA PHI nodes]' - '-fstack-protector-all[Use a stack protection method for every function]' - '-fstack-protector-explicit[Use stack protection method only for functions with the stack_protect attribute]' - '-fstack-protector-strong[Use a smart stack protection method for certain functions]' - '-fstack-protector[Use propolice as a stack protection method]' - '-fstdarg-opt[Optimize amount of stdarg registers saved to stack at start of function]' - '-fstore-merging[Merge adjacent stores]' - '-fstrict-aliasing[Assume strict aliasing rules apply]' - '-fstrict-enums[Assume that values of enumeration type are always within the minimum range of that type]' - '-fstrict-overflow[Treat signed overflow as undefined]' - '-fstrict-volatile-bitfields[Force bitfield accesses to match their type width]' - '-fthread-jumps[Perform jump threading optimizations]' - '-ftracer[Perform superblock formation via tail duplication]' - '-ftrapping-math[Assume floating-point operations can trap]' - '-ftrapv[Trap for signed overflow in addition, subtraction and multiplication]' - '-ftree-bit-ccp[Enable SSA-BIT-CCP optimization on trees]' - '-ftree-builtin-call-dce[Enable conditional dead code elimination for builtin calls]' - '-ftree-ccp[Enable SSA-CCP optimization on trees]' - '-ftree-ch[Enable loop header copying on trees]' - '-ftree-coalesce-vars[Enable SSA coalescing of user variables]' - '-ftree-copy-prop[Enable copy propagation on trees]' - '-ftree-cselim[Transform condition stores into unconditional ones]' - '-ftree-dce[Enable SSA dead code elimination optimization on trees]' - '-ftree-dominator-opts[Enable dominator optimizations]' - '-ftree-dse[Enable dead store elimination]' - '-ftree-forwprop[Enable forward propagation on trees]' - '-ftree-fre[Enable Full Redundancy Elimination (FRE) on trees]' - '-ftree-loop-distribute-patterns[Enable loop distribution for patterns transformed into a library call]' - '-ftree-loop-distribution[Enable loop distribution on trees]' - '-ftree-loop-if-convert[Convert conditional jumps in innermost loops to branchless equivalents]' - '-ftree-loop-im[Enable loop invariant motion on trees]' - '-ftree-loop-ivcanon[Create canonical induction variables in loops]' - '-ftree-loop-optimize[Enable loop optimizations on tree level]' - '-ftree-loop-vectorize[Enable loop vectorization on trees]' - '-ftree-lrs[Perform live range splitting during the SSA- >normal pass]' - '-ftree-partial-pre[In SSA-PRE optimization on trees, enable partial- partial redundancy elimination]' - '-ftree-phiprop[Enable hoisting loads from conditional pointers]' - '-ftree-pre[Enable SSA-PRE optimization on trees]' - '-ftree-pta[Perform function-local points-to analysis on trees]' - '-ftree-reassoc[Enable reassociation on tree level]' - '-ftree-scev-cprop[Enable copy propagation of scalar-evolution information]' - '-ftree-sink[Enable SSA code sinking on trees]' - '-ftree-slp-vectorize[Enable basic block vectorization (SLP) on trees]' - '-ftree-slsr[Perform straight-line strength reduction]' - '-ftree-sra[Perform scalar replacement of aggregates]' - '-ftree-switch-conversion[Perform conversions of switch initializations]' - '-ftree-tail-merge[Enable tail merging on trees]' - '-ftree-ter[Replace temporary expressions in the SSA->normal pass]' - '-ftree-vectorize[Enable vectorization on trees]' - '-ftree-vrp[Perform Value Range Propagation on trees]' - '-funconstrained-commons[Assume common declarations may be overridden with ones with a larger trailing array]' - '-funroll-all-loops[Perform loop unrolling for all loops]' - '-funroll-loops[Perform loop unrolling when iteration count is known]' - '-funsafe-loop-optimizations[Allow loop optimizations to assume that the loops behave in normal way]' - '-funsafe-math-optimizations[Allow math optimizations that may violate IEEE or ISO standards]' - '-funswitch-loops[Perform loop unswitching]' - '-funwind-tables[Just generate unwind tables for exception handling]' - '-fvar-tracking-assignments-toggle[Toggle -fvar-tracking-assignments]' - '-fvar-tracking-assignments[Perform variable tracking by annotating assignments]' - '-fvar-tracking-uninit[Perform variable tracking and also tag variables that are uninitialized]' - '-fvar-tracking[Perform variable tracking]' - '-fvariable-expansion-in-unroller[Apply variable expansion when loops are unrolled]' - '-fvpt[Use expression value profiles in optimizations]' - '-fweb[Construct webs and split unrelated uses of single variable]' - '-fwhole-program[Perform whole program optimizations]' - '-fwrapv[Assume signed arithmetic overflow wraps around]' -# --help=optimizers,joined - '-ffp-contract=[Perform floating-point expression contraction]:style:(off on fast)' - '-fira-algorithm=[Set the used IRA algorithm]:algorithm:(cb priority)' - '-fira-region=[Set regions for IRA]:region:(one all mixed)' - '-fpack-struct=[Set initial maximum structure member alignment]:alignment (power of 2): ' - '-freorder-blocks-algorithm=[Set the used basic block reordering algorithm]:algorithm:(simple stc)' - '-fsched-stalled-insns-dep=[Set dependence distance checking in premature scheduling of queued insns]:insns:' - '-fsched-stalled-insns=[Set number of queued insns that can be prematurely scheduled]:insns:' - '-fsimd-cost-model=[Specifies the vectorization cost model for code marked with a simd directive]:model:(unlimited dynamic cheap)' - '-fstack-reuse=[Set stack reuse level for local variables]:level:(all named_vars none)' - '-ftree-parallelize-loops=[Enable automatic parallelization of loops]' - '-fvect-cost-model=[Specifies the cost model for vectorization]:model:(unlimited dynamic cheap)' - -) -# More linker options, from gcc man pages args+=( - '-nostartfiles[Do not use the standard system startup files when linking]' - '-nodefaultlibs[Do not use the standard system libraries when linking]' - '-nostdlib[Do not use standard system startup files or libraries when linking]' - '-rdynamic[Pass the flag -export-dynamic to the ELF linker, on targets that support it]' - '-s[Remove all symbol table and relocation information from the executable]' - '-static[On systems that support dynamic linking, this prevents linking with the shared libraries]' - '-shared-libgcc[Force shared libgcc]' - '-static-libgcc[Force static libgcc]' - '-symbolic[Bind references to global symbols when building a shared object]' - '-T:linker script:_files' + {'*-A-','*--assert='}'[make an assertion]:define assertion:' + '--all-warnings[display all warnings]' + {-ansi,--ansi}'[same as -std=c89 or -std=c++98]' + '-aux-info[emit declaration information into <file>]:file:_files' + {'-B-','--prefix='}'[add <prefix> to the compiler'\''s search paths]:executable prefix:_files -/' + '-b[specify target machine to compile to]:target machine:' + {-CC,--comments-in-macros}'[do not discard comments, including macro expansion]' + {-C,--comments}'[do not discard comments during preprocess]' + {-c,--compile}'[compile and assemble, but do not link]' + {'*-D-','*--define-macro='}'[define a macro]:define macro:' + '-d-[dump the state of the preprocessor]:dump:->dump' + '--dependencies[generate Makefile dependencies]' + '-dumpbase[set the file basename to be used for dumps]:file:_files' + '-dumpdir[set the directory name to be used for dumps]:file:_files -/' + '-dumpmachine[display the compiler'\''s target processor]' + '-dumpspecs[display all of the built in spec strings]' + '-dumpversion[display the version of the compiler]' + '+e-[control how virtual function definitions are used]:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))' + {-e,--entry}'[specify program entry point is entry]:entry' + {-E,--preprocess}'[preprocess only; do not compile, assemble or link]' + '-fabi-version=-[use specified C++ ABI version]:ABI version [0]:(0 1 2 3 4 5 6 7 8 9 10 11 12 13)' + '-fada-spec-parent=[dump Ada specs as child units of given parent]' + '-faggressive-loop-optimizations[aggressively optimize loops using language constraints]' + '-falign-functions[align the start of functions]' + '-falign-jumps[align labels which are only reached by jumping]' + '-falign-labels[align all labels]' + '-falign-loops[align the start of loops]' + '-fallow-parameterless-variadic-functions[allow variadic functions without named parameter]' + '-fasm[recognize the asm keyword]' + '-fassociative-math[allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]' + '-fasynchronous-unwind-tables[generate unwind tables that are exact at each instruction boundary]' + '-fauto-inc-dec[generate auto-inc/dec instructions]' + '-fbounds-check[generate code to check bounds before indexing arrays]' + '-fbranch-count-reg[replace add, compare, branch with branch on count register]' + '-fbranch-probabilities[use profiling information for branch probabilities]' + '-fbranch-target-load-optimize2[perform branch target load optimization after prologue / epilogue threading]' + '-fbranch-target-load-optimize[perform branch target load optimization before prologue / epilogue threading]' + '-fbtr-bb-exclusive[restrict target load migration not to re-use registers in any basic block]' + '-fbuilding-libgcc[specify building libgcc]' + '-fbuiltin[recognize builtin functions]' + '-fcaller-saves[save registers around function calls]' + '-fcall-saved--[mark <register> as being preserved across functions]:register' + '-fcall-used--[mark <register> as being corrupted by function calls]:register' + '-fcanonical-system-headers[where shorter use canonicalized paths to system headers]' + '-fcheck-data-deps[compare the results of several data dependence analyzers]' + '-fcheck-pointer-bounds[add pointer bounds checker instrumentation]' + '-fchkp-check-incomplete-type[generate pointer bounds check for variables with incomplete type]' + '-fchkp-check-read[generate checks for all read accesses to memory]' + '-fchkp-check-write[generate checks for all write accesses to memory]' + '-fchkp-first-field-has-own-bounds[forces checker to use narrowed bounds for address of the first field]' + '-fchkp-instrument-calls[generate bounds passing for calls]' + '-fchkp-instrument-marked-only[instrument only functions marked with bnd_instrument attribute]' + '-fchkp-narrow-bounds[control how checker handle pointers to object fields]' + '-fchkp-narrow-to-innermost-array[forces checker to use bounds of the innermost arrays in case of nested static array access]' + '-fchkp-optimize[allow checker optimizations]' + '-fchkp-store-bounds[generate bounds stores for pointer writes]' + '-fchkp-treat-zero-dynamic-size-as-infinite[with this option zero size obtained dynamically for objects with incomplete type will be treated as infinite]' + '-fchkp-use-fast-string-functions[allow to use *_nobnd versions of string functions]' + '-fchkp-use-nochk-string-functions[allow to use *_nochk versions of string functions]' + '-fchkp-use-static-bounds[use statically initialized variable for vars bounds instead of generating them each time it is required]' + '-fchkp-use-static-const-bounds[use statically initialized variable for constant bounds]' + '-fchkp-use-wrappers[transform instrumented builtin calls into calls to wrappers]' + '-fchkp-zero-input-bounds-for-main[use zero bounds for all incoming arguments in main function]' + '-fcilkplus[enable Cilk Plus]' + '-fcode-hoisting[enable code hoisting]' + '-fcombine-stack-adjustments[looks for opportunities to reduce stack adjustments and stack references]' + '-fcommon[do not put uninitialized globals in the common section]' + '-fcompare-debug=-[compile with and without e.g. -gtoggle, and compare the final-insns dump]:opts:' # TODO: complete gcc options here + '-fcompare-debug-second[run only the second compilation of -fcompare-debug]' + '-fcompare-elim[perform comparison elimination after register allocation has finished]' + '-fcond-mismatch[allow the arguments of the ? operator to have different types]' + '-fconserve-stack[do not perform optimizations increasing noticeably stack usage]' + '-fcprop-registers[perform a register copy-propagation optimization pass]' + '-fcrossjumping[perform cross-jumping optimization]' + '-fcse-follow-jumps[when running CSE, follow jumps to their targets]' + '-fcx-fortran-rules[complex multiplication and division follow Fortran rules]' + '-fcx-limited-range[omit range reduction step when performing complex division]' + '-fdata-sections[place data items into their own section]' + '-fdbg-cnt=-[,<counter>-<limit>,...) Set the debug counter limit]:counter\:limit,...: ' # TODO: gcc -fdbg-cnt-list -x c /dev/null -o /dev/null -c + '-fdbg-cnt-list[list all available debugging counters with their limits and counts]' + '-fdce[use the RTL dead code elimination pass]' + '-fdebug-cpp[emit debug annotations during preprocessing]' + '-fdebug-prefix-map=-[map one directory name to another in debug information]:/old/dir=/new/dir:->dirtodir' + '-fdebug-types-section[output .debug_types section when using DWARF v4 debuginfo]' + '-fdefer-pop[defer popping functions args from stack until later]' + '-fdelayed-branch[attempt to fill delay slots of branch instructions]' + '-fdelete-dead-exceptions[delete dead instructions that may throw exceptions]' + '-fdelete-null-pointer-checks[delete useless null pointer checks]' + '-fdevirtualize-speculatively[perform speculative devirtualization]' + '-fdevirtualize[try to convert virtual calls to direct ones]' + '-fdiagnostics-color=-[colorize diagnostics]::color:(never always auto)' + '-fdiagnostics-generate-patch[print fix-it hints to stderr in unified diff format]' + '-fdiagnostics-parseable-fixits[print fixit hints in machine-readable form]' + '-fdiagnostics-show-caret[show the source line with a caret indicating the column]' + '-fdiagnostics-show-location=-[how often to emit source location at the beginning of line-wrapped diagnostics]:source location:(once every-line)' + '-fdiagnostics-show-option[amend appropriate diagnostic messages with the command line option that controls them]' + '-fdirectives-only[preprocess directives only]' + '-fdollars-in-identifiers[permit $ as an identifier character]' + '-fdse[use the RTL dead store elimination pass]' + '-fdump-ada-spec-slim[write all declarations as Ada code for the given file only]' + '-fdump-ada-spec[write all declarations as Ada code transitively]' + '-fdump-final-insns=-[dump to filename the insns at the end of translation]:filename:_files' + '-fdump-go-spec=-[write all declarations to file as Go code]:filename:_files' + '-fdump-noaddr[suppress output of addresses in debugging dumps]' + '-fdump-passes[dump optimization passes]' + '-fdump-unnumbered-links[suppress output of previous and next insn numbers in debugging dumps]' + '-fdump-unnumbered[suppress output of instruction numbers, line number notes and addresses in debugging dumps]' + '-fdwarf2-cfi-asm[enable CFI tables via GAS assembler directives]' + '-fearly-inlining[perform early inlining]' + '-feliminate-dwarf2-dups[perform DWARF2 duplicate elimination]' + '-feliminate-unused-debug-symbols[perform unused type elimination in debug info]' + '-feliminate-unused-debug-types[perform unused type elimination in debug info]' + '-femit-class-debug-always[do not suppress C++ class debug information]' + '-femit-struct-debug-baseonly[aggressive reduced debug info for structs]' + '-femit-struct-debug-detailed=-[detailed reduced debug info for structs]:spec list [all]' + '-femit-struct-debug-reduced[conservative reduced debug info for structs]' + '-fexceptions[enable exception handling]' + '-fexcess-precision=-[specify handling of excess floating-point precision]:precision handling:(fast standard)' + '-fexec-charset=-[convert all strings and character constants to character set]:character set [UTF-8]' + '-fexpensive-optimizations[perform a number of minor, expensive optimizations]' + '-fextended-identifiers[permit universal character names in identifiers]' + '-ffast-math[sets -fno-math-errno, -funsafe-math-optimizations, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans and -fcx-limited-range]' + '-ffat-lto-objects[output lto objects containing both the intermediate language and binary output]' + '-ffinite-math-only[assume no NaNs or infinities are generated]' + '-ffixed--[mark <register> as being unavailable to the compiler]:register' + '-ffloat-store[don'\''t allocate floats and doubles in extended- precision registers]' + '-fforward-propagate[perform a forward propagation pass on RTL]' + '-ffp-contract=-[perform floating-point expression contraction]:style [fast]:(on off fast)' + '-ffp-int-builtin-inexact[allow built-in functions ceil, floor, round, trunc to raise "inexact" exceptions]' + '-ffreestanding[do not assume that standard C libraries and main exist]' + '-ffunction-cse[allow function addresses to be held in registers]' + '-ffunction-sections[place each function into its own section]' + '-fgcse-after-reload[perform global common subexpression elimination after register allocation has finished]' + '-fgcse-las[perform redundant load after store elimination in global common subexpression elimination]' + '-fgcse-lm[perform enhanced load motion during global common subexpression elimination]' + '-fgcse[perform global common subexpression elimination]' + '-fgcse-sm[perform store motion after global common subexpression elimination]' + '-fgnu89-inline[use traditional GNU semantics for inline functions]' + '-fgnu-tm[enable support for GNU transactional memory]' + '-fgraphite[enable in and out of Graphite representation]' + '-fgraphite-identity[enable Graphite Identity transformation]' + '-fguess-branch-probability[enable guessing of branch probabilities]' + '-fhoist-adjacent-loads[enable hoisting adjacent loads to encourage generating conditional move instructions]' + '-fhosted[assume normal C execution environment]' + '-fif-conversion2[perform conversion of conditional jumps to conditional execution]' + '-fif-conversion[perform conversion of conditional jumps to branchless equivalents]' + '-findirect-inlining[perform indirect inlining]' + '-finhibit-size-directive[do not generate .size directives]' + '-finline-atomics[inline __atomic operations when a lock free instruction sequence is available]' + '-finline[enable inlining of function declared "inline", disabling disables all inlining]' + '-finline-functions-called-once[integrate functions only required by their single caller]' + '-finline-functions[integrate functions not declared "inline" into their callers when profitable]' + '-finline-limit=-[limit the size of inlined functions to <number>]:number: ' + '-finline-small-functions[integrate functions into their callers when code size is known not to grow]' + '-finput-charset=[specify the default character set for source files]:character set' + '-finstrument-functions-exclude-file-list=-[do not instrument functions listed in files]:comma-separated file list:->commafiles' + '-finstrument-functions-exclude-function-list=-[do not instrument listed functions]:comma-separated list of syms: ' + '-finstrument-functions[instrument function entry and exit with profiling calls]' + '-fipa-bit-cp[perform interprocedural bitwise constant propagation]' + '-fipa-cp-clone[perform cloning to make Interprocedural constant propagation stronger]' + '-fipa-cp[perform interprocedural constant propagation]' + '-fipa-icf-functions[perform Identical Code Folding for functions]' + '-fipa-icf[perform Identical Code Folding for functions and read-only variables]' + '-fipa-icf-variables[perform Identical Code Folding for variables]' + '-fipa-profile[perform interprocedural profile propagation]' + '-fipa-pta[perform interprocedural points-to analysis]' + '-fipa-pure-const[discover pure and const functions]' + '-fipa-ra[use caller save register across calls if possible]' + '-fipa-reference[discover readonly and non addressable static variables]' + '-fipa-sra[perform interprocedural reduction of aggregates]' + '-fipa-vrp[perform IPA Value Range Propagation]' + '-fira-algorithm=[set the used IRA algorithm]:algorithm:(cb priority)' + '-fira-hoist-pressure[use IRA based register pressure calculation in RTL hoist optimizations]' + '-fira-loop-pressure[use IRA based register pressure calculation in RTL loop optimizations]' + '-fira-region=-[set regions for IRA]:region:(all mixed one)' + '-fira-region=[set regions for IRA]:region:(one all mixed)' + '-fira-share-save-slots[share slots for saving different hard registers]' + '-fira-share-spill-slots[share stack slots for spilled pseudo-registers]' + '-fira-verbose=-[control IRA'\''s level of diagnostic messages]:verbosity: ' + '-fisolate-erroneous-paths-attribute[detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a returns_nonnull or]' + '-fisolate-erroneous-paths-dereference[detect paths that trigger erroneous or undefined behavior due to dereferencing a null pointer. Isolate those paths from the main]' + '-fivopts[optimize induction variables on trees]' + '-fjump-tables[use jump tables for sufficiently large switch statements]' + '-fkeep-inline-functions[generate code for functions even if they are fully inlined]' + '-fkeep-static-consts[emit static const variables even if they are not used]' + '-flax-vector-conversions[allow implicit conversions between vectors with differing numbers of subparts and/or differing element types]' + '-fleading-underscore[give external symbols a leading underscore]' + '-flifetime-dse[tell DSE that the storage for a C++ object is dead when the constructor starts and when the destructor finishes]' + '-flive-range-shrinkage[relief of register pressure through live range shrinkage]' + '-floop-nest-optimize[enable the loop nest optimizer]' + '-floop-parallelize-all[mark all loops as parallel]' + '-flra-remat[do CFG-sensitive rematerialization in LRA]' + '-flto-compression-level=-[use specified zlib compression level for IL]:compression level: ' + '-flto-odr-type-merging[merge C++ types using One Definition Rule]' + '-flto-partition=-[partition symbols and vars at linktime based on object files they originate from]:partitioning algorithm:(1to1 balanced max one none)' + '-flto-report[report various link-time optimization statistics]' + '-fmath-errno[set errno after built-in math functions]' + '-fmax-errors=-[maximum number of errors to report]:errors: ' + '-fmem-report[report on permanent memory allocation]' + '-fmem-report-wpa[report on permanent memory allocation in WPA only]' + '-fmerge-all-constants[attempt to merge identical constants and constant variables]' + '-fmerge-constants[attempt to merge identical constants across compilation units]' + '-fmerge-debug-strings[attempt to merge identical debug strings across compilation units]' + '-fmessage-length=-[limit diagnostics to <number> characters per line. 0 suppresses line-wrapping]:length: ' + '-fmodulo-sched-allow-regmoves[perform SMS based modulo scheduling with register moves allowed]' + '-fmodulo-sched[perform SMS based modulo scheduling before the first scheduling pass]' + '-fmove-loop-invariants[move loop invariant computations out of loops]' + "-fms-extensions[don't warn about uses of Microsoft extensions]" + '-fmudflapir[this switch lacks documentation]' + '-fmudflap[this switch lacks documentation]' + '-fmudflapth[this switch lacks documentation]' + '-fnon-call-exceptions[support synchronous non-call exceptions]' + '-fno-stack-limit[do not limit the size of the stack]' + '-fno-threadsafe-statics[do not generate thread-safe code for initializing local statics]' + '-fnothrow-opt[treat a throw() exception specification as noexcept to improve code size]' + '-fomit-frame-pointer[when possible do not generate stack frames]' + '-fopenacc[enable OpenACC]' + '-fopenmp[enable OpenMP (implies -frecursive in Fortran)]' + "-fopenmp-simd[enable OpenMP's SIMD directives]" + '-foptimize-sibling-calls[optimize sibling and tail recursive calls]' + '-foptimize-strlen[enable string length optimizations on trees]' + '-fopt-info[enable all optimization info dumps on stderr]' + '-fopt-info-type=-[dump compiler optimization details]:filename:_files' + '-fpack-struct[pack structure members together without holes]' + '-fpack-struct=[set initial maximum structure member alignment]:alignment (power of 2): ' + '-fpartial-inlining[perform partial inlining]' + '-fpcc-struct-return[return small aggregates in memory, not registers]' + '-fpch-deps[this switch lacks documentation]' + '-fpch-preprocess[look for and use PCH files even when preprocessing]' + '-fpeel-loops[perform loop peeling]' + '-fpeephole2[enable an RTL peephole pass before sched2]' + '-fpeephole[enable machine specific peephole optimizations]' + '-fPIC[generate position-independent code if possible (large mode)]' + '-fpic[generate position-independent code if possible (small mode)]' + '-fPIE[generate position-independent code for executables if possible (large mode)]' + '-fpie[generate position-independent code for executables if possible (small mode)]' + '-fplan9-extensions[enable Plan 9 language extensions]' + '-fplt[use PLT for PIC calls (-fno-plt- load the address from GOT at call site)]' + '-fplugin-arg--[specify argument <key>=<value> for plugin <name>]:-fplugin-arg-name-key=value: ' #TODO + '-fplugin=-[specify a plugin to load]:plugin: ' # TODO: complete plugins? + '-fpost-ipa-mem-report[report on memory allocation before interprocedural optimization]' + '-fpredictive-commoning[run predictive commoning optimization]' + '-fprefetch-loop-arrays[generate prefetch instructions, if available, for arrays in loops]' + '-fpre-ipa-mem-report[report on memory allocation before interprocedural optimization]' + '-fpreprocessed[treat the input file as already preprocessed]' + '-fprintf-return-value[treat known sprintf return values as constants]' + '-fprofile-arcs[insert arc-based program profiling code]' + '-fprofile-correction[enable correction of flow inconsistent profile data input]' + '-fprofile-dir=-[set the top-level directory for storing the profile data]:profile directory:_files -/' + '-fprofile[enable basic program profiling code]' + '-fprofile-generate[enable common options for generating profile info for profile feedback directed optimizations]' + '-fprofile-report[report on consistency of profile]' + '-fprofile-use[enable common options for performing profile feedback directed optimizations]' + '-fprofile-values[insert code to profile values of expressions]' + '-frandom-seed=-[use <string> as random seed]:seed: ' + '-freciprocal-math[same as -fassociative-math for expressions which include division]' + '-frecord-gcc-switches[record gcc command line switches in the object file]' + '-free[turn on Redundant Extensions Elimination pass]' + '-freg-struct-return[return small aggregates in registers]' + '-frename-registers[perform a register renaming optimization pass]' + '-freorder-blocks-algorithm=[set the used basic block reordering algorithm]:algorithm:(simple stc)' + '-freorder-blocks-and-partition[reorder basic blocks and partition into hot and cold sections]' + '-freorder-blocks[reorder basic blocks to improve code placement]' + '-freorder-functions[reorder functions to improve code placement]' + '-frequire-return-statement[functions which return values must end with return statements]' + '-frerun-cse-after-loop[add a common subexpression elimination pass after loop optimizations]' + '-freschedule-modulo-scheduled-loops[enable/disable the traditional scheduling in loops that already passed modulo scheduling]' + '-frounding-math[disable optimizations that assume default FP rounding behavior]' + '-frtti[generate run time type descriptor information]' + "-fsanitize=-[enable AddressSanitizer, a memory error detector]:style:($sanitizers)" + '-fsched2-use-superblocks[if scheduling post reload, do superblock scheduling]' + '-fsched-critical-path-heuristic[enable the critical path heuristic in the scheduler]' + '-fsched-dep-count-heuristic[enable the dependent count heuristic in the scheduler]' + '-fsched-group-heuristic[enable the group heuristic in the scheduler]' + '-fsched-interblock[enable scheduling across basic blocks]' + '-fsched-last-insn-heuristic[enable the last instruction heuristic in the scheduler]' + '-fsched-pressure[enable register pressure sensitive insn scheduling]' + '-fsched-rank-heuristic[enable the rank heuristic in the scheduler]' + '-fsched-spec[allow speculative motion of non-loads]' + '-fsched-spec-insn-heuristic[enable the speculative instruction heuristic in the scheduler]' + '-fsched-spec-load[allow speculative motion of some loads]' + '-fsched-spec-load-dangerous[allow speculative motion of more loads]' + '-fsched-stalled-insns[allow premature scheduling of queued insns]' + '-fsched-stalled-insns-dep[set dependence distance checking in premature scheduling of queued insns]' + '-fsched-stalled-insns-dep=[set dependence distance checking in premature scheduling of queued insns]:insns:' + '-fsched-stalled-insns-dep=-[set dependence distance checking in premature scheduling of queued insns]:instructions: ' + '-fsched-stalled-insns=[set number of queued insns that can be prematurely scheduled]:insns:' + '-fsched-stalled-insns=-[set number of queued insns that can be prematurely scheduled]:instructions: ' + '-fschedule-fusion[perform a target dependent instruction fusion optimization pass]' + '-fschedule-insns2[reschedule instructions after register allocation]' + '-fschedule-insns[reschedule instructions before register allocation]' + '-fsched-verbose=-[set the verbosity level of the scheduler]:verbosity: ' + '-fsection-anchors[access data in the same section from shared anchor points]' + '-fselective-scheduling2[run selective scheduling after reload]' + '-fselective-scheduling[schedule instructions using selective scheduling algorithm]' + '-fsel-sched-pipelining-outer-loops[perform software pipelining of outer loops during selective scheduling]' + '-fsel-sched-pipelining[perform software pipelining of inner loops during selective scheduling]' + '-fsel-sched-reschedule-pipelined[reschedule pipelined regions without pipelining]' + '-fshort-double[use the same size for double as for float]' + '-fshort-enums[use the narrowest integer type possible for enumeration types]' + '-fshort-wchar[force the underlying type for "wchar_t" to be "unsigned short"]' + '-fshow-column[show column numbers in diagnostics, when available]' + '-fshrink-wrap[emit function prologues only before parts of the function that need it, rather than at the top of the function]' + '-fshrink-wrap-separate[shrink-wrap parts of the prologue and epilogue separately]' + '-fsignaling-nans[disable optimizations observable by IEEE signaling NaNs]' + '-fsigned-bitfields[when signed or unsigned is not given make the bitfield signed]' + '-fsigned-char[make char signed by default]' + '-fsigned-zeros[disable floating point optimizations that ignore the IEEE signedness of zero]' + '-fsimd-cost-model=[specifies the vectorization cost model for code marked with a simd directive]:model:(unlimited dynamic cheap)' + '-fsingle-precision-constant[convert floating point constants to single precision constants]' + '-fsplit-ivs-in-unroller[split lifetimes of induction variables when loops are unrolled]' + '-fsplit-loops[perform loop splitting]' + '-fsplit-paths[split paths leading to loop backedges]' + '-fsplit-stack[generate discontiguous stack frames]' + '-fsplit-wide-types[split wide types into independent registers]' + '-fssa-backprop[enable backward propagation of use properties at the SSA level]' + '-fssa-phiopt[optimize conditional patterns using SSA PHI nodes]' + '-fstack-check=-[insert stack checking code into the program. -fstack-check=specific if to argument given]:type:(none generic specific)' + '-fstack-limit-register=-[trap if the stack goes past <register>]:register: ' + '-fstack-limit-symbol=-[trap if the stack goes past symbol <name>]:name: ' + '-fstack-protector-all[use a stack protection method for every function]' + '-fstack-protector-explicit[use stack protection method only for functions with the stack_protect attribute]' + '-fstack-protector-strong[use a smart stack protection method for certain functions]' + '-fstack-protector[use propolice as a stack protection method]' + '-fstack-reuse=[set stack reuse level for local variables]:level:(all named_vars none)' + '-fstack-reuse=-[set stack reuse level for local variables]:reuse-level:(all named_vars none)' + '-fstack-usage[output stack usage information on a per-function basis]' + '-fstdarg-opt[optimize amount of stdarg registers saved to stack at start of function]' + '-fstore-merging[merge adjacent stores]' + '-fstrict-aliasing[assume strict aliasing rules apply]' + '-fstrict-enums[assume that values of enumeration type are always within the minimum range of that type]' + '-fstrict-overflow[treat signed overflow as undefined]' + '-fstrict-volatile-bitfields[force bitfield accesses to match their type width]' + '-fsync-libcalls[implement __atomic operations via libcalls to legacy __sync functions]' + '-fsyntax-only[check for syntax errors, then stop]' + '-ftabstop=[distance between tab stops for column reporting]:number' + '-ftest-coverage[create data files needed by "gcov"]' + '-fthread-jumps[perform jump threading optimizations]' + '-ftime-report[report the time taken by each compiler pass]' + '-ftls-model=-[set the default thread-local storage code generation model]:TLS model:(global-dynamic local-dynamic initial-exec local-exec)' + '-ftracer[perform superblock formation via tail duplication]' + '-ftrack-macro-expansion=[track locations of tokens coming from macro expansion and display them in error messages]::argument' + '-ftrapping-math[assume floating-point operations can trap]' + '-ftrapv[trap for signed overflow in addition, subtraction and multiplication]' + '-ftree-bit-ccp[enable SSA-BIT-CCP optimization on trees]' + '-ftree-builtin-call-dce[enable conditional dead code elimination for builtin calls]' + '-ftree-ccp[enable SSA-CCP optimization on trees]' + '-ftree-ch[enable loop header copying on trees]' + '-ftree-coalesce-vars[enable SSA coalescing of user variables]' + '-ftree-copy-prop[enable copy propagation on trees]' + '-ftree-cselim[transform condition stores into unconditional ones]' + '-ftree-dce[enable SSA dead code elimination optimization on trees]' + '-ftree-dominator-opts[enable dominator optimizations]' + '-ftree-dse[enable dead store elimination]' + '-ftree-forwprop[enable forward propagation on trees]' + '-ftree-fre[enable Full Redundancy Elimination (FRE) on trees]' + '-ftree-loop-distribute-patterns[enable loop distribution for patterns transformed into a library call]' + '-ftree-loop-distribution[enable loop distribution on trees]' + '-ftree-loop-if-convert[convert conditional jumps in innermost loops to branchless equivalents]' + '-ftree-loop-im[enable loop invariant motion on trees]' + '-ftree-loop-ivcanon[create canonical induction variables in loops]' + '-ftree-loop-linear[enable loop interchange transforms. Same as -floop-interchange]' + '-ftree-loop-optimize[enable loop optimizations on tree level]' + '-ftree-loop-vectorize[enable loop vectorization on trees]' + '-ftree-lrs[perform live range splitting during the SSA- >normal pass]' + '-ftree-parallelize-loops=[enable automatic parallelization of loops]' + '-ftree-parallelize-loops=-[enable automatic parallelization of loops]:threads: ' + '-ftree-partial-pre[in SSA-PRE optimization on trees, enable partial- partial redundancy elimination]' + '-ftree-phiprop[enable hoisting loads from conditional pointers]' + '-ftree-pre[enable SSA-PRE optimization on trees]' + '-ftree-pta[perform function-local points-to analysis on trees]' + '-ftree-reassoc[enable reassociation on tree level]' + '-ftree-scev-cprop[enable copy propagation of scalar-evolution information]' + '-ftree-sink[enable SSA code sinking on trees]' + '-ftree-slp-vectorize[enable basic block vectorization (SLP) on trees]' + '-ftree-slsr[perform straight-line strength reduction]' + '-ftree-sra[perform scalar replacement of aggregates]' + '-ftree-switch-conversion[perform conversions of switch initializations]' + '-ftree-tail-merge[enable tail merging on trees]' + '-ftree-ter[replace temporary expressions in the SSA->normal pass]' + '-ftree-vectorize[enable vectorization on trees]' + '-ftree-vrp[perform Value Range Propagation on trees]' + '-funconstrained-commons[assume common declarations may be overridden with ones with a larger trailing array]' + '-funroll-all-loops[perform loop unrolling for all loops]' + '-funroll-loops[perform loop unrolling when iteration count is known]' + '-funsafe-loop-optimizations[allow loop optimizations to assume that the loops behave in normal way]' + '-funsafe-math-optimizations[allow math optimizations that may violate IEEE or ISO standards]' + '-funsigned-bitfields[when signed or unsigned is not given make the bitfield unsigned]' + '-funsigned-char[make char unsigned by default]' + '-funswitch-loops[perform loop unswitching]' + '-funwind-tables[just generate unwind tables for exception handling]' + '-fuse-ld=-[use the specified linker instead of the default linker]:linker:(bfd gold)' + '-fuse-linker-plugin[use linker plugin during link-time optimization]' + '-fvariable-expansion-in-unroller[apply variable expansion when loops are unrolled]' + '-fvar-tracking-assignments[perform variable tracking by annotating assignments]' + '-fvar-tracking-assignments-toggle[toggle -fvar-tracking-assignments]' + '-fvar-tracking[perform variable tracking]' + '-fvar-tracking-uninit[perform variable tracking and also tag variables that are uninitialized]' + '-fvect-cost-model=[specifies the cost model for vectorization]:model:(unlimited dynamic cheap)' + '-fverbose-asm[add extra commentary to assembler output]' + '-fvisibility=-[set the default symbol visibility]:visibility:(default internal hidden protected)' + '-fvpt[use expression value profiles in optimizations]' + '-fweb[construct webs and split unrelated uses of single variable]' + '-fwhole-program[perform whole program optimizations]' + '-fwide-exec-charset=[convert all wide strings and character constants to character set]:character set' + '-fworking-directory[generate a #line directive pointing at the current working directory]' + '-fwrapv[assume signed arithmetic overflow wraps around]' + '-fzero-initialized-in-bss[put zero initialized data in the bss section]' + {-g-,--debug=}'[generate debug information]::debugging information type or level:(0 1 2 3 gdb gdb0 gdb1 gdb2 gdb3 coff stabs stabs+ dwarf dwarf+ dwarf-2 dwarf-3 dwarf-4 dwarf-5 dwarf32 dwarf64 xcoff xcoff+)' + '-gno-pubnames[don'\''t generate DWARF pubnames and pubtypes sections]' + '-gno-record-gcc-switches[don'\''t record gcc command line switches in DWARF DW_AT_producer]' + '-gno-split-dwarf[don'\''t generate debug information in separate .dwo files]' + '-gno-strict-dwarf[emit DWARF additions beyond selected version]' + '-gpubnames[generate DWARF pubnames and pubtypes sections]' + '-grecord-gcc-switches[record gcc command line switches in DWARF DW_AT_producer]' + '-gsplit-dwarf[generate debug information in separate .dwo files]' + '-gstrict-dwarf[don'\''t emit DWARF additions beyond selected version]' + '-gtoggle[toggle debug information generation]' + '-gvms[generate debug information in VMS format]' + '--help[display this information]' + {-H,--trace-includes}'[print name of each header file used]' + {'*-idirafter','*--include-directory-after='}'[add directory after include search path]:second include path directory:_files -/' + {'*-I-','*--include-directory='}'[add directory to include search path]:header file search path:_files -/' + {'*-imacros','*--imacros='}'[include macros from file before parsing]:macro input file:_files -g \*.h\(-.\)' + '-imultiarch[set <dir> to be the multiarch include subdirectory]:directory:_files -/' #XXX not in manpage + '-imultilib=[set dir to be the multilib include subdirectory]:dir:_files -/' + '--include-barrier[restrict all prior -I flags to double-quoted inclusion and remove current directory from include path]' + {'*-include=','*--include='}'[include file before parsing]:include file:_files -g \*.h\(-.\)' + '-iplugindir=-[set <dir> to be the default plugin directory]:directory:_files -/' + {'*-iprefix','*--include-prefix='}'[set the -iwithprefix prefix]:prefix:_files' + '-iquote=[add dir to the end of the quote include path]:dir:_files -/' + '-isysroot=[set dir to be the system root directory]:dir:_files -/' + '*-isystem[add directory to system include search path]:second include path directory (system):_files -/' + {'*-iwithprefixbefore','*--include-with-prefix-before='}'[set directory to include search path with prefix]:main include path directory:_files -/' + {'*-iwithprefix','*--include-with-prefix=','*--include-with-prefix-after='}'[set directory to system include search path with prefix]:second include path directory:_files -/' + '*-L-[add directory to library search path]:library search path:_files -/' + '-lang-asm[set lang asm]' + '*-l+[include library found in search path]:library:->library' + '-MF[write dependency output to the given file]:file:_files' + '-MJ[write a compilation database entry per input]' + '-MQ[add a make-quoted target]:target' + '*-M-[set flags for generating Makefile dependencies]::output dependencies:->dependencies' + '-MT[add an unquoted target]:target' + '-no-canonical-prefixes[do not canonicalize paths when building relative prefixes to other gcc components]' + '-nodefaultlibs[do not use the standard system libraries when linking]' + '-nostartfiles[do not use the standard system startup files when linking]' + {-nostdinc,--no-standard-includes}'[do not search standard system directories or compiler builtin directories for include files]' + '-nostdlib[do not use standard system startup files or libraries when linking]' + {-O-,--optimize=-}'[control the optimization]::optimization level:((0 1 2 3 g\:optimize\ for\ debugging\ experience s\:optimize\ for\ space fast\:optimize\ for\ speed\ disregarding\ exact\ standards\ compliance))' + {-o,--output=}'[write output to file]:output file:_files -g "^*.(c|h|cc|C|cxx|cpp|hpp)(-.)"' + '--output-pch=[output pch]' + '--param[set parameter <param> to value. See manpage for a complete list of parameters]:name=value' + '-pass-exit-codes[exit with highest error code from a phase]' + {-pedantic-errors,--pedantic-errors}'[like -pedantic but issue them as errors]' + {-pedantic,--pedantic}'[issue all mandatory diagnostics in the C standard]' + '(-pg)-p[enable function profiling for prof]' + '-pie[create a position independent executable]' + {-pipe,--pipe}'[use pipes rather than intermediate files]' + {-P,--no-line-commands}'[inhibit generation of linkemakers during preprocess]' + '(-p)-pg[enable function profiling for gprof]' + '-###[print commands to run this compilation]' + '-print-file-name=-[display the full path to library <library>]:library:->library' + '-print-libgcc-file-name[display the name of the compiler'\''s companion library]' + '--print-missing-file-dependencies[print missing file dependencies]' + '-print-multiarch[display the target'\''s normalized GNU triplet, used as a component in the library path]' + '-print-multi-directory[display the root directory for versions of libgcc]' + '-print-multi-lib[display the mapping between command line options and multiple library search directories]' + '-print-multi-os-directory[display the relative path to OS libraries]' + '-print-prog-name=-[display the full path to compiler component <program>]:program:' + '-print-search-dirs[display the directories in the compiler'\''s search path]' + '-print-sysroot[display the target libraries directory]' + '-print-sysroot-headers-suffix[display the sysroot suffix used to find headers]' + {-Qn,-fno-ident}'[do not emit metadata containing compiler name and version]' + '-quiet[do not display functions compiled or elapsed time]' + {-Qy,-fident}'[emit metadata containing compiler name and version]' + '-rdynamic[pass the flag -export-dynamic to the ELF linker, on targets that support it]' + '-remap[remap file names when including files]' + {-S,--assemble}'[compile only; do not assemble or link]' + '-save-stats=-[save code generation statistics]:location:(cwd obj)' + '-save-temps[do not delete intermediate files]' + '-shared[create a shared library]' + '-shared-libgcc[force shared libgcc]' + '*-specs=-[override built-in specs with the contents of <file>]:file:_files' + '-s[remove all symbol table and relocation information from the executable]' + '-static-libgcc[force static libgcc]' + '-static[on systems that support dynamic linking, this prevents linking with the shared libraries]' + {'-std=-','--std='}'[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899\:1990 iso9899\:199409 c99 iso9899\:1999 c11 iso9899\:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899\:2017 gnu++17 c++2a gnu++2a)' + '-symbolic[bind references to global symbols when building a shared object]' + '--sysroot=-[use <directory> as the root directory for headers and libraries]:directory:_files -/' + '--target-help[display target specific command line options]' + '-time[time the execution of each subprocess]' + {-traditional-cpp,--traditional-cpp}'[use traditional preprocessor]' + {-trigraphs,--trigraphs}'[process trigraph sequences]' + '-T[specify linker script]:linker script:_files' + '-undef[do not predefine system specific and gcc specific macros]' + '*-u[pretend symbol to be undefined]:symbol:' + '--user-dependencies[print user dependencies]' + {'*-U-','*--undefine-macro='}'[undefine a macro]:undefine macro:' + '-version[display the compiler'\''s version]' + '--version[display version information]' + '-V[specify compiler version]:compiler version:' + {-v,--verbose}'[enable verbose output]' + '*-Wa,-[pass arguments to the assembler]:assembler option:' + '--warn--[enable the specified warning]:warning:->warning' + '*-Werror=-[treat specified warning as error (or all if none specified)]::warning:->warning' + '-Wfatal-errors[exit on the first error occurred]' + '*-Wl,-[pass arguments to the linker]:linker option:' + {-w,--no-warnings}'[suppress warnings]' + '*-Wp,-[pass arguments to the preprocessor]:preprocessor option:' + '--write-dependencies[write a depfile containing user and system dependencies]' + '--write-user-dependencies[write a depfile containing user dependencies]' + '*-Xassembler[pass argument to the assembler]:assembler option:' + '*-Xlinker[pass argument to the linker]:linker option:' + '*-Xpreprocessor[pass argument to the preprocessor]:preprocessor option:' + '-x[specify the language of the following input files]:input file language:('"$languages"')' ) -# other common options, gcc --help=warnings --help=optimizers --help=common|sed 1,/language-independent/d -args+=( -# | grep -v :: - '--help[Display this information]' - '--no-warnings[Same as -w]' - '--optimize[Same as -O]' - '--output[Same as -o]' - '--param[Set parameter <param> to value. See manpage for a complete list of parameters]:name=value' - '--verbose[Same as -v]' - '--version[Display version information]' - '-aux-info[Emit declaration information into <file>]:file:_files' - '-dumpbase[Set the file basename to be used for dumps]:file:_files' - '-dumpdir[Set the directory name to be used for dumps]:file:_files -/' - '-fPIC[Generate position-independent code if possible (large mode)]' - '-fPIE[Generate position-independent code for executables if possible (large mode)]' - '-fassociative-math[Allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]' - '-fauto-inc-dec[Generate auto-inc/dec instructions]' - '-fbounds-check[Generate code to check bounds before indexing arrays]' - '-fcall-saved--[Mark <register> as being preserved across functions]:register' - '-fcall-used--[Mark <register> as being corrupted by function calls]:register' - '-fcheck-data-deps[Compare the results of several data dependence analyzers]' - '-fcompare-debug-second[Run only the second compilation of -fcompare-debug]' - '-fcompare-debug=-[Compile with and without e.g. -gtoggle, and compare the final-insns dump]:opts:' #TODO: complete gcc options here - '-fdbg-cnt-list[List all available debugging counters with their limits and counts]' - '-fdbg-cnt=-[,<counter>-<limit>,...) Set the debug counter limit]:counter\:limit,...: ' #TODO: gcc -fdbg-cnt-list -x c /dev/null -o /dev/null -c - '-fdebug-types-section[Output .debug_types section when using DWARF v4 debuginfo]' - '-fdelete-dead-exceptions[Delete dead instructions that may throw exceptions]' - '-fdiagnostics-color=-[Colorize diagnostics]::color:(never always auto)' - '-fdiagnostics-generate-patch[Print fix-it hints to stderr in unified diff format]' - '-fdiagnostics-parseable-fixits[Print fixit hints in machine-readable form]' - '-fdiagnostics-show-caret[Show the source line with a caret indicating the column]' - '-fdiagnostics-show-location=-[How often to emit source location at the beginning of line-wrapped diagnostics]:source location:(once every-line)' - '-fdiagnostics-show-option[Amend appropriate diagnostic messages with the command line option that controls them]' - #not meant for end users - #'-fdisable--pass=-[disables an optimization pass]:range1+range2: ' - #'-fdisable-[disables an optimization pass]' - #'-fenable--pass=-[enables an optimization pass]:range1+range2: ' - #'-fenable-[enables an optimization pass]' - #'-fdump-<type>[Dump various compiler internals to a file]' - '-fdump-final-insns=-[Dump to filename the insns at the end of translation]:filename:_files' - '-fdump-go-spec=-[Write all declarations to file as Go code]:filename:_files' - '-fdump-noaddr[Suppress output of addresses in debugging dumps]' - '-fdump-passes[Dump optimization passes]' - '-fdump-unnumbered-links[Suppress output of previous and next insn numbers in debugging dumps]' - '-fdump-unnumbered[Suppress output of instruction numbers, line number notes and addresses in debugging dumps]' - '-fdwarf2-cfi-asm[Enable CFI tables via GAS assembler directives]' - '-feliminate-dwarf2-dups[Perform DWARF2 duplicate elimination]' - '-feliminate-unused-debug-symbols[Perform unused type elimination in debug info]' - '-feliminate-unused-debug-types[Perform unused type elimination in debug info]' - '-femit-class-debug-always[Do not suppress C++ class debug information]' - '-fexcess-precision=-[Specify handling of excess floating-point precision]:precision handling:(fast standard)' - '-ffast-math[Sets -fno-math-errno, -funsafe-math-optimizations, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans and -fcx-limited-range]' - '-ffat-lto-objects[Output lto objects containing both the intermediate language and binary output]' - '-ffixed--[Mark <register> as being unavailable to the compiler]:register' - '-ffunction-cse[Allow function addresses to be held in registers]' - '-ffunction-sections[Place each function into its own section]' - '-fgnu-tm[Enable support for GNU transactional memory]' - '-fgraphite[Enable in and out of Graphite representation]' - '-fident[Process #ident directives]' - '-findirect-inlining[Perform indirect inlining]' - '-finhibit-size-directive[Do not generate .size directives]' - '-finline-limit=-[Limit the size of inlined functions to <number>]:number: ' - '-finstrument-functions[Instrument function entry and exit with profiling calls]' - '-fira-loop-pressure[Use IRA based register pressure calculation in RTL loop optimizations]' - '-fira-share-save-slots[Share slots for saving different hard registers]' - '-fira-share-spill-slots[Share stack slots for spilled pseudo-registers]' - '-fira-verbose=-[Control IRA'\''s level of diagnostic messages]:verbosity: ' - '-fkeep-inline-functions[Generate code for functions even if they are fully inlined]' - '-fkeep-static-consts[Emit static const variables even if they are not used]' - '-fleading-underscore[Give external symbols a leading underscore]' - '-flto-compression-level=-[Use specified zlib compression level for IL]:compression level: ' - '-flto-odr-type-merging[Merge C++ types using One Definition Rule]' - '-flto-partition=-[Partition symbols and vars at linktime based on object files they originate from]:partitioning algorithm:(1to1 balanced max one none)' - '-flto-report[Report various link-time optimization statistics]' - '-fmax-errors=-[Maximum number of errors to report]:errors: ' - '-fmem-report-wpa[Report on permanent memory allocation in WPA only]' - '-fmem-report[Report on permanent memory allocation]' - '-fmerge-debug-strings[Attempt to merge identical debug strings across compilation units]' - '-fmessage-length=-[Limit diagnostics to <number> characters per line. 0 suppresses line-wrapping]:length: ' - '-fmodulo-sched-allow-regmoves[Perform SMS based modulo scheduling with register moves allowed]' - '-fopt-info-type=-[Dump compiler optimization details]:filename:_files' - '-fopt-info[Dump compiler optimization details]' - '-fpartial-inlining[Perform partial inlining]' - '-fpcc-struct-return[Return small aggregates in memory, not registers]' - '-fpic[Generate position-independent code if possible (small mode)]' - '-fpie[Generate position-independent code for executables if possible (small mode)]' - '-fplugin-arg--[Specify argument <key>=<value> for plugin <name>]:-fplugin-arg-name-key=value: ' #TODO - '-fpost-ipa-mem-report[Report on memory allocation before interprocedural optimization]' - '-fpre-ipa-mem-report[Report on memory allocation before interprocedural optimization]' - '-fprofile-arcs[Insert arc-based program profiling code]' - '-fprofile-correction[Enable correction of flow inconsistent profile data input]' - '-fprofile-generate[Enable common options for generating profile info for profile feedback directed optimizations]' - '-fprofile-report[Report on consistency of profile]' - '-fprofile-use[Enable common options for performing profile feedback directed optimizations]' - '-fprofile-values[Insert code to profile values of expressions]' - '-fprofile[Enable basic program profiling code]' - '-frandom-seed=-[Use <string> as random seed]:seed: ' - '-freciprocal-math[Same as -fassociative-math for expressions which include division]' - '-frecord-gcc-switches[Record gcc command line switches in the object file]' - '-free[Turn on Redundant Extensions Elimination pass]' - "-fsanitize=-[Enable AddressSanitizer, a memory error detector]:style:($sanitizers)" - '-fsched-stalled-insns-dep=-[Set dependence distance checking in premature scheduling of queued insns]:instructions: ' - '-fsched-stalled-insns=-[Set number of queued insns that can be prematurely scheduled]:instructions: ' - '-fsched-verbose=-[Set the verbosity level of the scheduler]:verbosity: ' - '-fshow-column[Show column numbers in diagnostics, when available]' - '-fsplit-stack[Generate discontiguous stack frames]' - '-fstack-check=-[Insert stack checking code into the program. -fstack-check=specific if to argument given]:type:(none generic specific)' - '-fstack-limit-register=-[Trap if the stack goes past <register>]:register: ' - '-fstack-limit-symbol=-[Trap if the stack goes past symbol <name>]:name: ' - '-fno-stack-limit' - '-fstack-protector-all[Use a stack protection method for every function]' - '-fstack-protector[Use propolice as a stack protection method]' - '-fstack-usage[Output stack usage information on a per-function basis]' - '-fstrict-overflow[Treat signed overflow as undefined]' - '-fstrict-volatile-bitfields[Force bitfield accesses to match their type width]' - '-fsync-libcalls[Implement __atomic operations via libcalls to legacy __sync functions]' - '-fsyntax-only[Check for syntax errors, then stop]' - '-ftest-coverage[Create data files needed by "gcov"]' - '-ftime-report[Report the time taken by each compiler pass]' - '-ftls-model=-[Set the default thread-local storage code generation model]:TLS model:(global-dynamic local-dynamic initial-exec local-exec)' - '-ftracer[Perform superblock formation via tail duplication]' - '-ftree-loop-linear[Enable loop interchange transforms. Same as -floop-interchange]' - '-fuse-ld=-[Use the specified linker instead of the default linker]:linker:(bfd gold)' - '-fuse-linker-plugin[Use linker plugin during link-time optimization]' - '-fverbose-asm[Add extra commentary to assembler output]' - '-fvisibility=-[Set the default symbol visibility]:visibility:(default internal hidden protected)' - '-fzero-initialized-in-bss[Put zero initialized data in the bss section]' - '-gno-pubnames[Don'\''t generate DWARF pubnames and pubtypes sections]' - '-gno-record-gcc-switches[Don'\''t record gcc command line switches in DWARF DW_AT_producer]' - '-gno-split-dwarf[Don'\''t generate debug information in separate .dwo files]' - '-gno-strict-dwarf[Emit DWARF additions beyond selected version]' - '-gpubnames[Generate DWARF pubnames and pubtypes sections]' - '-grecord-gcc-switches[Record gcc command line switches in DWARF DW_AT_producer]' - '-gsplit-dwarf[Generate debug information in separate .dwo files]' - '-gstrict-dwarf[Don'\''t emit DWARF additions beyond selected version]' - '-gtoggle[Toggle debug information generation]' - '-gvms[Generate debug information in VMS format]' - '-imultiarch[Set <dir> to be the multiarch include subdirectory]:directory:_files -/' #XXX not in manpage - '-iplugindir=-[Set <dir> to be the default plugin directory]:directory:_files -/' - '(-pg)-p[Enable function profiling for prof]' - '(-p)-pg[Enable function profiling for gprof]' - '-pedantic-errors[Like -pedantic but issue them as errors]' - '-pedantic[Issue all mandatory diagnostics in the C standard]' - '-quiet[Do not display functions compiled or elapsed time]' - '-v[Enable verbose output]' - '-version[Display the compiler'\''s version]' - '-w[Suppress warnings]' -# | grep :: - '-fabi-version=-[Use version <n> of the C++ ABI (default: 2)]:ABI version:(1 2 3 4 5 6)' - '-fdebug-prefix-map=-[Map one directory name to another in debug information]:/old/dir=/new/dir:->dirtodir' - '-ffp-contract=-[Perform floating- point expression contraction (default: fast)]:style:(on off fast)' - '-finstrument-functions-exclude-file-list=-[Do not instrument functions listed in files]:comma-separated file list:->commafiles' - '-finstrument-functions-exclude-function-list=-[Do not instrument listed functions]:comma-separated list of syms: ' - '-fira-algorithm=-[Set the used IRA algorithm]:algorithm:(priority CB)' - '-fira-region=-[Set regions for IRA]:region:(all mixed one)' - '-fplugin=-[Specify a plugin to load]:plugin: ' # TODO: complete plugins? - '-fprofile-dir=-[Set the top-level directory for storing the profile data]:profile directory:_files -/' - '-fstack-reuse=-[Set stack reuse level for local variables]:reuse-level:(all named_vars none)' - '-ftree-parallelize-loops=-[Enable automatic parallelization of loops]:threads: ' -) +# not meant for end users +#'-fdisable--pass=-[disables an optimization pass]:range1+range2: ' +#'-fdisable-[disables an optimization pass]' +#'-fenable--pass=-[enables an optimization pass]:range1+range2: ' +#'-fenable-[enables an optimization pass]' +#'-fdump-<type>[dump various compiler internals to a file]' + +args+=($warnings) # How to mostly autogenerate the above stuff: # joinhelplines() { sed '$!N;s/^\( -.*\)\n \s*\([^-]\)/\1 \2/;P;D' } # gcc-x86() { gcc --help=target,\^undocumented | joinhelplines | joinhelplines } # compdef _gnu_generic gcc-x86 # printf '%s\n' ${(onq-)_args_cache_gcc_x86} + +# TODO: -fno-<TAB> and -mno-<TAB> match lots of non-existent options. _arguments -C -M 'L:|-{fWm}no-=-{fWm} r:|[_-]=* r:|=*' \ "$args[@]" \ "$args2[@]" && ret=0 - case "$state" in dump) - _values -s '' 'dump information' \ - 'M[only macro definitions]' \ - 'N[macro names]' \ - 'D[macro definitions and normal output]' \ - 'y[debugging information during parsing]' \ - 'r[after RTL generation]' \ - 'x[only generate RTL]' \ - 'j[after jump optimization]' \ - 's[after CSE]' \ - 'L[after loop optimization]' \ - 't[after second CSE pass]' \ - 'f[after flow analysis]' \ - 'c[after instruction combination]' \ - 'S[after first instruction scheduling pass]' \ - 'l[after local register allocation]' \ - 'g[after global register allocation]' \ - 'R[after second instruction scheduling pass]' \ - 'J[after last jump optimization]' \ - 'd[after delayed branch scheduling]' \ - 'k[after conversion from registers to stack]' \ - 'a[all dumps]' \ - 'm[print memory usage statistics]' \ - 'p[annotate assembler output]' && ret=0 + local -a dump_values=( + 'A[verbose assembly output]' + 'D[macro definitions and normal output]' + 'I[include directives and normal output]' + 'J[after last jump optimization]' + 'L[after loop optimization]' + 'M[only macro definitions]' + 'N[macro names]' + 'R[after second instruction scheduling pass]' + 'S[after first instruction scheduling pass]' + 'a[all dumps]' + 'c[after instruction combination]' + 'd[after delayed branch scheduling]' + 'f[after flow analysis]' + 'g[after global register allocation]' + 'j[after jump optimization]' + 'k[after conversion from registers to stack]' + 'l[after local register allocation]' + 'm[print memory usage statistics]' + 'p[annotate assembler output]' + 'r[after RTL generation]' + 's[after CSE]' + 't[after second CSE pass]' + 'x[only generate RTL]' + 'y[debugging information during parsing]' + ) + _values -s '' 'dump information' $dump_values && ret=0 + ;; +dependencies) + local -a dependencies=( + 'D:generate make dependencies and compile' + 'G:treat missing header files as generated' + 'M:only user header files' + 'MD:output to file' + 'P:generate phony targets for all headers' + 'V:use NMake/Jom format for the depfile' + ) + _describe dependencies dependencies && ret=0 ;; library) + # TODO: improve defaults for library_path (e.g., use output of clang -Wl,-v) + local -a library_path=( /usr/lib /usr/local/lib ) + case $OSTYPE in + (darwin*) + library_path+=( $(xcrun --show-sdk-path)/usr/lib ) + ;; + (linux-gnu) + local tmp + tmp=$(_call_program library-paths $words[1] -print-multiarch) + if [[ $tmp != '' && -d /usr/lib/$tmp ]]; then + library_path+=( /usr/lib/$tmp ) + elif [[ -d /usr/lib64 ]]; then + library_path+=( /usr/lib64 ) + fi + ;; + esac + # Add directories from -L options + for ((i = 2; i < $#words; i++)); do + if [[ "$words[i]" = -L ]]; then + library_path+=("$words[++i]") + elif [[ "$words[i]" = -L* ]]; then + library_path+=("${words[i]##-L}") + fi + done _wanted libraries expl library \ - compadd - ${^=LD_LIBRARY_PATH:-/usr/lib /usr/local/lib}/lib*.(a|so*)(:t:fr:s/lib//) && ret=0 + compadd - $library_path/lib*.(a|so*|dylib)(:t:fr:s/lib//) && ret=0 ;; rundir) compset -P '*:' @@ -1219,7 +2249,39 @@ commafiles) compset -P '*,' _files && ret=0 ;; +framework) + local -a framework_path=() + case $OSTYPE in + darwin*) + framework_path=( $(xcrun --show-sdk-path)/System/Library/Frameworks ) ;; + esac + # Add directories from -F options + for ((i = 2; i < $#words; i++)); do + if [[ "$words[i]" = -F ]]; then + framework_path+=("$words[++i]") + elif [[ "$words[i]" = -F* ]]; then + framework_path+=("${words[i]##-F}") + fi + done + _wanted frameworks expl framework \ + compadd -- $framework_path/*.framework(:t:r) && ret=0 + ;; +warning) + local -a warning_names + for warning in $warnings; do + if [[ "$warning" = (#b)-W([^=\[]##)[^\[]#\[(*)\]* ]]; then + warning_names+=("$match[1]:$match[2]") + fi + done + _describe warning warning_names && ret=0 + ;; +arch) + _wanted cputypes expl "CPU type" compadd -a arch && ret=0 + ;; +archgeneric) + arch+=(generic) + _wanted cputypes expl "CPU type" compadd -a arch && ret=0 + ;; esac return ret - diff --git a/Completion/Unix/Command/_gcore b/Completion/Unix/Command/_gcore index 07a65cd9a..a31a81267 100644 --- a/Completion/Unix/Command/_gcore +++ b/Completion/Unix/Command/_gcore @@ -49,10 +49,20 @@ case $OSTYPE in '::executable:' \ ':pid:_pids' ;; + darwin*) + _arguments -s -A '-*' \ + '-s[suspend the process while the core file is captured]' \ + '-v[report progress on the dump as it proceeds]' \ + '-b+[specify maximum size of core file]:size (MiB): ' \ + '(-c)-o+[write core file to specified file]:file:_files' \ + '(-o)-c+[specify format of core file name]:format (%%N\:program name, %%U\:uid, %%P\:pid, %%T\:time stamp)' \ + '1:pid:_pids' + ;; *) # GNU GDB gcore - _arguments \ - '-o[set core file base name]:file base name:_files' \ - ':pid:_pids' + _arguments -s -A '-*' \ + '-a[dump all memory mappings]' \ + '-o+[set core file base name]:file base name:_files' \ + '*:pid:_pids' ;; esac diff --git a/Completion/Unix/Command/_gdb b/Completion/Unix/Command/_gdb index 18f797633..6bdd55946 100644 --- a/Completion/Unix/Command/_gdb +++ b/Completion/Unix/Command/_gdb @@ -40,9 +40,9 @@ else (-b) _baudrates && return 0 ;; esac - w=( "${(@)words[2,-1]}" ) + w=( "${(@)words[2,CURRENT-1]}" ) while [[ "$w[1]" = -* ]]; do - [[ "$w[1]" = -[decsxb] ]] && shift 1 w + [[ "$w[1]" = -(cd|se|tty|[decsxb]) ]] && shift 1 w shift 1 w done diff --git a/Completion/Unix/Command/_gem b/Completion/Unix/Command/_gem index b35a5c358..7d81619bb 100644 --- a/Completion/Unix/Command/_gem +++ b/Completion/Unix/Command/_gem @@ -46,7 +46,7 @@ if [[ $state = command ]]; then 'gem_dependencies:gem dependencies file guide' 'platforms:show information about platforms' ) - _describe -t topics 'help topics' helptopics -- && ret=0 + _describe -t topics 'help topic' helptopics -- && ret=0 ;& subcommands) cmds=( ${${${(M)${(f)"$(_call_program commands gem help commands)"}:# [^ ]*}## #}/ ##/:} ) @@ -56,6 +56,11 @@ if [[ $state = command ]]; then check|cleanup|contents|dependency|list|open|pristine|rdoc|uninstall|unpack|update) args+=( '(--all --skip)*:installed gem:->gems-local' ) ;| + install) + (( ${(M)#line:#[^-]*} > 1 )) && args+=( + '(*)--[specify build options]:*:build option:_default' + ) + ;| fetch|install|lock|owner|search|yank) args+=( '*:gem:->gems-remote' ) ;| @@ -196,7 +201,7 @@ if [[ $state = command ]]; then ) ;; environment) - args+=( '1:information:(packageversion gemdir gempath version remotesources platform)' ) + args+=( '1:information:(gemdir gempath version remotesources platform)' ) ;; fetch) def=( both \! local \! remote \! ) @@ -299,6 +304,9 @@ if [[ $state = command ]]; then '*:file:_files' ) ;; + yank) + args+=( '--otp=[specify code for multifactor authentication]:code' ) + ;; esac _arguments -C ${args:-'*: :_default'} \ '(-)'{-h,--help}'[display usage information]' \ diff --git a/Completion/Unix/Command/_getfacl b/Completion/Unix/Command/_getfacl index 15be06a1c..27b5ee1c8 100644 --- a/Completion/Unix/Command/_getfacl +++ b/Completion/Unix/Command/_getfacl @@ -22,6 +22,7 @@ _arguments -s -S \ '(-P --physical)'{-P,--physical}"[physical walk, don't follow symbolic links]" \ '(-t --tabular)'{-t,--tabular}'[use tabular output format]' \ '(-n --numeric)'{-n,--numeric}'[print numeric user/group identifiers]' \ + '--one-file-system[skip files on different filesystems]' \ '(-p --absolute-names)'{-p,--absolute-names}"[don't strip leading '/' in pathnames]" \ '(- *)'{-v,--version}'[display version information]' \ '(- *)'{-h,--help}'[display help information]' \ diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 675460dad..cecb80ac3 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -68,7 +68,10 @@ _git-add () { '--refresh[do not add files, but refresh their stat() info in index]' \ '--ignore-errors[continue adding if an error occurs]' \ $ignore_missing \ - '--chmod[override the executable bit of the listed files]:override:(-x +x)' \ + '--sparse[allow updating entries outside of sparse-checkout cone]' \ + '--chmod=[override the executable bit of the listed files]:override:(-x +x)' \ + '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \ + '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \ '*:: :->file' && return case $state in @@ -76,8 +79,8 @@ _git-add () { declare -a ignored_files_alternatives if [[ -n ${opt_args[(I)-f|--force]} ]]; then ignored_files_alternatives=( - 'ignored-modified-files:ignored modified files:__git_ignore_line_inside_arguments __git_modified_files --ignored' - 'ignored-other-files:ignored other files:__git_ignore_line_inside_arguments __git_other_files --ignored') + 'ignored-modified-files:ignored modified file:__git_ignore_line_inside_arguments __git_modified_files --ignored' + 'ignored-other-files:ignored other file:__git_ignore_line_inside_arguments __git_other_files --ignored') fi _alternative \ @@ -97,11 +100,8 @@ _git-am () { # NOTE: --rebasing and --resolvemsg are only for internal use between git # rebase and git am. - # TODO: --patch-format is undocumented. - # TODO: --rerere-autoupdate and --no-rerere-autoupdate are - # undocumented (and not implemented here). _arguments -s -S $endopt \ - '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \ + '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: trailer to the commit message]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ '(-k --keep)'{-k,--keep}'[pass -k to git mailinfo]' \ @@ -111,13 +111,14 @@ _git-am () { '(--keep-cr )--no-keep-cr[do not pass --keep-cr to git mailsplit]' \ '(-c --scissors --no-scissors)'{-c,--scissors}'[strip everything before a scissors line]' \ '(-c --scissors --no-scissors)--no-scissors[ignore scissors lines]' \ + '--quoted-cr=[specify action when quoted CR is found]:action [warn]:(nowarn warn strip)' \ '(-q --quiet)'{-q,--quiet}'[only print error messages]' \ '(-u --utf8 --no-utf8)'{-u,--utf8}'[pass -u to git mailinfo]' \ '(-u --utf8 --no-utf8)--no-utf8[pass -n to git mailinfo]' \ '(-3 --3way)'{-3,--3way}'[use 3-way merge if patch does not apply cleanly]' \ $apply_options \ '--quit[abort the patching operation but keep HEAD where it is]' \ - '--show-current-patch[show the patch being applied]' \ + '--show-current-patch=-[show the message being applied]::show [raw]:(diff raw)' \ '(-i --interactive)'{-i,--interactive}'[apply patches interactively]' \ '--committer-date-is-author-date[use author date as committer date]' \ '--ignore-date[use committer date as author date]' \ @@ -160,6 +161,7 @@ _git-archive () { '(- :)'{-l,--list}'[list available archive formats]' \ '(-v --verbose)'{-v,--verbose}'[report progress to stderr]' \ '--prefix=-[prepend the given path prefix to each filename]:path prefix:_directories -r ""' \ + '--add-file=[add untracked file to archive]:file:_files' \ '(-o --output)'{-o+,--output=}'[write archive to specified file]:archive:_files' \ '--worktree-attributes[look for attributes in .gitattributes in working directory too]' \ $backend_args \ @@ -179,8 +181,6 @@ _git-archive () { (( $+functions[_git-bisect] )) || _git-bisect () { - # TODO: next subcommand is undocumented. Git-bisect.sh mentions that the - # subcommand might be removed from the UI level. local curcontext=$curcontext state line ret=1 declare -A opt_args local good bad @@ -226,6 +226,7 @@ _git-bisect () { --term-{good,old}'=[specify alternate term for good revisions]:term' \ --term-{bad,new}'=[specify alternate term for bad revisions]:term' \ '--no-checkout[set BISECT_HEAD reference instead of doing checkout at each iteration]' \ + '--first-parent[follow only the first parent commit upon seeing a merge commit]' \ ':bad revision:__git_commits' \ '*: :->revision-or-path' && ret=0 case $state in @@ -323,14 +324,14 @@ _git-branch () { "($c $m -a)"{-r,--remotes}'[list or delete only remote-tracking branches]' \ "($c $m $d : -r --remotes)-a[list both remote-tracking branches and local branches]" \ "($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 :)--abbrev=[use specified digits to display object names]:digits" \ "($c $m $d :)--no-abbrev[don't abbreviate sha1s]" \ "(- :)--show-current[show current branch name]" \ "($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]" \ - "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}'[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names' \ + "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}'[set up configuration so that pull merges]:remote branch:__git_remote_branch_names' \ "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \ "($l $m $d)*--contains=[only list branches that contain the specified commit]: :__git_committishs" \ "($l $m $d)*--no-contains=[only list branches that don't contain the specified commit]: :__git_committishs" \ @@ -380,6 +381,11 @@ _git-bundle () { (create) if (( CURRENT == 2 )); then _arguments \ + '(-q --quiet)'{-q,--quiet}"[don't show progress]" \ + '--progress[show progress meter]' \ + '--all-progress[show progress meter during object writing phase]' \ + '--all-progress-implied[similar to --all-progress when progress meter is shown]' \ + '--version=[specify bundle format version]:version:(2 3)' \ ':bundle:_files' && ret=0 else local revision_options @@ -393,13 +399,20 @@ _git-bundle () { ;; (verify) _arguments \ + '(-q --quiet)'{-q,--quiet}"[don't show bundle details]" \ ':bundle:_files' && ret=0 ;; - (list-heads|unbundle) + (list-heads) _arguments \ ':bundle:_files' \ '*: :__git_references' && ret=0 - ;; + ;; + (unbundle) + _arguments \ + '--progress[show progress meter]' \ + ':bundle:_files' \ + '*: :__git_references' && ret=0 + ;; esac ;; esac @@ -466,6 +479,8 @@ _git-checkout () { '--no-overlay[remove files from index or working tree that are not in the tree-ish]' \ '(-q --quiet --progress)--no-progress[suppress progress reporting]' \ '--progress[force progress reporting]' \ + '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \ + '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \ '(-)--[start file arguments]' \ '*:: :->branch-or-tree-ish-or-file' && ret=0 @@ -527,11 +542,11 @@ _git-cherry-pick () { '(-m --mainline)'{-m+,--mainline=}'[specify mainline when cherry-picking a merge commit]:parent number' \ '--rerere-autoupdate[update index with reused conflict resolution if possible]' \ '(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actual commit]' \ - '(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ + '(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by trailer at the end of the commit message]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \ '(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \ '*: : __git_commit_ranges -O expl:git_commit_opts' } @@ -548,7 +563,7 @@ _git-clean () { _arguments -C -S -s $endopt \ '-d[also remove untracked directories]' \ - '(-f --force)'{-f,--force}'[required when clean.requireForce is true (default)]' \ + \*{-f,--force}'[required by default; twice, removes untracked nested repositories]' \ '(-i --interactive)'{-i,--interactive}'[show what would be done and clean files interactively]' \ '(-n --dry-run)'{-n,--dry-run}'[only show what would and what would not be removed]' \ '(-q --quiet)'{-q,--quiet}"[don't print names of files removed]" \ @@ -618,6 +633,7 @@ _git-clone () { '(-q --quiet)'{-q,--quiet}'[operate quietly]' \ '(-v --verbose)'{-v,--verbose}'[always display the progressbar]' \ '--progress[output progress even if stderr is not a terminal]' \ + "--reject-shallow[don't clone shallow repository]" \ '(-n --no-checkout)'{-n,--no-checkout}'[do not checkout HEAD after clone is complete]' \ '(-o --origin)--bare[make a bare GIT repository]' \ '(--bare)--mirror[clone refs into refs/* instead of refs/remotes/origin/*]' \ @@ -634,13 +650,14 @@ _git-clone () { "--no-tags[don't clone any tags and make later fetches not follow them]" \ '--shallow-submodules[any cloned submodules will be shallow]' \ '--recursive[initialize all contained submodules]' \ - '--recurse-submodules=-[initialize submodules in the clone]::file:__git_files' \ + '(--recursive --recurse-submodules)'{--recursive,--recurse-submodules}'=-[initialize submodules in the clone]::file:__git_files' \ '--separate-git-dir[place .git dir outside worktree]:path to .git dir:_path_files -/' \ \*--server-option='[send specified string to the server when using protocol version 2]:option' \ '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \ '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \ '--filter=[object filtering]:filter:_git_rev-list_filters' \ '--remote-submodules[any cloned submodules will use their remote-tracking branch]' \ + '--sparse[initialize the sparse-checkout file to start with only the top-level files]' \ ': :->repository' \ ': :_directories' && ret=0 @@ -684,7 +701,7 @@ _git-commit () { # TODO: --interactive isn't explicitly listed in the documentation. _arguments -S -s $endopt \ '(-a --all --interactive -o --only -i --include *)'{-a,--all}'[stage all modified and deleted paths]' \ - '--fixup=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_recent_commits' \ + '--fixup=[construct a commit message for use with rebase --autosquash]:commit to be amended:_git_fixup' \ '--squash=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_recent_commits' \ $reset_author_opt \ '( --porcelain --dry-run)--short[dry run with short output format]' \ @@ -696,7 +713,8 @@ _git-commit () { {-p,--patch}'[use the interactive patch selection interface to chose which changes to commit]' \ '(--reset-author)--author[override the author name used in the commit]:author name' \ '--date=[override the author date used in the commit]:date' \ - '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ + '*--trailer=[add custom trailer(s)]:trailer' \ + '(-s --signoff)'{-s,--signoff}'[add Signed-off-by trailer at the end of the commit message]' \ '(-n --no-verify)'{-n,--no-verify}'[bypass pre-commit and commit-msg hooks]' \ '--allow-empty[allow recording an empty commit]' \ '--allow-empty-message[allow recording a commit with an empty message]' \ @@ -709,6 +727,8 @@ _git-commit () { '(-u --untracked-files)'{-u-,--untracked-files=-}'[show files in untracked directories]::mode:((no\:"show no untracked files" normal\:"show untracked files and directories" all\:"show individual files in untracked directories"))' \ + '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \ + '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \ '(-q --quiet -v --verbose)'{-v,--verbose}'[show unified diff of all file changes]' \ '(-q --quiet -v --verbose)'{-q,--quiet}'[suppress commit summary message]' \ '--dry-run[only show list of paths that are to be committed or not, and any untracked]' \ @@ -723,7 +743,7 @@ _git-commit () { {-C+,--reuse-message=}'[use existing commit object with same log message]: :__git_commits' \ {-c+,--reedit-message=}'[use existing commit object and edit log message]: :__git_commits' \ {-F+,--file=}'[read commit message from given file]: :_files' \ - {-m+,--message=}'[use the given message as the commit message]:message' \ + \*{-m+,--message=}'[use the given message as the commit message]:message' \ {-t+,--template=}'[use file as a template commit message]:template:_files' } @@ -735,7 +755,7 @@ _git-describe () { '--all[use any ref found in "$GIT_DIR/refs/"]' \ '--tags[use any ref found in "$GIT_DIR/refs/tags"]' \ '(--tags)--contains[find the tag after the commit instead of before]' \ - '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ + '--abbrev=[use specified digits to display object names]:digits' \ '( --exact-match)--candidates=[consider up to given number of candidates]: :__git_guard_number "number of candidates"' \ '(--candidates )--exact-match[only output exact matches, same as --candidates=0]' \ '--debug[display information about the searching strategy]' \ @@ -806,11 +826,14 @@ _git-diff () { # Example: git diff branch1..branch2 <tab> __git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0 elif __git_is_committish $line[1] || __git_is_treeish $line[1]; then + local files_alt='files::__git_tree_files ${PREFIX:-.} HEAD' + [[ $line[1] = (HEAD|@) ]] && + files_alt='files::__git_changed_files' # Example: git diff branch1 <tab> _alternative \ 'commits::__git_commits' \ 'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \ - 'files::__git_tree_files ${PREFIX:-.} HEAD' && ret=0 + $files_alt && ret=0 elif __git_is_blob $line[1]; then _alternative \ 'files::__git_cached_files' \ @@ -831,6 +854,10 @@ _git-diff () { __git_is_treeish $line[2]; then # Example: git diff branch1 branch2 <tab> __git_tree_files ${PREFIX:-.} $line[2] && ret=0 + elif [[ $line[1] = (HEAD|@) ]]; then + # Example: git diff @ file1 <tab> + # Example: git diff HEAD -- <tab> + __git_ignore_line __git_changed_files && ret=0 elif __git_is_committish $line[1] || __git_is_treeish $line[1]; then # Example: git diff branch file1 <tab> # Example: git diff branch -- f<tab> @@ -862,16 +889,17 @@ _git-fetch () { _arguments -C -S -s $endopt \ $fetch_options \ - '--shallow-since=[deepen history of shallow repository based on time]:time' \ - '*--shallow-exclude=[deepen history of shallow clone by excluding revision]:revision' \ - '--deepen[deepen history of shallow clone]:number of commits' \ - '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' \ + '--atomic[use atomic transaction to update references]' \ '(--all -m --multiple)'{-m,--multiple}'[fetch from multiple remotes]' \ + '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' \ + '--prefetch[modify the refspec to place all refs within refs/prefetch/]' \ '(-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' \ + '--write-fetch-head[write fetched references to the FETCH_HEAD file]' \ + "--negotiate-only[don't fetch a packfile; instead, print ancestors of negotiation tips]" \ '--filter=[object filtering]:filter:_git_rev-list_filters' \ - "--auto-gc[run 'gc --auto' after fetching]" \ + '(--auto-maintenance --auto-gc)'--auto-{maintenance,gc}"[run 'maintenance --auto' after fetching]" \ + '--write-commit-graph[write the commit-graph after fetching]' \ + '--stdin[accept refspecs from stdin]' \ '*:: :->repository-or-group-or-refspec' && ret=0 case $state in @@ -911,7 +939,7 @@ _git-format-patch () { '--start-number=[start numbering patches at given number]: :__git_guard_number "patch number"' \ '--numbered-files[use only number for file name]' \ '(-n --numbered -N --no-numbered -k --keep-subject --rfc --subject-prefix)'{-k,--keep-subject}"[don't strip/add \[PATCH\] from the first line of the commit message]" \ - '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \ + '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: trailer to the commit message]' \ '(-o --output-directory)--stdout[output the generated mbox on standard output (implies --mbox)]' \ '( --no-attach --inline)--attach=-[create attachments instead of inlining patches]::boundary' \ '(--attach --inline)--no-attach[disable creation of attachments]' \ @@ -922,7 +950,9 @@ _git-format-patch () { '--in-reply-to=[make the first mail a reply to the given message]:message id' \ '--ignore-if-in-upstream[do not include a patch that matches a commit in the given range]' \ '(-v --reroll-count)'{-v+,--reroll-count=}'[mark the series as the <n>-th iteration of the topic]: :__git_guard_number iteration' \ + '--filename-max-length=[specify max length of output filename]:length' \ '(-k --keep-subject --subject-prefix)--rfc[use \[RFC PATCH\] instead of \[PATCH\]]' \ + "--cover-from-description=[generate parts of a cover letter based on a branch's description]:mode:(message default subject auto none)" \ '(-k --keep-subject --rfc)--subject-prefix=[use the given prefix instead of \[PATCH\]]:prefix' \ '*--to=[add To: header to email headers]: :_email_addresses' \ '*--cc=[add Cc: header to email headers]: :_email_addresses' \ @@ -1140,6 +1170,8 @@ _git-init () { '--template=[directory to use as a template for the object database]: :_directories' \ '--shared=[share repository amongst several users]:: :__git_repository_permissions' \ '--separate-git-dir=[create git dir elsewhere and link it using the gitdir mechanism]:: :_directories' \ + '(-b --initial-branch)'{-b+,--initial-branch=}'[override the name of the initial branch]:branch name' \ + '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)' \ ':: :_directories' } @@ -1208,6 +1240,49 @@ _git-log () { return ret } +(( $+functions[_git-maintenance] )) || +_git-maintenance() { + local curcontext="$curcontext" state state_descr line ret=1 + local -A opt_args + + _arguments -C \ + ': :->command' \ + '*::: := ->option-or-argument' && ret=0 + + case $state in + (command) + local -a commands + + commands=( + register:'initialize config values to run maintenance on this repository' + run:'run one or more maintenance tasks' + start:'start running maintenance on the current repository' + stop:'halt the background maintenance schedule' + unregister:'remove the current repository from background maintenance' + ) + + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (run) + _arguments -S $endopt \ + '--auto[run tasks based on the state of the repository]' \ + '--schedule=[run tasks based on frequency]:frequency (seconds)' \ + "--quiet[don't report progress or other information to stderr]" \ + '*--task=[run a specific task]:task:(gc commit-graph prefetch loose-objects incremental-repack pack-refs)' && ret=0 + ;; + (start) + _arguments \ + '--scheduler=:scheduler:(auto crontab systemd-timer launchctl schtasks)' + esac + ;; + esac + + return ret +} + (( $+functions[_git-merge] )) || _git-merge () { local -a merge_options @@ -1239,6 +1314,7 @@ _git-mv () { '(-f --force)'{-f,--force}'[rename/move even if targets exist]' \ '-k[skip rename/move that would lead to errors]' \ '(-n --dry-run)'{-n,--dry-run}'[only show what would happen]' \ + '--sparse[allow updating entries outside of sparse-checkout cone]' \ ':source:__git_cached_files' \ '*:: :->source-or-destination' && ret=0 @@ -1302,7 +1378,6 @@ _git-notes () { ': :__git_commits' && ret=0 ;; (copy) - # TODO: --for-rewrite is undocumented. _arguments -S -s $endopt \ '(-f --force)'{-f,--force}'[replace existing note]' \ '(:)--stdin[read objects from stdin]' \ @@ -1367,7 +1442,6 @@ _git-pull () { 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 \ '(--no-tags -t --tags)--no-tags[disable automatic tag following]' \ ': :__git_any_repositories' \ @@ -1399,6 +1473,7 @@ _git-push () { '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[path to git-receive-pack on remote]:remote git-receive-pack:_files' \ '(--force-with-lease --no-force-with-lease)*--force-with-lease=-[allow refs that are not ancestors to be updated if current ref matches expected value]::ref and expectation:->lease' \ '(--force-with-lease --no-force-with-lease)--no-force-with-lease[cancel all previous force-with-lease specifications]' \ + '--force-if-includes[require remote updates to be integrated locally]' \ '(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]' \ '(:)--repo=[default repository to use]:repository:__git_any_repositories' \ '(-u --set-upstream)'{-u,--set-upstream}'[add upstream reference for each branch that is up to date or pushed]' \ @@ -1417,7 +1492,7 @@ _git-push () { '(--no-signed --sign)--signed[GPG sign the push]' \ "(--sign --signed)--no-signed[don't GPG sign the push]" \ '--atomic[request atomic transaction on remote side]' \ - '(-o --push-option)'{-o+,--push-option=}'[transmit string to server to pass to pre/post-receive hooks]:string' \ + '*'{-o+,--push-option=}'[transmit string to server to pass to pre/post-receive hooks]:string' \ '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \ '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \ ': :__git_any_repositories' \ @@ -1445,6 +1520,9 @@ _git-range-diff () { _arguments -s -S $endopt \ '--creation-factor=[specify weighting for creation]:weighting (percent)' \ '--no-dual-color[use simple diff colors]' \ + '(--no-notes)*--notes=[show notes that annotate commit, with optional ref argument show this notes ref instead of the default notes ref(s)]:: :__git_notes_refs' \ + '(--right-only)--left-only[only emit output related to the first range]' \ + '(--left-only)--right-only[only emit output related to the second range]' \ $diff_options \ '1:range 1:__git_commit_ranges' \ '2:range 2:__git_commit_ranges' \ @@ -1470,38 +1548,38 @@ _git-rebase () { '(-)--quit[abort but keep HEAD where it is]' \ '(-)--show-current-patch[show the patch file being applied or merged]' \ - options \ - '(-m --merge)'{-m,--merge}'[use merging strategies to rebase]' \ + '(--onto --root)--keep-base[use the merge-base of upstream and branch as the current base]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ - '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-q,--quiet}'[suppress all output]' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-v,--verbose}'[output additional information]' \ '(-n --no-stat)'{-n,--no-stat}"[don't show diffstat of what changed upstream]" \ '--rerere-autoupdate[update the index with reused conflict resolution if possible]' \ '--no-verify[bypass the pre-rebase hook]' \ - '-C-[ensure that given lines of surrounding context match]: :__git_guard_number "lines of context"' \ + '(--apply -m --merge -s --strategy -X --strategy-option --auto-squash --no-auto-squash -r --rebase-merges -i --interactive -x --exec --empty --reapply-cherry-picks --edit-todo --reschedule-failed-exec)-C-[ensure that given lines of surrounding context match]: :__git_guard_number "lines of context"' \ '(-f --force-rebase)'{-f,--force-rebase}'[force rebase even if current branch descends from commit rebasing onto]' \ - '(-i --interactive)--ignore-whitespace[ignore whitespace in context]' \ - '(-i --interactive)--whitespace=-[detect a new or modified line that has whitespace errors]: :__git_apply_whitespace_strategies' \ + '(-i --interactive)--ignore-whitespace[ignore changes in whitespace]' \ + '(--apply -m --merge -s --strategy -X --strategy-option --auto-squash --no-auto-squash -r --rebase-merges -i --interactive -x --exec --empty --reapply-cherry-picks --edit-todo --reschedule-failed-exec)--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} \ - {-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]' \ - '--allow-empty-message[allow rebasing commits with empty messages]' \ - '(1)--root[rebase all reachable commits]' \ + '(-f --force-rebase)'{--ignore-date,--reset-author-date}'[ignore author date and use current date]' \ + '(-m --merge -s --strategy -X --strategy-option --auto-squash --no-auto-squash -r --rebase-merges -i --interactive -x --exec --empty --reapply-cherry-picks --edit-todo --reschedule-failed-exec)--apply[use apply strategies to rebase]' \ + '(-m --merge --apply --whitespace -C)'{-m,--merge}'[use merging strategies to rebase]' \ + '(-i --interactive --ignore-whitespace --apply --whitespace -C --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \ + '(--apply --whitespace -C)--empty=[specify how to handle commits that become empty]:handling:(drop keep ask)' \ + '(--apply --whitespace -C)'{-x+,--exec=}'[with -i\: append "exec <cmd>" after each line]:command:_command_names -e' \ + '(-r --rebase-merges --apply --whitespace -C)'{-r-,--rebase-merges=-}'[try to rebase merges instead of skipping them]::option:(rebase-cousins no-rebase-cousins)' \ + '(--apply --whitespace -C)*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ + '(--apply --whitespace -C)*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \ + '(1 --keep-base --fork-point)--root[rebase all reachable commits]' \ $autosquash_opts \ '(--autostash --no-autostash)--autostash[stash uncommitted changes before rebasing and apply them afterwards]' \ "(--autostash --no-autostash)--no-autostash[don't stash uncommitted changes before rebasing and apply them afterwards]" \ - '--fork-point[use merge-base --fork-point to refine upstream]' \ - '--ignore-date[use current timestamp for author date]' \ - '--signoff[add Signed-off-by: line to the commit message]' \ + '(--root)--fork-point[use merge-base --fork-point to refine upstream]' \ + '--signoff[add Signed-off-by: trailer to the commit message]' \ '--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \ '(--keep-base)--onto=[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \ - '(--onto)--keep-base[use the merge-base of upstream and branch as the current base]' \ - "--reschedule-failed-exec[automatically re-schedule any 'exec' that fails]" \ + "(--apply --whitespace -C)--reschedule-failed-exec[automatically re-schedule any 'exec' that fails]" \ + '(--apply --whitespace -C)--reapply-cherry-picks[apply all changes, even those already present upstream]' \ ':upstream branch:__git_revisions' \ '::working branch:__git_revisions' } @@ -1521,6 +1599,8 @@ _git-reset () { '--recurse-submodules=-[control recursive updating of submodules]::reset:__git_commits' \ '(-p --patch)'{-p,--patch}'[select diff hunks to remove from the index]' \ '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ + '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \ + '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \ '(--soft --mixed --hard --merge --keep):: :__git_commits' \ '(--soft --mixed --hard --merge --keep)*:: :->file' && ret=0 @@ -1548,7 +1628,7 @@ _git-restore() { local -A opt_args _arguments -C -s -S $endopt \ - '(-s --source)'{-s,--source}'[specify which tree-ish to checkout from]:source tree:->sources' \ + '(-s --source)'{-s,--source=}'[specify which tree-ish to checkout from]:source tree:->sources' \ '(-S --staged)'{-S,--staged}'[restore the index]' \ '(-W --worktree)'{-W,--worktree}'[restore the working tree (default)]' \ '--ignore-unmerged[ignore unmerged entries]' \ @@ -1563,17 +1643,23 @@ _git-restore() { '(-2 --ours -3 --theirs -m --merge)'{-3,--theirs}'[checkout their version for unmerged files]' \ '(-p --patch)'{-p,--patch}'[select hunks interactively]' \ "--ignore-skip-worktree-bits[don't limit pathspecs to sparse entries only]" \ + '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \ + '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \ '*:path spec:->pathspecs' && ret=0 case $state in pathspecs) - if [[ -z ${opt_args[(I)-s|--source|-S|--staged]} ]] && - # use index as a default base unless -S is specified - __git_ignore_line __git_modified_files + integer opt_S opt_W + [[ -n ${opt_args[(I)-S|--staged]} ]] && opt_S=1 + [[ -n ${opt_args[(I)-W|--worktree]} ]] && opt_W=1 + if (( opt_S && opt_W )) then - ret=0 + __git_ignore_line __git_changed_files && ret=0 + elif (( opt_S )) + then + __git_ignore_line __git_changed-in-index_files && ret=0 else - __git_ignore_line __git_tree_files ${PREFIX:-.} ${(Qv)opt_args[(i)-s|--source]:-HEAD} && ret=0 + __git_ignore_line __git_changed-in-working-tree_files && ret=0 fi ;; sources) @@ -1601,7 +1687,7 @@ _git-revert () { '(-n --no-commit)'{-n,--no-commit}'[do not commit the reversion]' \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ '--strategy=[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ ': :__git_recent_commits' @@ -1618,6 +1704,9 @@ _git-rm () { '-r[allow recursive removal when a leading directory-name is given]' \ '--cached[only remove files from the index]' \ '--ignore-unmatch[exit with 0 status even if no files matched]' \ + '--sparse[allow updating entries outside of sparse-checkout cone]' \ + '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \ + '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \ '(-q --quiet)'{-q,--quiet}"[don't list removed files]" \ '*:: :->file' && ret=0 @@ -1646,6 +1735,8 @@ _git-shortlog () { '(-s --summary)'{-s,--summary}'[suppress commit description]' \ '(-e --email)'{-e,--email}'[show email address of each author]' \ '-w-[linewrap the output]:: :->wrap' \ + '*--group=[group commits by field]: : _values -S\: field author committer trailer\:trailer' \ + '(-c --committer)'{-c,--committer}'[alias for --group=committer]' \ $revision_options \ '(-)--[start file arguments]' \ '*:: :->commit-range-or-file' && ret=0 @@ -1721,6 +1812,50 @@ _git-show () { return ret } +(( $+functions[_git-sparse-checkout] )) || +_git-sparse-checkout() { + local curcontext="$curcontext" state state_descr line ret=1 + local -A opt_args + + _arguments -C \ + ': :->command' \ + '*::: := ->option-or-argument' && ret=0 + + case $state in + (command) + local -a commands + + commands=( + list:'describe the patterns in the sparse-checkout file' + init:'enable the core.sparseCheckout setting' + set:'write a set of patterns to the sparse-checkout file' + add:'update the sparse-checkout file to include additional patterns' + reapply:'reapply the sparsity pattern rules to paths in the working tree' + disable:'disable the config setting, and restore all files in the working directory' + ) + + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + init) + _arguments \ + '--cone[allow for better performance with a limited set of patterns]' \ + '--no-sparse-index[rewrite index to not be sparse]' + ;; + set|add) + _arguments -S \ + '--stdin[read patterns from input]' \ + '*:pattern:_files' && ret=0 + ;; + esac + ;; + esac + + return ret +} + (( $+functions[_git-stash] )) || _git-stash () { local curcontext=$curcontext state line ret=1 @@ -1734,11 +1869,13 @@ _git-stash () { '(-q --quiet)'{-q,--quiet}'[suppress all output]' '(-p --patch -a --all -u --include-untracked)'{-u,--include-untracked}'[include untracked files]' '(-p --patch -a --all -u --include-untracked)'{-a,--all}'[include ignored files]' + '(* -p --patch)--pathspec-from-file=[read pathspec from file]:file:_files' + '(* -p --patch)--pathspec-file-nul[pathspec elements are separated with NUL character]' ) _arguments -C \ '*::: :->args' \ - '(-m --message)'{-m,--message}'[specify stash description]' \ + '(-m --message)'{-m+,--message=}'[specify stash description]:description' \ ${save_arguments//#\(/(* } && ret=0 if [[ -n $state ]]; then @@ -1771,8 +1908,8 @@ _git-stash () { (push) _arguments -S $endopt \ $save_arguments \ - '(-m --message)'{-m,--message}'[specify stash description]' \ - ':: :__git_modified_files' && ret=0 + '(-m --message)'{-m+,--message=}'[specify stash description]:description' \ + '*: : __git_ignore_line __git_modified_files' && ret=0 ;; (--) __git_modified_files @@ -1875,7 +2012,8 @@ _git-submodule () { init:'initialize a submodule' deinit:'unregister a submodule' update:'update a submodule' - set-branch:'set the default remote tracking branch for the submodule' + set-branch:'set default remote tracking branch for the submodule' + set-url:'set URL of the specified submodule' summary:'show commit summary between given commit and working tree/index' foreach:'evaluate shell command in each checked-out submodule' absorbgitdirs:'move the git directory of a submodule into its superprojects' @@ -1931,6 +2069,7 @@ _git-submodule () { '--remote[use the status of the submodule''s remote-tracking branch]' \ '--force[discard local changes by checking out the current up-to-date version]' \ '--init[initialize uninitialized submodules]' \ + '--single-branch[clone only one branch]' \ '*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0 ;; (set-branch) @@ -1939,6 +2078,11 @@ _git-submodule () { '(-b --branch)'{-b,--branch=}'[specify the remote branch]:remote branch' \ '1:path:_directories' ;; + (set-url) + _arguments -C -A '-*' \ + '1:path:_directories' \ + '2:url:_urls' && ret=0 + ;; (summary) _arguments -C -A '-*' \ '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ @@ -2289,17 +2433,20 @@ _git-config () { '(--global --system --local -f --file --blob)--worktree[use per-worktree config file]' \ '(--global --system --local --worktree --blob)'{-f+,--file=}'[use given config file]:config file:_files' \ '(--global --system --local --worktree -f --file)--blob=[read config from given blob object]:blob:__git_blobs' \ - '(-t --type --bool --int --bool-or-int --path --expiry-date)'{-t+,--type=}'[ensure that incoming and outgoing values are canonicalize-able as the given type]:type:(bool int bool-or-int path expiry-date color)' \ - '(-t --type --int --bool-or-int --path --expiry-date)--bool[setting is a boolean]' \ - '(-t --type --bool --bool-or-int --path --expiry-date)--int[setting is an integer]' \ - '(-t --type --bool --int --path --expiry-date)--bool-or-int[setting is an integer]' \ - '(-t --type --bool --int --bool-or-int --expiry-date)--path[setting is a path]' \ - '(-t --type --bool --int --bool-or-int --path)--expiry-date[setting is an expiry date]' \ + '(-t --type --bool --int --bool-or-int --bool-or-str --path --expiry-date)'{-t+,--type=}'[ensure that incoming and outgoing values are canonicalize-able as the given type]:type:(bool int bool-or-int bool-or-str path expiry-date color)' \ + '(-t --type --int --bool-or-int --bool-or-str --path --expiry-date)--bool[setting is a boolean]' \ + '(-t --type --bool --bool-or-int --bool-or-str --path --expiry-date)--int[setting is an integer]' \ + '(-t --type --bool --int --bool-or-str --path --expiry-date)--bool-or-int[setting is a boolean or integer]' \ + '(-t --type --bool --int --bool-or-int --path --expiry-date)--bool-or-str[setting is a boolean or string]' \ + '(-t --type --bool --int --bool-or-int --bool-or-str --expiry-date)--path[setting is a path]' \ + '(-t --type --bool --int --bool-or-int --bool-or-str --path)--expiry-date[setting is an expiry date]' \ '(-z --null)'{-z,--null}'[end values with NUL and newline between key and value]' \ + '--fixed-value[use string equality when comparing values]' \ '(--get --get-all --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--name-only[show variable names only]' \ '(--includes)'--no-includes"[don't respect \"include.*\" directives]" \ '(--no-includes)'--includes'[respect "include.*" directives in config files when looking up values]' \ - '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--show-origin[show origin of config]' \ + '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool --show-scope)--show-origin[show origin of config]' \ + '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool --show-origin)--show-scope[show scope of config (worktree, local, global, system, command)]' \ '(2 --add -e --edit -l --list --name-only --rename-section --remove-section --replace-all --unset --unset-all)--default=[with --get, use specified default value when entry is missing]:default' \ $name_arg \ $value_arg \ @@ -2311,14 +2458,14 @@ _git-config () { '(--name-only --show-origin)--get-urlmatch[get value specific for the URL]' \ '(-z --null --name-only --show-origin)--replace-all[replace all values of the given key]' \ '(3 -z --null --name-only --show-origin)--add[add new value without altering any existing ones]' \ - '(2 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--unset[remove the first matching value of the key]' \ - '(2 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--unset-all[remove all matching values of the key]' \ - '(3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--rename-section[rename the given section]' \ - '(3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--remove-section[remove the given section]' \ - '(: --bool --int --bool-or-int --path)'{-l,--list}'[list all variables set in config file]' \ - '(-e --edit --bool --int --bool-or-int --path -z --null --name-only --show-origin)'{-e,--edit}'[open config file for editing]' \ - '(2 3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--get-color[find color setting]: :->gettable-color-option' \ - '(2 3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--get-colorbool[check if color should be used]: :->gettable-colorbool-option' && ret=0 + '(2 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--unset[remove the first matching value of the key]' \ + '(2 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--unset-all[remove all matching values of the key]' \ + '(3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--rename-section[rename the given section]' \ + '(3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--remove-section[remove the given section]' \ + '(: --bool --int --bool-or-int --bool-or-str --path)'{-l,--list}'[list all variables set in config file]' \ + '(-e --edit --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)'{-e,--edit}'[open config file for editing]' \ + '(2 3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--get-color[find color setting]: :->gettable-color-option' \ + '(2 3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--get-colorbool[check if color should be used]: :->gettable-colorbool-option' && ret=0 __git_config_option-or-value "$@" && ret=0 return ret } @@ -2342,7 +2489,7 @@ __git_config_value () { # Helper to _git-config(). May be called by other functions, too, provided # that The caller has set $line, $state, and $opt_args as _git-config() would # set them: -# +# # - set $line[1] to the option name being completed (even if completing an # option value). # - set $opt_args to git-config(1) options, as set by _arguments in @@ -2383,12 +2530,16 @@ __git_config_option-or-value () { advice.nestedTag:'show advice if a user attempts to recursively tag a tag object::->bool:true' author.email:'email address used for author in commits::_email_addresses -c' author.name:'full name used for author in commits:name:->string' + am.threeWay:'use 3-way merge if patch does not apply cleanly::->bool:false' blame.blankboundary:'show blank SHA-1 for boundary commits::->bool:false' blame.coloring:'determine the coloring scheme to be applied to blame output:scheme [none]:->string' + blame.showEmail:"show author email instead of author name::->bool:false" blame.showroot:'show root commits as normal commits::->bool:false' blame.ignoreRevsFile:'ignore revisions listed in the file:file:_files' blame.date:'date format to use in output::__git_date_formats:iso' 'branch.*.description:branch description:branch description:->string' + branch.sort:"default sorting order for 'git branch' output::__git_ref_sort_keys" + checkout.defaultRemote:'assumed remote name when specifying an unqualified remote branch name:remote name:__git_remotes' cvsexportcommit.cvsdir:'the default location of the CVS checkout to use for the export:cvs export dir:_directories' column.ui:'specify whether supported commands should output in columns.::->column:never' column.branch:'specify whether to output branch listing in git branch in columns::_git_column_layouts:never' @@ -2400,7 +2551,9 @@ __git_config_option-or-value () { core.fileMode:'track changes to the executable bit of files::->bool:true' core.attributesfile:'look into this file for attributes in addition to .gitattributes:additional attributes file:_files' core.abbrev:'set the length object names are abbreviated to:length:->int:7' + core.checkRoundtripEncoding:"encodings to UTF-8 round trip check::_guard '' 'comma-separated list of encodings'" # _guard used as a hack because _message doesn't take compadd options core.commentchar:'comment character when using an editor::->string' + core.filesRefLockTimeout:"how long to retry locking a reference:retry time (milliseconds, or -1 for indefinite):->int:100" core.ignoreCygwinFSTricks:'use Cygwin stat()/lstat()::->bool:true' core.ignorecase:'use workarounds for non-case-sensitive filesystems::->bool:false' core.trustctime:'trust inode change time::->bool:true' @@ -2422,6 +2575,7 @@ __git_config_option-or-value () { core.loosecompression:'level of compression to apply to non-pack files::->compression:1' core.packedGitWindowSize:'size of mappings of pack files:pack window size:->bytes' core.packedGitLimit:'maximum number of bytes to map from pack files:maximum pack file map size:->bytes' + core.packedRefsTimeout:"how long to retry locking the packed-refs file:retry time (milliseconds, or -1 for indefinite):->int:1000" core.precomposeunicode:'revert the unicode decomposition of filenames done by Mac OS::->bool:false' core.deltaBaseCacheLimit:'maximum size of cache for base objects:maximum base objects cache size:->bytes:96m' core.bigFileThreshold:'maximum size of files to compress:maximum compress size:->bytes:512m' @@ -2435,13 +2589,17 @@ __git_config_option-or-value () { core.createObject:'take steps to prevent overwriting existing objects::->core.createObject:link' core.checkstat:'determine which stat fields to match between the index and work tree::->core.checkstat:default' core.notesRef:'show notes in given refs:refs:->string:refs/notes/commits' + core.sparseCheckoutCone:"enable git-sparse-checkout(1) cone mode::->bool:false" core.sparseCheckout:'use sparse checkout::->bool:false' + core.splitIndex:"enable the split-index feature::->bool:false" + core.useReplaceRefs:"honour 'replace' refs::->bool:true" credential.helper:'external helper to be called when a username or password credential is needed::_cmdstring' credential.useHttpPath:'consider the "path" component of an http or https URL to be important::->bool:false' credential.username:'If no username is set use this username by default:default username:->string' 'credential.*.helper:external helper to be called when a username or password credential is needed::_cmdstring' 'credential.*.useHttpPath:consider the "path" component of an http or https URL to be important::->bool:false' 'credential.*.username:if no username is set use this username by default:default username:->string' + credentialCache.ignoreSIGHUP:'ignore SIGHUP in git-credential-cache—daemon::->bool:false' add.ignore-errors:'ignore indexing errors when adding files::->bool:false' add.ignoreErrors:'ignore indexing errors when adding files::->bool:false' am.keepcr:'keep CR characters when splitting mails::->bool:false' @@ -2521,13 +2679,18 @@ __git_config_option-or-value () { 'diff.*.xfuncname:regular expression that the diff driver should use to recognize the hunk header:regular expression:->string' diff.algorithm:'default diff algorithm::->diff.algorithm:default' diff.autorefreshindex:'run git update-index --refresh before git diff::->bool:true' + diff.colorMoved:"color moved lines in diffs::__git_color_moved" + diff.colorMovedWS:"ignore whitespace when detecting moved lines::__git_color_movedws" + diff.wsErrorHighlight:'highlight whitespace errors: :__git_ws_error_highlight' diff.context:'default number of context lines::->int:3' diff.dirstat:'comma separated list of --dirstat parameters specifying default behaviour:comma-separated list:->string:changes,noncumulative,3' diff.external:'command to generate diff with:diff command:_cmdstring' + diff.indentHeuristic:"heuristically shift hunk boundaries::->bool:true" + diff.interHunkContext:"combine hunks closer than N lines:number of lines:->int" diff.mnemonicprefix:'use mnemonic source and destination prefixes::->bool:false' diff.noprefix:'strip source and destination prefixes::->bool:false' diff.orderfile:'file to read patch order glob patterns from:order file:_files' - diff.renameLimit:'number of files to consider when detecting copy/renames:rename limit:->int' + diff.renameLimit:'number of files to consider when detecting copy/renames:limit (number of files):->int' diff.renames:'try to detect renames::->diff.renames:true' diff.ignoreSubmodules:'ignore submodules::->bool:false' diff.statGraphWidth:'width of the graph part in --stat output:width:->int' @@ -2539,10 +2702,15 @@ __git_config_option-or-value () { difftool.prompt:'prompt before each invocation of the diff tool::->bool:true' diff.wordRegex:'regex used to determine what a word is when performing word-by-word diff:regular expression:->string' diff.guitool:'diff tool with gui to use::__git_difftools' + merge.guitool:'merge tool with gui to use::__git_difftools' + fastimport.unpackLimit:"whether to import objects as loose object files or as a pack:threshold for packing (number of objects imported):->int" feature.experimental:'enable config options that are new to Git::->bool:false' feature.manyFiles:'enable config options that optimize for repos with many files::->bool:false' + fetch.output:'output format:format:compadd compact full' fetch.parallel:'specify maximum number of fetch operations to run in parallel:number:->int' fetch.prune:'remove any remote tracking branches that no longer exist remotely::->bool:false' + fetch.pruneTags:"maintain one-to-one correspondence with upstream tag refs::->bool:false" + fetch.showForcedUpdates:"show forced updates::->bool:true" fetch.unpackLimit:'maximum number of objects to unpack when fetching:unpack limit:->int' fetch.recurseSubmodules:'recurse into submodules (as needed) when fetching::->fetch.recurseSubmodules:on-demand' fetch.fsckObjects:'check all fetched objects::->bool:false' @@ -2566,13 +2734,16 @@ __git_config_option-or-value () { gc.aggressiveDepth:'maximum delta depth:maximum delta depth::->int:250' gc.aggressiveWindow:'window size used in delta compression algorithm::->int:250' gc.auto:'minimum limit for packing loose objects with --auto::->int:6700' + gc.autoDetach:"make 'git gc --auto' run in the background::->bool:true" gc.autopacklimit:'minimum limit for packing packs with --auto::->int:50' + gc.bigPackThreshold:"keep large packs:size threshold:->bytes" gc.packrefs:'allow git gc to run git pack-refs::->gc.packrefs:true' - gc.pruneexpire:'grace period for pruning::->days+now' + gc.pruneexpire:'grace period for pruning:number of days, "now", or "never":->int' gc.reflogexpire:'grace period for git reflog expire::->days:90' gc.reflogexpireunreachable:'grace period for git reflog expire for unreachable entries::->days:30' gc.rerereresolved:'number of days to keep records of resolved merges::->days:60' gc.rerereunresolved:'number of days to keep records of unresolved merges::->days:15' + gc.worktreePruneExpire:'grace period for pruning worktrees:number of days, "now", or "never":->int' # git default: 3.months.ago gitcvs.commitmsgannotation:'string to append to each commit message::->string' gitcvs.enabled:'enable the cvs server interface::->bool:false' gitcvs.logfile:'name of log file for cvs pserver:log file:_files' @@ -2591,7 +2762,10 @@ __git_config_option-or-value () { 'gitcvs.*.dbTableNamePrefix:database table name prefix:prefix:->string' gitcvs.usecrlfattr:'use end-of-line conversion attributes::->bool:false' gitcvs.allbinary:'treat all files from CVS as binary::->bool:false' - gpg.program:'use program instead of "gpg" found on $PATH when making or verifying a PGP signature::_cmdstring' + gpg.format:'private key format for --gpg-sign:format:compadd openpgp x509' + gpg.minTrustLevel:'minimum trust level for signature verification:trust level:compadd undefined never marginal fully ultimate' # TODO: sort in this order (use compadd -V) + {gpg.program,gpg.openpgp.program}:'use program instead of "gpg" found on $PATH when making or verifying a PGP signature::_cmdstring' + gpg.x509.program:'use program instead of "gpgsm" found on $PATH when making or verifying an x509 signature::_cmdstring' gui.commitmsgwidth:'width of commit message window:width::->int:75' gui.diffcontext:'number of context lines used in diff window:context::->int:5' gui.encoding:'encoding to use for displaying file contents::->encoding' @@ -2623,10 +2797,12 @@ __git_config_option-or-value () { guitool.revunmerged:'show only unmerged branches in revprompt::->bool:false' guitool.title:'title of prompt dialog:prompt title:->string' guitool.prompt:'prompt to display:prompt:->string' + grep.column:"show column number of first match::->bool:false" grep.extendedRegexp:'enable --extended-regexp option by default (ignored when grep.patternType is set)::->bool:false' grep.fullname:'enable --full-name option by default::->bool:false' grep.lineNumber:'enable -n option by default::->bool:false' grep.patternType:'default matching pattern type::->grep.patternType:default' + grep.threads:"number of worker threads::->int" help.browser:'browser used to display help in web format::__git_browsers' help.htmlpath:'location of HTML help::->help.htmlpath' http.cookiefile:'file containing cookie lines which should be used in the Git http session::_files' @@ -2695,6 +2871,7 @@ __git_config_option-or-value () { instaweb.local:'bind to 127.0.0.1::->bool:false' instaweb.modulepath:'module path for the Apache HTTP-daemon for instaweb:module directory:_directories' instaweb.port:'port to bind HTTP daemon to for instaweb::_ports' + interactive.diffFilter:"mark up diffs for human consumption:filter command:_cmdstring" interactive.singlekey:'accept one-letter input without Enter::->bool:false' log.abbrevCommit:'make git-log, git-show, and git-whatchanged assume --abbrev-commit::->bool:false' log.date:'default date-time mode::__git_date_formats' @@ -2712,7 +2889,9 @@ __git_config_option-or-value () { merge.defaultToUpstream:'merge the upstream branches configured for the current branch by default::->bool:true' merge.ff:'allow fast-forward merges::->merge.ff:true' merge.log:'include summaries of merged commits in new merge commit messages::->bool:false' - merge.renameLimit:'number of files to consider when detecting copy/renames during merge:limit:->int' + merge.directoryRenames:"try to detect directory renames:mode:compadd false true conflict" + merge.renames:"try to detect renames::->diff.renames" + merge.renameLimit:'number of files to consider when detecting copy/renames during merge:limit (number of files):->int' merge.renormalize:'use canonical representation of files during merge::->bool:false' merge.stat:'print the diffstat between ORIG_HEAD and merge at end of merge::->bool:true' merge.tool:'tool used by git mergetool during merges::__git_mergetools' @@ -2748,10 +2927,13 @@ __git_config_option-or-value () { 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' + push.pushOption:'transmit strings to server to pass to pre/post-receive hooks::->string' 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.instructionFormat:'interactive rebase todo list format::__git_format_placeholders' rebase.missingCommitsCheck:'print a warning if some commits are removed' + rebase.rescheduleFailedExec:"automatically re-schedule any 'exec' that fails::->bool" 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' @@ -2767,6 +2949,7 @@ __git_config_option-or-value () { 'remote.*.promisor:use this remote to fetch promisor objects::->bool:false' 'remote.*.pushurl:push URL of a remote repository::__git_any_repositories' 'remote.*.proxy:URL of proxy to use for a remote repository::_urls' + "remote.*.pruneTags:maintain one-to-one correspondence with remote's tag refs::->bool:false" 'remote.*.prune:remove any remote tracking branches that no longer exist remotely::->bool:false' 'remote.*.fetch:default set of refspecs for git fetch::__git_ref_specs_fetchy' 'remote.*.push:default set of refspecs for git push::__git_ref_specs_pushy' @@ -2777,9 +2960,13 @@ __git_config_option-or-value () { 'remote.*.uploadpack:default program to execute on remote when fetching:git upload-pack command:_cmdstring' 'remote.*.tagopt:options for retrieving remote tags::->remote.tagopt' 'remote.*.vcs:interact with the remote through git-remote helper:remote VCS:->string' + repack.packKeptObjects:'repack objects in packs marked with .keep::->bool' + repack.useDeltaIslands:'pass --delta-islands to git-pack-objects::->bool:false' repack.usedeltabaseoffset:'use delta-base offsets::->bool:true' + repack.writeBitmaps:'trade off disk space for faster subsequent repacks::->bool' rerere.autoupdate:'update index after resolution::->bool:false' rerere.enabled:'record resolved conflicts::->bool' + reset.quiet:'pass --quiet by default::->bool:false' sendemail.identity:'default identity::__git_sendemail_identities' sendemail.smtpencryption:'encryption method to use::->sendemail.smtpencryption' sendemail.aliasesfile:'file containing email aliases:email aliases file:_files' @@ -2788,13 +2975,15 @@ __git_config_option-or-value () { sendemail.bcc:'value of Bcc\: header::_email_addresses' sendemail.cc:'value of Cc\: header::_email_addresses' sendemail.cccmd:'command to generate Cc\: header with:Cc\: command:_cmdstring' - sendemail.toccmd:'command to generate To\: header with:To\: command:_cmdstring' + sendemail.tocmd:'command to generate To\: header with:To\: command:_cmdstring' sendemail.chainreplyto:'send each email as a reply to the previous one::->bool:false' sendemail.confirm:'type of confirmation required before sending::->sendemail.confirm:auto' sendemail.envelopesender:'envelope sender to send emails as::_email_addresses' sendemail.from:'sender email address::_email_addresses' sendemail.multiedit:'edit all files at once::->bool:true' sendemail.signedoffbycc:'add Signed-off-by\: or Cc\: lines to Cc\: header::->bool:true' + sendemail.smtpBatchSize:"number of messages to send per SMTP connection::->int" + sendemail.smtpReloginDelay:"delay before reconnecting to SMTP server:delay (seconds):->int" sendemail.smtppass:'password to use for SMTP-AUTH:password:->string' sendemail.suppresscc:'rules for suppressing Cc\:::->sendemail.suppresscc' sendemail.suppressfrom:'add From\: address to the Cc\: list::->bool:false' @@ -2807,6 +2996,7 @@ __git_config_option-or-value () { sendemail.smtpuser:'user to use for SMTP-AUTH:smtp user:_users' sendemail.thread:'set In-Reply-To\: and References\: headers::->bool:true' sendemail.validate:'perform sanity checks on patches::->bool:true' + sendemail.xmailer:'add the "X-Mailer" header::->bool:true' 'sendemail.*.aliasesfile:file containing email aliases::_files' 'sendemail.*.aliasfiletype:format of aliasesfile::->sendemail.aliasfiletype' 'sendemail.*.annotate:review and edit each patch you are about to send::bool->false' @@ -2834,17 +3024,23 @@ __git_config_option-or-value () { sendemail.assume8bitEncoding:'encoding to use for non-ASCII messages::__git_encodings' sequence.editor:'text editor used by git rebase -i::_cmdstring' showbranch.default:'default set of branches for git show-branch::->branch' + status.aheadBehind:"display detailed ahead/behind counts relative to upstream branch::->bool:true" status.relativePaths:'show paths relative to current directory::->bool:false' + status.showStash:'show number of stashes::->bool:false' status.showUntrackedFiles:'show untracked files::->status.showUntrackedFiles:normal' status.submodulesummary:'include submodule summary::->bool:false' status.branch:'show branch and tracking info in short format::->bool:false' status.short:'use short format by default::->bool:false' + status.renameLimit:'number of files to consider when detecting copy/renames:limit (number of files):->int' + status.renames:"detect renames in 'status' and 'commit'::->diff.renames" 'submodule.*.branch:remote branch name for a submodule:branch name:->string' 'submodule.*.fetchRecurseSubmodules:fetch commits of submodules::->bool' 'submodule.*.path:path within project:submodule directory:_directories -qS \:' 'submodule.*.url:URL to update from::__git_any_repositories' 'submodule.*.update:update strategy to use::->submodule.update:none' 'submodule.*.ignore:ignore modifications to submodules with git status and git diff-*::->submodule.ignore' + submodule.recurse:'recurse into submodules by default (for most git commands)::->bool:false' + ssh.variant:'SSH command flavour:flavour id:compadd ssh simple plink putty tortoiseplink' svn.noMetadata:'disable git-svn-id: lines at end of commits::->bool:false' svn.useSvmProps:'use remappings of URLs and UUIDs from mirrors::->bool:false' svn.useSvnsyncProps:'use remappings of URLs and UUIDs for the svnsync command::->bool:false' @@ -2866,6 +3062,7 @@ __git_config_option-or-value () { 'svn-remote.*.pushurl:URL to push to::_urls' 'svn-remote.*.branches:branch mappings:branch mapping:->string' 'svn-remote.*.tags:tag mappings:tag mapping:->string' + tag.gpgSign:'sign all tags::->bool' tag.sort:'default sorting method:sorting method:->string' 'tar.*.command:specify a shell command through which the tar output generated by git archive should be piped::_cmdstring' 'tar.*.remote:enable <format> for use by remote clients via git-upload-archive::->bool' @@ -2885,6 +3082,8 @@ __git_config_option-or-value () { 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' + + {fetch.fsck.skipList,receive.fsck.skipList,fsck.skipList}:'ignore objects broken in a non-fatal way:path to a list of objects:_files' ) declare -a git_present_options # 'present' is an adjective @@ -2907,12 +3106,13 @@ __git_config_option-or-value () { pretty remotes ${(u)${(M)${git_options%%:*}:#*[.][*][.]*}%%.*} + ${(u)${(M)git_present_options:#*[.][*][.]*}%%.*} ) local key for key in $git_present_options ; do if (( ${+git_options[(r)(#i)${(b)key}:*]} )); then # $key is already in git_options - continue + continue elif (( ${+sections_that_permit_arbitrary_subsection_names[(r)${(b)key%%.*}]} )); then if [[ $key == *.*.* ]]; then # If $key isn't an instance of a known foo.*.bar:baz $git_options entry... @@ -2952,6 +3152,7 @@ __git_config_option-or-value () { if compset -P '[^.]##.*.'; then declare -a match mbegin mend + # TODO: completing 'gpg.openpgp<TAB>' adds both 'gpg.openpgp.program' and 'gpg.*.program' to $options, so it ends up being listed as 'unknown option name' even though we have a description # When completing 'remote.foo.<TAB>', offer 'bar' if $git_options contains 'remote.foo.bar'. options+=(${${${${(M)git_options:#(#i)${IPREFIX}[^.:]##:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}) # When completing 'remote.foo.<TAB>', offer 'bar' if $git_options contains 'remote.*.bar'. @@ -2989,8 +3190,8 @@ __git_config_option-or-value () { elif compset -P '[^.]##.'; then local opt declare -a match mbegin mend - for opt in ${${${${(M)git_options:#(#i)${IPREFIX}[^.:]##:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}; do - if (( ${git_options[(I)${opt%%:*}.*]} )); then + for opt in ${${${${(M)git_options:#(#i)${IPREFIX}[^.:][^:]#:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}; do + if (( ${git_options[(I)${IPREFIX}${opt%%:*}.*]} )); then sections_and_options+=$opt else options+=$opt @@ -3073,7 +3274,7 @@ __git_config_option-or-value () { ;; (*.) local -a existing_subsections=( ${${${(M)git_present_options:#${IPREFIX}*.*}#${IPREFIX}}%.*} ) - _describe -t existing-subsections "existing subsections" existing_subsections -S . && ret=0 + _describe -t existing-subsections "existing subsection" existing_subsections -S . && ret=0 ;; esac else @@ -3238,7 +3439,7 @@ __git_config_option-or-value () { _message 'git-merge options' ;; (bytes) - __git_guard_bytes "$parts[2]" && ret=0 + __git_guard_bytes "$parts[3]" && ret=0 ;; (color) compset -P '* ' @@ -3319,16 +3520,6 @@ __git_config_option-or-value () { __git_guard_number 'number of days' fi ;; - (days+now) - # TODO: This needs to be improved. - if [[ -n $current ]]; then - compadd - $current && ret=0 - elif [[ -n $parts[5] ]]; then - compadd - $parts[5] && ret=0 - else - __git_guard_number 'number of days' - fi - ;; (diff.algorithm) __git_config_values -- "$current" "$parts[5]" \ default:'basic greedy diff algorithm' \ @@ -3408,7 +3599,7 @@ __git_config_option-or-value () { elif [[ -n $parts[5] ]]; then compadd - $parts[5] && ret=0 else - __git_guard_number 'integer' + __git_guard_number ${parts[3]:-'integer'} fi ;; (merge.conflictstyle) @@ -3528,7 +3719,7 @@ __git_config_option-or-value () { (*) # TODO: Do we need to set up a _requested/_next_label? declare -a action - _description values expl "$parts[2]" + _description values expl "$parts[3]" eval "action=($parts[4])" "$action[1]" "$expl[@]" "${(@)action[2,-1]}" && ret=0 ;; @@ -3560,11 +3751,12 @@ _git-fast-export () { '--import-marks-if-exists=[load marks from file if it exists]: :_files' \ '--fake-missing-tagger=[fake a tagger when tags lack them]' \ '--use-done-feature[start with a "feature done" stanza, and terminate with a "done" command]' \ - '--no-data[do not output blocb objects, instead referring to them via their SHA-1 hash]' \ + "--no-data[skip output of blob objects, instead referring to them via their SHA-1 hash]" \ '--full-tree[output full tree for each commit]' \ '(--get --get-all)--name-only[show variable names only]' \ '*--refspec=[apply refspec to exported refs]:refspec' \ '--anonymize[anonymize output]' \ + '*--anonymize-map[apply conversion in anonymized output]:from\:to' \ '--reference-excluded-parents[reference parents not in fast-export stream by object id]' \ '--show-original-ids[show original object ids of blobs/commits]' \ '--mark-tags[label tags with mark ids]' \ @@ -3580,8 +3772,8 @@ _git-fast-import () { now\:"use current time and timezone"' \ '--done[terminate with error if there is no "done" command at the end of the stream]' \ '--force[force updating modified existing branches]' \ - '--max-pack-size=-[maximum size of each packfile]: : __git_guard_bytes' \ - '--big-file-threshold=-[maximum size of blob to create deltas for]: : __git_guard_bytes' \ + '--max-pack-size=-[maximum size of each packfile]: : __git_guard_bytes -d unlimited size' \ + '--big-file-threshold=-[maximum size of blob to create deltas for]: : __git_guard_bytes -d 512m size' \ '--depth=-[maximum delta depth for blob and tree deltification]: :__git_guard_number "maximum delta depth"' \ '--active-branches=-[maximum number of branches to maintain active at once]: :__git_guard_number "maximum number of branches"' \ '--export-marks=-[dump internal marks table when complete]: :_files' \ @@ -3691,10 +3883,9 @@ _git-reflog () { case $line[1] in (expire) - # TODO: -n, --dry-run is undocumented. _arguments -S \ - '(-n --dry-run)'{-n,--dry-run}'[undocumented]' \ - '--stale-fix[TODO\: provide a decent description for this option]' \ + '(-n --dry-run)'{-n,--dry-run}"[don't actually prune any entries; show what would be pruned]" \ + '--stale-fix[prune any reflog entries that point to "broken commits"]' \ '--expire=-[prune entries older than given time]: :__git_datetimes' \ '--expire-unreachable=-[prune entries older than given time and unreachable]: :__git_datetimes' \ '--all[prune all refs]' \ @@ -3703,9 +3894,8 @@ _git-reflog () { '--verbose[output additional information]' && ret=0 ;; (delete) - # TODO: -n, --dry-run is undocumented. _arguments -C -S \ - '(-n --dry-run)'{-n,--dry-run}'[undocumented]' \ + '(-n --dry-run)'{-n,--dry-run}"[dpn't update entries; show what would be done]" \ '--updateref[update ref with SHA-1 of top reflog entry after expiring or deleting]' \ '--rewrite[adjust reflog entries to ensure old SHA-1 points to new SHA-1 of previous entry after expiring or deleting]' \ '--verbose[output additional information]' \ @@ -3840,7 +4030,6 @@ _git-remote () { (( $+functions[_git-repack] )) || _git-repack () { - # TODO: --quiet is undocumented. _arguments -s \ '(-A --unpack-unreachable)-a[pack all objects into a single pack]' \ '(-a -k --keep-unreachable)-A[pack all objects into a single pack, but unreachable objects become loose]' \ @@ -3861,7 +4050,9 @@ _git-repack () { '--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]' \ - '--keep-pack=[ignore named pack]:pack' + '--keep-pack=[ignore named pack]:pack' \ + '(-g --geometric)'{-g+,--geometric=}'[find a geometric progression with specified factor]:factor' \ + '(-m --write-midx)'{-m,--write-midx}'[write a multi-pack index of the resulting packs]' } (( $+functions[_git-replace] )) || @@ -3923,7 +4114,6 @@ _git-blame () { '--ignore-revs-file=[ignore revisions from file]:file:_files' \ '(--color-by-age)--color-lines[color redundant metadata from previous line differently]' \ '(--color-lines)--color-by-age[color lines by age]' \ - '--indent-heuristic[use indent-based heuristic to improve diffs]' \ $revision_options \ ':: :__git_revisions' \ ': :__git_cached_files' && ret=0 @@ -3946,12 +4136,18 @@ _git-blame () { return ret } +(( $+functions[_git-bugreport] )) || +_git-bugreport() { + _arguments \ + '(-o --output-directory)'{-o+,--output-directory=}'[specify a destination for the bugreport file]:directory:_directories' \ + '(-s --suffix)'{-s+,--suffix=}'[specify a strftime format suffix for the filename]:format:_date_formats' +} + (( $+functions[_git-cherry] )) || _git-cherry () { - # TODO: --abbrev is undocumented. _arguments -S $endopt \ '(-v --verbose)'{-v,--verbose}'[output additional information]' \ - '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ + '--abbrev=[use specified digits to display object names]:digits' \ ':upstream commit:__git_commits' \ '::head commit:__git_commits' \ '::limit commit:__git_commits' @@ -4015,7 +4211,7 @@ _git-help () { '(-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 cli core-tutorial cvs-migration diffcore everyday glossary hooks ignore modules namespaces repository-layout revisions tutorial tutorial-2 workflows)"' + ': : _alternative commands:command:_git_commands "guides:git guide:(attributes cli core-tutorial cvs-migration diffcore everyday glossary hooks ignore modules namespaces repository-layout revisions tutorial tutorial-2 workflows)"' } (( $+functions[_git-instaweb] )) || @@ -4063,7 +4259,6 @@ _git-rerere () { local curcontext=$curcontext state line ret=1 declare -A opt_args - # TODO: --rerere-autoupdate is undocumented. _arguments -C -S -s $endopt \ '--rerere-autoupdate[register clean resolutions in index]' \ ': :->command' && ret=0 @@ -4352,7 +4547,8 @@ _git-send-email () { '--8bit-encoding=[encoding to use for non-ASCII messages]: :__git_encodings' \ '--compose-encoding=[encoding to use for compose messages]: :__git_encodings' \ '--transfer-encoding=[specify transfer encoding to use]:transfer encoding:(quoted-printable 8bit base64)' \ - '--envelope-sender[specify the envelope sender used to send the emails]: :_email_addresses' \ + '--envelope-sender=[specify the envelope sender used to send the emails]: :_email_addresses' \ + '--sendmail-cmd=[specify command to run to send email]:command:_cmdstring' \ '--smtp-encryption=[specify encryption method to use]: :__git_sendemail_smtpencryption_values' \ '--smtp-domain=[specify FQDN used in HELO/EHLO]: :_domains' \ '--smtp-pass=[specify password to use for SMTP-AUTH]::password' \ @@ -4441,7 +4637,6 @@ _git-svn () { case $line[1] in (clone|dcommit|fetch|init|migrate|rebase|set-tree) - # TODO: --ignore-refs is undocumented. # TODO: --no-auth-cache is undocumented. # TODO: --config-dir is undocumented. opts+=( @@ -4644,8 +4839,9 @@ _git-svn () { ;; (rebase) opts+=( - '(-l --local)'{-l,--local}"[don't fetch remotely, rebase against the last fetched commit from SVN]" - '(--preserve-merges -p)'{--preserve-merges,-p}'[try to recreate merges instead of ignoring them]' + '(-l --local)'{-l,--local}"[don't fetch remotely, rebase against the last fetched commit from SVN]" + '!--preserve-merges' + '(--rebase-merges -p)'{--rebase-merges,-p}'[try to recreate merges instead of ignoring them]' ) ;; (reset) @@ -4744,13 +4940,15 @@ _git-commit-graph() { if [[ $words[2] = write ]]; then args=( $progress '(--split --size-multiple --max-commits --expire-time)--append[include all commits present in existing commit-graph file]' - '(--append)--split[write the commit-graph as a chain of multiple commit-graph files]' + '--changed-paths[enable computation for changed paths]' + '(--append)--split=-[write the commit-graph as a chain of multiple commit-graph files]::strategy:(no-merge replace)' '(--stdin-packs --stdin-commits)--reachable[walk commits starting at all refs]' '(--reachable --stdin-commits)--stdin-packs[only walk objects in pack-indexes read from input]' '(--reachable --stdin-packs)--stdin-commits[walk commits starting at commits read from input]' '(--append)--size-multiple=:commits [2]' '(--append)--max-commits=:commits' '(--append)--expire-time=:date/time:__git_datetimes' + '--max-new-filters=[specify maximum number of changed-path bloom filters to compute]:' ) elif [[ $words[2] = verify ]]; then args=( $progress @@ -4760,7 +4958,7 @@ _git-commit-graph() { _arguments -S $endopt $args \ '--object-dir=[specify location of packfiles and commit-graph file]:directory:_directories' \ - '(-h)1:verb:(read verify write)' + '(-h)1:verb:(verify write)' } (( $+functions[_git-commit-tree] )) || @@ -4806,6 +5004,8 @@ _git-index-pack () { _arguments \ '-v[display progress on stderr]' \ '-o[write generated pack index into specified file]: :_files' \ + '(--no-rev-index)--rev-index[generate a reverse index corresponding to the given pack]' \ + "(--rev-index)--no-rev-index[don't generate a reverse index corresponding to the given pack]" \ '--stdin[read pack from stdin and instead write to specified file]' \ $stdin_opts \ '--strict[die if the pack contains broken objects or links]' \ @@ -4826,8 +5026,6 @@ _git-merge-file () { label_opt="*-L[label to use for the $ordinals[n_labels+1] file]:label" fi - # TODO: --marker-size in undocumented. - # TODO: --diff3 is undocumented. _arguments \ $label_opt \ '(-p --stdout)'{-p,--stdout}'[send merged file to standard output instead of overwriting first file]' \ @@ -4861,7 +5059,7 @@ _git-merge-index () { (( $+functions[_git-mktag] )) || _git-mktag () { - _message 'no arguments allowed; only accepts tags on standard input' + _arguments --no-strict } (( $+functions[_git-mktree] )) || @@ -4876,6 +5074,9 @@ _git-mktree () { _git-multi-pack-index() { _arguments \ '--object-dir=[specify location of git objects]:directory:_directories' \ + '(--progress)--no-progress[turn progress off]' '!(--no-progress)--progress' \ + '--stdin-packs[write a multi-pack index containing only pack index basenames provided on stdin]' \ + '--refs-snapshot=[specify a file which contains a "refs snapshot" taken prior to repacking]:file:_files' \ '--batch-size=[during repack, select packs so as to have pack files of at least the specified size]:size' \ '1:verb:(write verify expire repack)' } @@ -4905,16 +5106,17 @@ _git-pack-objects () { '--delta-base-offset[use delta-base-offset packing]' \ '--threads=-[specify number of threads for searching for best delta matches]: :__git_guard_number "number of threads"' \ '--non-empty[only create a package if it contains at least one object]' \ - '--revs[read revision arguments from standard input]' \ + '(--stdin-packs)--revs[read revision arguments from standard input]' \ '(--revs)--unpacked[limit objects to pack to those not already packed]' \ - '(--revs)--all[include all refs as well as revisions already specified]' \ + '(--revs --stdin-packs)--all[include all refs as well as revisions already specified]' \ '--reflog[include objects referred by reflog entries]' \ '--indexed-objects[include objects referred to by the index]' \ + '(--revs --all --keep-unreachable --pack-loose-unreachable --unpack-unreachable)--stdin-packs[read packs from stdin]' \ '(: --max-pack-size)--stdout[output pack to stdout]' \ '--include-tag[include unasked-for annotated tags if object they reference is included]' \ - '(--unpack-unreachable)--keep-unreachable[keep unreachable ]' \ - '--pack-loose-unreachable[pack loose unreachable objects]' \ - '(--keep-unreachable)--unpack-unreachable=-[unpack unreachable objects newer than specified time]::time' \ + '(--revs --stdin-packs --unpack-unreachable)--keep-unreachable[add objects unreachable from refs in packs named with --unpacked to resulting pack]' \ + '(--revs --stdin-packs)--pack-loose-unreachable[pack unreachable loose objects]' \ + '(--revs --stdin-packs --keep-unreachable)--unpack-unreachable=-[keep unreachable objects in loose form]::time' \ '--sparse[use sparse reachability algorithm]' \ '--include-tag[include tag objects that refer to objects to be packed]' \ $thin_opt \ @@ -4929,6 +5131,7 @@ _git-pack-objects () { '--missing=[specify how missing objects are handled]:action:(error allow-any allow-promisor print)' \ "--exclude-promisor-objects[don't pack objects in promisor packfiles]" \ '--delta-islands[respect islands during delta compression]' \ + '--uri-protocol=[exclude any configured uploadpack.blobpackfileuri with given protocol]:protocol' \ ':base-name:_files' } @@ -5029,6 +5232,7 @@ _git-update-index () { '(-q --unmerged --ignore-missing --refresh)--really-refresh[refresh index, unconditionally checking stat information]' \ '( --no-skip-worktree)--skip-worktree[set "skip-worktree" bit for given paths]' \ '(--skip-worktree )--no-skip-worktree[unset "skip-worktree" bit for given paths]' \ + "--ignore-skip-worktree-entries[don't touch index-only entries]" \ '(-)'{-g,--again}'[run git-update-index on differing index entries]' \ '(-)--unresolve[restore "unmerged" or "needs updating" state of files]' \ '--info-only[only insert files object-IDs into index]' \ @@ -5209,6 +5413,14 @@ _git-for-each-ref () { ':: :_guard "([^-]?#|)" pattern' } +(( $+functions[_git-for-each-repo] )) || +_git-for-each-repo() { + _arguments -S \ + '(-C --config)'{-C,--config=}'[specify config variable for list of paths]:config variable' \ + ':git command:_git_commands' \ + '*:: := _git' +} + (( $+functions[_git-ls-files] )) || _git-ls-files () { local no_empty_directory_opt= @@ -5217,7 +5429,6 @@ _git-ls-files () { no_empty_directory_opt="--no-empty-directory[don't list empty directories]" fi - # TODO: --resolve-undo is undocumented. # TODO: Replace _files with something more intelligent based on seen options. # TODO: Apply excludes like we do for git-clean. _arguments -S -s $endopt \ @@ -5231,8 +5442,9 @@ _git-ls-files () { '--eol[show line endings of files]' \ $no_empty_directory_opt \ '(-s --stage -u --unmerged --with-tree)'{-u,--unmerged}'[show unmerged files in output]' \ + '--resolve-undo[show resolve-undo information]' \ '(-k --killed)'{-k,--killed}'[show killed files in output]' \ - '-z[use NUL termination on output]' \ + '-z[separate paths with the NUL character]' \ '*'{-x,--exclude=-}'[skip files matching given pattern]:file pattern' \ '*'{-X,--exclude-from=-}'[skip files matching patterns in given file]: :_files' \ '*--exclude-per-directory=-[skip directories matching patterns in given file]: :_files' \ @@ -5243,8 +5455,9 @@ _git-ls-files () { '(-v)-f[indicate status of each file using lowercase for fsmonitor clean files]' \ '--full-name[force paths to be output relative to the project top directory]' \ '--recurse-submodules[recurse through submodules]' \ - '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ + '--abbrev=[use specified digits to display object names]:digits' \ '--debug[show debugging data]' \ + '--deduplicate[suppress duplicate entries]' \ '*:: :_files' } @@ -5275,10 +5488,10 @@ _git-ls-tree () { '(-t)-d[do not show children of given tree (implies -t)]' \ '-r[recurse into subdirectories]' \ '-t[show tree entries even when going to recurse them]' \ - '(-l --long)'{-l,--long}'[show object size of blob entries]' \ + '(-l --long --name-only --name-status)'{-l,--long}'[show object size of blob entries]' \ '-z[use NUL termination on output]' \ - '(--name-only --name-status)'{--name-only,--name-status}'[list only filenames, one per line]' \ - '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ + '(--name-only --name-status --abbrev)'{--name-only,--name-status}'[list only filenames, one per line]' \ + '(--name-only --name-status)--abbrev=[use specified digits to display object names]:digits' \ '--full-name[output full path-names]' \ '(--full-name)--full-tree[do not limit listing to current working-directory]' \ ': :__git_tree_ishs' \ @@ -5326,7 +5539,7 @@ _git-pack-redundant () { '(:)--all[process all packs]' \ '--alt-odb[do not require objects to be present in local packs]' \ '--verbose[output some statistics to standard error]' \ - '(--all)*::packs:_files -g "*.pack(-.)"' + '(--all)*::pack:_files -g "*.pack(-.)"' } (( $+functions[_git-rev-list] )) || @@ -5381,8 +5594,9 @@ _git_rev-list_filters() { } (( $+functions[_git-show-index] )) || -_git-show-index () { - _message 'no arguments allowed; accepts index file on standard input' +_git-show-index() { + _arguments \ + '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)' } (( $+functions[_git-show-ref] )) || @@ -5395,7 +5609,7 @@ _git-show-ref () { '(-d --dereference)'{-d,--dereference}'[dereference tags into object IDs as well]' \ '(-s --hash)'{-s+,--hash=-}'[only show the SHA-1 hash, not the reference name]:: :__git_guard_number length' \ '--verify[enable stricter reference checking]' \ - '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ + '--abbrev=[use specified digits to display object names]:digits' \ '(-q --quiet)'{-q,--quiet}'[do not print any results]' \ '*: :_guard "([^-]?#|)" pattern' \ - exclude \ @@ -5424,6 +5638,7 @@ _git-verify-pack () { _arguments -S -s $endopt \ '(-v --verbose)'{-v,--verbose}'[show objects contained in pack]' \ '(-s --stat-only)'{-s,--stat-only}'[do not verify pack contents; only display histogram of delta chain length]' \ + '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)' \ '*:index file:_files -g "*.idx(-.)"' } @@ -5502,14 +5717,14 @@ _git-send-pack () { '(-q --quiet)'{-q,--quiet}'[be more quiet]' \ '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[specify path to git-receive-pack on remote side]:remote path' \ '--remote[specify remote name]:remote' \ - '--all[update all refs that exist locally]' \ + '(*)--all[update all refs that exist locally]' \ '(-n --dry-run)'{-n,--dry-run}'[do everything except actually sending the updates]' \ '--mirror[mirror all refs]' \ '(-f --force)'{-f,--force}'[update remote orphaned refs]' \ "(--no-signed --signed)--sign=-[GPG sign the push]::signing enabled:(($^^sign))" \ '(--no-signed --sign)--signed[GPG sign the push]' \ "(--sign --signed)--no-signed[don't GPG sign the push]" \ - '--push-option=[specify option to transmit]:option' \ + '*--push-option=[specify option to transmit]:option' \ '--progress[force progress reporting]' \ '--thin[send a thin pack]' \ '--atomic[request atomic transaction on remote side]' \ @@ -5517,6 +5732,7 @@ _git-send-pack () { '--stdin[read refs from stdin]' \ '--helper-status[print status from remote helper]' \ '--force-with-lease=[require old value of ref to be at specified value]:refname\:expect' \ + '--force-if-includes[require remote updates to be integrated locally]' \ ': :__git_any_repositories' \ '*: :__git_remote_references' } @@ -5536,8 +5752,10 @@ _git-http-fetch () { '-v[report what is downloaded]' \ '-w[write commit-id into the filename under "$GIT_DIR/refs/<filename>"]:filename' \ '--recover[recover from a failed fetch]' \ - '(1)--stdin[read commit ids and refs from standard input]' \ - ': :__git_commits' \ + '(1 --packfile)--stdin[read commit ids and refs from standard input]' \ + '!(1 --stdin)--packfile=:hash' \ + '!--index-pack-args=:args' \ + '1: :__git_commits' \ ': :_urls' } @@ -5558,12 +5776,9 @@ _git-http-push () { (( $+functions[_git-receive-pack] )) || _git-receive-pack () { - # TODO: --advertise-refs is undocumented. - # TODO: --stateless-rpc is undocumented. _arguments -S -A '-*' $endopt \ '(-q --quiet)'{-q,--quiet}'[be quiet]' \ - '--advertise-refs[undocumented]' \ - '--stateless-rpc[undocumented]' \ + '--stateless-rpc[quit after a single request/response exchange]' \ ':directory to sync into:_directories' } @@ -5708,8 +5923,10 @@ _git-mailinfo () { '(-u --encoding)--encoding=-[encode commit information in given encoding]: :__git_encodings' \ '-n[disable all charset re-coding of metadata]' \ '(-m --message-id)'{-m,--message-id}'[copy the Message-ID header at the end of the commit message]' \ + '-n[disable charset re-coding of metadata]' \ '( --no-scissors)--scissors[remove everything in body before a scissors line]' \ '(--scissors )--no-scissors[do not remove everything in body before a scissors line]' \ + '--quoted-cr=[specify action when quoted CR is found]:action [warn]:(nowarn warn strip)' \ '--no-inbody-headers[undocumented]' \ ':message file:_files' \ ':patch file:_files' @@ -5910,6 +6127,7 @@ _git_commands () { gui:'run portable graphical interface to git' init:'create empty git repository or re-initialize an existing one' log:'show commit logs' + maintenance:'run tasks to optimize Git repository data' merge:'join two or more development histories together' mv:'move or rename file, directory, or symlink' notes:'add or inspect object notes' @@ -5923,6 +6141,7 @@ _git_commands () { rm:'remove files from the working tree and from the index' shortlog:'summarize git log output' show:'show various types of objects' + sparse-checkout:'initialize and modify the sparse-checkout' stash:'stash away changes to dirty working directory' status:'show working-tree status' submodule:'initialize, update, or inspect submodules' @@ -5946,6 +6165,7 @@ _git_commands () { ancillary_interrogator_commands=( blame:'show what revision and author last modified each line of a file' + bugreport:'collect information for user to file a bug report' count-objects:'count unpacked objects and display their disk consumption' difftool:'show changes using common diff tools' fsck:'verify connectivity and validity of objects in database' @@ -5980,7 +6200,7 @@ _git_commands () { index-pack:'build pack index file for an existing packed archive' merge-file:'run a three-way file merge' merge-index:'run merge for files needing merging' - mktag:'create tag object' + mktag:'create tag object with extra validation' mktree:'build tree-object from git ls-tree formatted text' multi-pack-index:'write and verify multi-pack-indexes' pack-objects:'create packed archive of objects' @@ -5999,6 +6219,7 @@ _git_commands () { diff-index:'compare content and mode of blobs between index and repository' diff-tree:'compare content and mode of blobs found via two tree objects' for-each-ref:'output information on each ref' + for-each-repo:'run a git command on a list of repositories' get-tar-commit-id:'extract commit ID from an archive created using git archive' ls-files:'information about files in index/working directory' ls-remote:'show references in a remote repository' @@ -6046,8 +6267,8 @@ _git_commands () { zstyle -a :completion:$curcontext: user-commands user_commands local command - for command in $_git_third_party_commands; do - (( $+commands[git-${command%%:*}] )) && third_party_commands+=$command + for command in ${(k)_git_third_party_commands}; do + (( $+commands[git-${command}] )) && third_party_commands+=$command$_git_third_party_commands[$command] done local -a aliases @@ -6207,6 +6428,16 @@ __git_merge_strategies () { "git merge -s '' 2>&1")"}:#[Aa]vailable (custom )#strategies are: *}#[Aa]vailable (custom )#strategies are: }%.}:-octopus ours recursive resolve subtree} } +(( $+functions[_git_strategy_options] )) || +_git_strategy_options() { + _values "strategy option" ours theirs ignore-space-change \ + ignore-all-space ignore-space-at-eol ignore-cr-at-eol \ + renormalize no-renormalize \ + 'find-renames::similarity threshold' \ + subtree:path \ + 'diff-algorithm:algorithm:(patience minimal histogram myers)' +} + (( $+functions[__git_encodings] )) || __git_encodings () { # TODO: Use better algorithm, as shown in iconv completer (separate it to a @@ -6359,6 +6590,31 @@ __git_daemon_service () { _describe -t services service services $* } +(( $+functions[_git_log_line_ranges] )) || +_git_log_line_ranges() { + local sep pos=start op=( / : ) + if compset -P '*[^,^]:'; then + __git_tree_files ${PREFIX:-.} HEAD + else + compset -P 1 '*,' && pos=end + if compset -P '(^|):'; then + _message -e functions function + elif compset -P '(^|)/'; then + _message -e patterns regex + else + zstyle -s ":completion:${curcontext}:forms" list-separator sep || sep=-- + sep=' -- ' + sep="${(q)sep}" + _guard "[0-9]#" "$pos line number" && return + compset -P \^ || op+=( \^ ) + _wanted forms expl form compadd -S '' -d "( + /\ $sep\ regex + :\ $sep\ function + ^\ $sep\ search\ from\ start\ of\ file )" $op + fi + fi +} + (( $+functions[__git_log_decorate_formats] )) || __git_log_decorate_formats () { declare -a log_decorate_formats @@ -6716,14 +6972,12 @@ __git_heads_local () { local f gitdir declare -a heads - heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads 2>/dev/null)"}) + heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads refs/bisect refs/stash 2>/dev/null)"}) gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) if __git_command_successful $pipestatus; then for f in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do [[ -f $gitdir/$f ]] && heads+=$f done - [[ -f $gitdir/refs/stash ]] && heads+=stash - [[ -f $gitdir/refs/bisect/bad ]] && heads+=bisect/bad fi __git_describe_commit heads heads-local "local head" "$@" @@ -6847,6 +7101,16 @@ __git_recent_commits () { return ret } +(( $+functions[_git_fixup] )) || +_git_fixup() { + local alts + alts=( 'commits: :__git_recent_commits' ) + if ! compset -P '(amend|reword):'; then + alts+=( 'actions:action:compadd -S: amend reword' ) + fi + _alternative $alts +} + (( $+functions[__git_blob_objects] )) || __git_blob_objects () { _guard '[[:xdigit:]](#c,40)' 'blob object name' @@ -7084,27 +7348,34 @@ __git_files_relative () { (( $+functions[__git_files] )) || __git_files () { - local compadd_opts opts tag description gitcdup gitprefix files expl + local compadd_opts opts tag description gittoplevel gitprefix files expl zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F: zparseopts -D -E -a opts -- -cached -deleted -modified -others -ignored -unmerged -killed x+: --exclude+: tag=$1 description=$2; shift 2 - gitcdup=$(_call_program gitcdup git rev-parse --show-cdup 2>/dev/null) + gittoplevel=$(_call_program toplevel git rev-parse --show-toplevel 2>/dev/null) __git_command_successful $pipestatus || return 1 + [[ -n $gittoplevel ]] && gittoplevel+="/" gitprefix=$(_call_program gitprefix git rev-parse --show-prefix 2>/dev/null) __git_command_successful $pipestatus || return 1 # TODO: --directory should probably be added to $opts when --others is given. - local pref=$gitcdup$gitprefix$PREFIX + local pref=${(Q)${~PREFIX}} + [[ $pref[1] == '/' ]] || pref=$gittoplevel$gitprefix$pref - # First allow ls-files to pattern-match in case of remote repository - files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\*}:-.} 2>/dev/null)"}) + # First allow ls-files to pattern-match in case of remote repository. Use the + # icase pathspec magic word to ensure that we support case-insensitive path + # completion for users with the appropriate matcher configuration + files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+:\(icase\)$pref\*}:-.} 2>/dev/null)"}) __git_command_successful $pipestatus || return - # If ls-files succeeded but returned nothing, try again with no pattern + # If ls-files succeeded but returned nothing, try again with no pattern. Note + # that ls-files defaults to the CWD if not given a path, so if the file we + # were trying to add is in an *adjacent* directory, this won't return anything + # helpful either if [[ -z "$files" && -n "$pref" ]]; then files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- 2>/dev/null)"}) __git_command_successful $pipestatus || return @@ -7206,7 +7477,6 @@ __git_changed_files () { # which case it is relative to the repository root. (( $+functions[__git_tree_files] )) || __git_tree_files () { - local multi_parts_opts local tree Path integer at_least_one_tree_added local -a tree_files compadd_opts @@ -7219,11 +7489,12 @@ __git_tree_files () { zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F: - [[ "$1" == */ ]] && Path="$1" || Path="${1:h}/" + Path=${(M)1##(../)#} + [[ ${1##(../)#} = */* ]] && extra_args+=( -r ) shift (( at_least_one_tree_added = 0 )) - for tree in $*; do - tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree -r ${(q)extra_args} --name-only -z ${(q)tree} 2>/dev/null)"}) + for tree; do + tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree $extra_args --name-only -z ${(q)tree} $Path 2>/dev/null)"}) __git_command_successful $pipestatus && (( at_least_one_tree_added = 1 )) done @@ -7257,7 +7528,7 @@ __git_repositories () { __git_local_repositories () { local expl - _wanted local-repositories expl 'local repositories' _directories + _wanted local-repositories expl 'local repository' _directories } (( $+functions[__git_repositories_or_urls] )) || @@ -7342,7 +7613,7 @@ __git_guard_number () { (( $+functions[__git_guard_bytes] )) || __git_guard_bytes () { - _guard '[[:digit:]]#([kKmMgG]|)' ${*:-size} + _numbers -u bytes ${*:-size} k m g } (( $+functions[__git_datetimes] )) || @@ -7375,8 +7646,31 @@ __git_setup_log_options () { '( --no-follow)--follow[follow renames]' '(--follow )--no-follow[do not follow renames]' '--source[show which ref each commit is reached from]' - '-L+[trace the evolution of a line range or regex within a file]:range' + '*-L+[trace evolution of line range, function or regex within a file]: :_git_log_line_ranges' + ) +} + +(( $+functions[__git_ws_error_highlight] )) || +__git_ws_error_highlight() { + _values -s , "kind of line" all default none context old new +} + +(( $+functions[__git_color_moved] )) || +__git_color_moved() { + local -a __git_color_moved=( + no:"do not highlight 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" ) + _describe "mode" __git_color_moved +} + +(( $+functions[__git_color_movedws] )) || +__git_color_movedws() { + _sequence compadd - no ignore-space-at-eol ignore-space-change ignore-all-space allow-indentation-change } (( $+functions[__git_setup_diff_options] )) || @@ -7425,13 +7719,8 @@ __git_setup_diff_options () { 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-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-color-moved-ws)--color-moved-ws=[configure how whitespace is ignored when performing move detection for --color-moved]:mode:_sequence compadd - no ignore-space-at-eol ignore-space-change ignore-all-space allow-indentation-change' + '(--color --no-color )--color-moved=-[color moved lines differently]::mode:__git_color_moved' + '(--no-color-moved-ws)--color-moved-ws=[configure how whitespace is ignored when performing move detection for --color-moved]:mode:__git_color_movedws' "(--color-moved-ws)--no-color-moved-ws=[don't ignore whitespace when performing move detection]" "--ita-invisible-in-index[hide 'git add -N' entries from the index]" "!(--ita-invisible-in-index)--ita-visible-in-index" @@ -7439,8 +7728,8 @@ __git_setup_diff_options () { $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]' '(--full-index)--binary[in addition to --full-index, output binary diffs for git-apply]' - '--ws-error-highlight=[specify where to highlight whitespace errors]: :_values -s , "kind of line" all default none context old new' - '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' + '--ws-error-highlight=[specify where to highlight whitespace errors]: :__git_ws_error_highlight' + '--abbrev=[use specified digits to display object names]:digits' '(-B --break-rewrites)'{-B-,--break-rewrites=-}'[break complete rewrite changes into pairs of given size]:: :__git_guard_number size' '(-M --find-renames)'{-M-,--find-renames=-}'[detect renames with given scope]:: :__git_guard_number size' '(-C --find-copies)'{-C-,--find-copies=-}'[detect copies as well as renames with given scope]:: :__git_guard_number size' @@ -7452,10 +7741,12 @@ __git_setup_diff_options () { '--diff-filter=-[select certain kinds of files for diff]: :_git_diff_filters' '-S-[look for differences that add or remove the given string]:string' '-G-[look for differences whose added or removed line matches the given regex]:pattern' - '--find-object=[look for differences that change the number of occurrences of the specified object]:object:__git_blobs' '--pickaxe-all[when -S finds a change, show all changes in that changeset]' '--pickaxe-regex[treat argument of -S as regular expression]' '-O-[output patch in the order of glob-pattern lines in given file]: :_files' + '--rotate-to=[show the change in specified path first]:path:_directories' + '--skip-to=[skip the output to the specified path]:path:_directories' + '--find-object=[look for differences that change the number of occurrences of specified object]:object:__git_blobs' '-R[do a reverse diff]' '--relative=-[exclude changes outside and output relative to given directory]:: :_directories' '(-a --text)'{-a,--text}'[treat all files as text]' @@ -7463,9 +7754,10 @@ __git_setup_diff_options () { '--ignore-cr-at-eol[ignore carriage-return at end of line]' '(-b --ignore-space-change -w --ignore-all-space)'{-b,--ignore-space-change}'[ignore changes in amount of white space]' '(-b --ignore-space-change -w --ignore-all-space)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' - '--ignore-blank-lines[do not show hunks that add or remove blank lines]' + '--ignore-blank-lines[ignore changes whose lines are all blank]' + \*{-I+,--ignore-matching-lines=}'[ignore changes whose lines all match regex]:regex' '--no-indent-heuristic[disable heuristic that shifts diff hunk boundaries to make patches easier to read]' - '--inter-hunk-context=[combine hunks closer than n lines]:n' + '--inter-hunk-context=[combine hunks closer than N lines]:number of lines' '--output-indicator-new=[specify the character to indicate a new line]:character [+]' '--output-indicator-old=[specify the character to indicate a old line]:character [-]' '--output-indicator-context=[specify the character to indicate a context line]:character [ ]' @@ -7479,11 +7771,8 @@ __git_setup_diff_options () { '(--no-prefix)--dst-prefix=[use given prefix for destination]:prefix' '--line-prefix=[prepend additional prefix to every line of output]:prefix' '(--src-prefix --dst-prefix)--no-prefix[do not show any source or destination prefix]' - '(-c --cc)'{-c,--cc}'[combined diff format for merge commits]' - - # TODO: --output is undocumented. - '--output[undocumented]:undocumented') + '--output=[output to a specific file]: :_files') } (( $+functions[__git_setup_diff_stage_options] )) || @@ -7500,13 +7789,15 @@ __git_setup_diff_stage_options () { __git_format_placeholders() { local sep local -a disp names placeholders expl - _describe -t formats format '( oneline:"commit-ids and subject of messages" - short:"few headers and only subject of messages" - medium:"most parts of messages" - full:"all parts of commit messages" - fuller:"like full and includes dates" - email:"use email headers like From and Subject" - raw:"the raw commits" )' -- '( format:"specify own format" )' -S ':' && return + _describe -t formats format '( oneline:"<hash> <title>" + short:"commit hash plus author and title headers" + medium:"like short plus author date header and full message" + full:"like medium with committer header instead of date" + fuller:"like full plus author and commit date headers" + reference:"<abbrev hash> (<title>, <short author date>)" + email:"email patch format" + mboxrd:"like email with From lines in message quoted with >" + raw:"entire commit object" )' -- '( format:"specify own format" )' -S ':' && return compset -P 'format:' compset -P '(%[^acgCG]|%?[^%]|[^%])#' if compset -P '%C'; then @@ -7672,7 +7963,7 @@ __git_setup_revision_options () { '(--left-only --right-only --cherry-pick --cherry-mark --no-merges --merges --max-parents)--cherry[synonym for --right-only --cherry-mark --no-merges]' '(-c --cc )--full-diff[show full commit diffs when using log -p, not only those affecting the given path]' '--log-size[print log message size in bytes before the message]' - '--use-mailmap[use mailmap file to map author and committer names and email]' + --{use-,}mailmap'[use mailmap file to map author and committer names and email]' '--reflog[show all commits from reflogs]' '--single-worktree[examine the current working tree only]' @@ -7702,13 +7993,14 @@ __git_setup_merge_options () { '(-n --no-stat)--stat[show a diffstat at the end of the merge]' '(--stat -n --no-stat)'{-n,--no-stat}'[do not show diffstat at the end of the merge]' '( --no-squash)--squash[merge, but do not commit]' - '--signoff[add Signed-off-by:]' + '--autostash[automatically stash/stash pop before and after]' + '--signoff[add Signed-off-by: trailer]' '(--squash )--no-squash[merge and commit]' '--ff-only[refuse to merge unless HEAD is up to date or merge can be resolved as a fast-forward]' '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" - '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' - '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' + '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' '(--verify-signatures)--verify-signatures[verify the commits being merged or abort]' '(--no-verify-signatures)--no-verify-signatures[do not verify the commits being merged]' '(-q --quiet -v --verbose)'{-q,--quiet}'[suppress all output]' @@ -7748,6 +8040,11 @@ __git_setup_fetch_options () { '(-q --quiet)--progress[force progress reporting]' '--show-forced-updates[check for forced-updates on all updated branches]' '--set-upstream[set upstream for git pull/fetch]' + '--shallow-since=[deepen history of shallow repository based on time]:time' \ + '*--shallow-exclude=[deepen history of shallow clone by excluding revision]:revision' \ + '--deepen[deepen history of shallow clone]:number of commits' \ + \*{-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' \ ) } @@ -7938,6 +8235,8 @@ __git_diff-or-merge-tools () { diffuse ecmerge emerge + examdiff + guiffy gvimdiff gvimdiff2 gvimdiff3 @@ -7951,6 +8250,7 @@ __git_diff-or-merge-tools () { vimdiff vimdiff2 vimdiff3 + winmerge xxdiff) builtindifftools=($builtintools kompare) @@ -8083,7 +8383,7 @@ _git() { local -A git_aliases local a k v local endopt='!(-)--end-of-options' - aliases=(${(0)"$(_call_program aliases git config -z --get-regexp '\^alias\.')"}) + aliases=(${(0)"$(_call_program aliases git config -z --get-regexp '\^alias\\.')"}) for a in ${aliases}; do k="${${a/$'\n'*}/alias.}" v="${a#*$'\n'}" @@ -8118,16 +8418,17 @@ _git() { '(- :)--version[display version information]' \ '(- :)--help[display help message]' \ '-C[run as if git was started in given path]: :_directories' \ - '*-c[pass configuration parameter to command]: :->configuration' \ + \*{-c,--config-env=}'[pass configuration parameter to command]: :->configuration' \ '--exec-path=-[path containing core git-programs]:: :_directories' \ '(: -)--man-path[print the manpath for the man pages for this version of Git and exit]' \ '(: -)--info-path[print the path where the info files are installed and exit]' \ '(: -)--html-path[display path to HTML documentation and exit]' \ '(-p --paginate -P --no-pager)'{-p,--paginate}'[pipe output into a pager]' \ '(-p --paginate -P --no-pager)'{-P,--no-pager}"[don't pipe git output into a pager]" \ - '--git-dir=-[path to repository]: :_directories' \ - '--work-tree=-[path to working tree]: :_directories' \ - '--namespace=-[set the Git namespace]:namespace' \ + '--git-dir=[path to repository]: :_directories' \ + '--work-tree=[path to working tree]: :_directories' \ + '--namespace=[set the Git namespace]:namespace' \ + '--super-prefix=[set a prefix which gives a path from above a repository down to its root]:path:_directories' \ '--bare[use $PWD as repository]' \ '--no-replace-objects[do not use replacement refs to replace git objects]' \ '--literal-pathspecs[treat pathspecs literally, rather than as glob patterns]' \ @@ -8140,7 +8441,8 @@ _git() { ;; (option-or-argument) curcontext=${curcontext%:*:*}:git-$words[1]: - (( $+opt_args[--git-dir] )) && local -x GIT_DIR=$opt_args[--git-dir] + (( $+opt_args[--git-dir] )) && local -x GIT_DIR=${(Q)${~opt_args[--git-dir]}} + (( $+opt_args[--work-tree] )) && local -x GIT_WORK_TREE=${(Q)${~opt_args[--work-tree]}} if ! _call_function ret _git-$words[1]; then if [[ $words[1] = \!* ]]; then words[1]=${words[1]##\!} @@ -8173,7 +8475,7 @@ _git() { } # Load any _git-* definitions so that they may be completed as commands. -declare -gUa _git_third_party_commands +declare -gA _git_third_party_commands _git_third_party_commands=() local file input @@ -8195,7 +8497,7 @@ for file in ${^fpath}/_git-*~(*~|*.zwc)(-.N); do (( i++ )) done < $file - _git_third_party_commands+=$name$desc + _git_third_party_commands+=([$name]=$desc) done _git diff --git a/Completion/Unix/Command/_gnupod b/Completion/Unix/Command/_gnupod index f53ae6c59..22ccabb9d 100644 --- a/Completion/Unix/Command/_gnupod +++ b/Completion/Unix/Command/_gnupod @@ -30,8 +30,8 @@ case "$service" in '(-b --set-bookmarkable)'{-b,--set-bookmarkable}'[set this song as bookmarkable (= Remember position)]' --set-shuffleskip'[exclude this file in shuffle-mode]' --set-compilation'[mark songs as being part of a compilation]' - --min-vol-adj='[minimum volume adjustment allowed by ID3v2.4 RVA2 tag (range -100 to 100, default 0)]' - --max-vol-adj='[maximum volume adjustment allowed by ID3v2.4 RVA2 tag (range -100 to 100, default 0)]' + --min-vol-adj='[minimum volume adjustment allowed by ID3v2.4 RVA2 tag]:adjustment (-100..100) [0]' + --max-vol-adj='[maximum volume adjustment allowed by ID3v2.4 RVA2 tag]:adjustment (-100..100) [0]' --artwork='[use FILE as album cover]:artwork:_files' '*:file to add:_files' ) diff --git a/Completion/Unix/Command/_gnutls b/Completion/Unix/Command/_gnutls index 6c9956b10..b9f91264d 100644 --- a/Completion/Unix/Command/_gnutls +++ b/Completion/Unix/Command/_gnutls @@ -37,6 +37,8 @@ case "$service" in '--x509crlfile=[specify CRL file to use]:file:_files' '*--x509keyfile=[specify X.509 key file to use]:file:_files' '*--x509certfile=[specify X.509 certificate file to use]:file:_files' + '*--rawpkkeyfile=[specify private key file or URL to use]:file:_files' + '*--rawpkfile=[specify raw public-key file to use]:file:_files' '(-l --list -p --port)'{-l,--list}'[print list of the supported algorithms/modes]' '--keymatexport=[specify label used for exporting keying material]:label' '--keymatexportsize=[specify size of the exported keying material]:size' @@ -70,7 +72,8 @@ case "$service" in '--fastopen[enable TCP Fast Open]' "--print-cert[print peer's certificate in PEM format]" "--save-cert=[save peer's certificate chain in the specified file in PEM format]:file:_files" - "--save-ocsp=[save peer's OCSP status response in the provided file]:file:_files" + "(--save-ocsp-multi)--save-ocsp=[save peer's OCSP status response in the provided file]:file:_files" + "(--save-ocsp)--save-ocsp-multi=[save all peer's OCSP responses in the provided file]:file:_files" '--save-server-trace=[save the server-side TLS message trace in the provided file]:file:_files' '--save-client-trace=[save the client-side TLS message trace in the provided file]:file:_files' '--dh-bits=[specify minimum number of bits allowed for DH]:bits' @@ -93,6 +96,8 @@ case "$service" in '--inline-commands-prefix=[change delimiter used for inline commands]:delimiter [^]' '--fips140-mode[report status of FIPS140-2 mode in gnutls library]' '--logfile=[redirect informational messages to a specific file]:file:_files' + '--waitresumption[block waiting for the resumption data under TLS1.3]' + '--ca-auto-retrieve[enable automatic retrieval of missing CA certificates]' ) ;; @@ -109,6 +114,7 @@ case "$service" in "--nodb[don't use a resumption database]" '--http[act as an HTTP server]' '--echo[act as an Echo server]' + "--crlf[don't replace CRLF by LF in Echo server mode]" '(-a --disable-client-cert -r --require-client-cert)'{-a,--disable-client-cert}"[don't request a client certificate]" '(-a --disable-client-cert -r --require-client-cert)'{-r,--require-client-cert}'[require a client certificate]' '--verify-client-cert[if a client certificate is sent then verify it]' @@ -144,7 +150,8 @@ case "$service" in '--verify-crl[verify a CRL]' '(--verify-email)--verify-hostname=[specify hostname to be used for certificate chain verification]:hostname:_hosts' '(--verify-hostname)--verify-email=[specify email to be used for certificate chain verification]:email:_email_addresses' - '--verify-purpose=[specify a purpose OID to be used for certificate chain verification]' + '--verify-purpose=[specify a purpose OID to be used for certificate chain verification]:purpose' + '--verify-profile=[specify a security level profile to be used for verification]:profile' '--p7-sign[sign using a PKCS #7 structure]' '--p7-detached-sign[sign using a detached PKCS #7 structure]' "--no-p7-include-cert[don't include signer's certificate will in the cert list]" diff --git a/Completion/Unix/Command/_go b/Completion/Unix/Command/_go index 30a2bf88f..0b4b16dfa 100644 --- a/Completion/Unix/Command/_go +++ b/Completion/Unix/Command/_go @@ -15,4 +15,4 @@ case $service in ;; esac -_wanted files expl "input file" _files -g "$pat" +_wanted files expl "input file" _files -g "$pat(-.)" diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg index b35693d1f..5d54865d5 100644 --- a/Completion/Unix/Command/_gpg +++ b/Completion/Unix/Command/_gpg @@ -173,7 +173,7 @@ fi '--dump-options[show all options]' ) -extra=( ${${${args#\([^\)]#\)}#\*}%%[:=\[]*} ) +extra=( ${${${args#\([^\)]#\)}#\*}%%[=:\[]*} ) extra=( ${allopts:|extra} ) _arguments -C -s -S -A "-*" $args $extra '*:args:->args' && ret=0 diff --git a/Completion/Unix/Command/_gprof b/Completion/Unix/Command/_gprof index 3bb7a5765..a7e602fd5 100644 --- a/Completion/Unix/Command/_gprof +++ b/Completion/Unix/Command/_gprof @@ -3,8 +3,8 @@ local curcontext="$curcontext" state line ret=1 typeset -A opt_args -_arguments -C -s -{a,b,c,D,h,i,l,L,s,T,v,w,x,y,z} \ - -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name:->funcs' \ +_arguments -C -s -{a,b,c,D,h,i,l,L,r,s,T,v,w,x,y,z} \ + -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,R,S,t,Z}:'function name:->funcs' \ '-I:directory:_dir_list' \ '-d-:debug level:' '-k:function names:->pair' \ '-m:minimum execution count:' \ diff --git a/Completion/Unix/Command/_gradle b/Completion/Unix/Command/_gradle index 9a75daefb..a1d9381cb 100644 --- a/Completion/Unix/Command/_gradle +++ b/Completion/Unix/Command/_gradle @@ -1,9 +1,9 @@ #compdef gradle gradlew local curcontext="$curcontext" ret=1 state state_descr line -local gradle_inspect=yes cache_policy tag_order +local gradle_inspect=yes cache_policy tag_order filter= local -A opt_args -local -a gradle_group_tasks gradle_all_tasks +local -aU gradle_group_tasks gradle_all_tasks tasks # Set the caching policy to invalidate cache if the build file is newer than the cache. _gradle_caching_policy() { @@ -78,35 +78,57 @@ if [[ $words[CURRENT] != -* ]]; then local -a match mbegin mend # Run gradle/gradlew and retrieve possible tasks. for outputline in ${(f)"$($service --build-file $gradle_buildfile -q tasks --all)"}; do - if [[ $outputline == [[:blank:]]#(#b)([[:alnum:]]##)' - '(*) ]]; then + # Subproject tasks are prefixed with one or more instances of [[:alnum:]]##\: + # Leaving out the prefix runs the task in all subprojects where it exists. + if [[ $outputline == + [[:blank:]]#(#b)([[:alnum:]]##\:)#([[:alnum:]]##)' - '(*) ]]; then # The descriptions of main tasks start at beginning of line, descriptions of # secondary tasks are indented. if [[ $outputline == [[:alnum:]]* ]]; then - gradle_group_tasks+=( "$match[1]:$match[2]" ) + gradle_group_tasks+=( + "$match[-2]:$match[-1]" + "${${(j::)match[1,-2]}//:/\:}:$match[-1]" + ) else - gradle_all_tasks+=( "$match[1]:$match[2]" ) + gradle_all_tasks+=( + "${${(j::)match[1,-2]}//:/\:}:$match[-1]" + ) fi fi done _store_cache $cache_name gradle_group_tasks gradle_all_tasks fi + filter= + zstyle -T ":completion:${curcontext}:tasks" prefix-needed && + [[ $PREFIX != ([[:alnum:]]##\:)## ]] && + filter+="*\:*" if [[ $state == task ]]; then _tags gradle_group gradle_all while _tags; do # Offer main tasks and secondary tasks in different tags. - _requested gradle_group && _describe 'group tasks' gradle_group_tasks && ret=0 - _requested gradle_all && _describe 'secondary tasks' gradle_all_tasks && ret=0 + if _requested gradle_group; then + tasks=( ${gradle_group_tasks:#$~filter} ) + _describe -t tasks 'group task' tasks && + ret=0 + fi + if _requested gradle_all; then + tasks=( ${gradle_all_tasks:#$~filter} ) + _describe -t tasks 'secondary task' tasks && + ret=0 + fi (( ret )) || break done elif [[ $state == alltask ]]; then # After '--exclude-task', we don't make a distinction between main tasks and # secondary tasks. - _describe 'all tasks' gradle_group_tasks -- gradle_all_tasks && ret=0 + tasks=( ${gradle_group_tasks:#$~filter} ${gradle_all_tasks:#$~filter} ) + _describe -t tasks 'task' tasks && + ret=0 fi fi else - _describe 'built-in tasks' '( + _describe 'built-in task' '( "dependencies:Displays all dependencies declared in root project." "dependencyInsight:Displays the insight into a specific dependency in root project." "help:Displays a help message." diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep index 81516b08a..2dcbff4a3 100644 --- a/Completion/Unix/Command/_grep +++ b/Completion/Unix/Command/_grep @@ -1,6 +1,7 @@ -#compdef grep egrep fgrep bsdgrep zgrep zegrep zfgrep ggrep gegrep gfgrep gzgrep gzegrep gzfgrep bzgrep bzegrep bzfgrep -value-,GREP_OPTIONS,-default- +#compdef grep egrep fgrep bsdgrep rgrep zgrep zegrep zfgrep ggrep gegrep gfgrep gzgrep gzegrep gzfgrep bzgrep bzegrep bzfgrep -value-,GREP_OPTIONS,-default- -local arguments matchers command variant +local command variant +local -a arguments matchers if [[ $service = *GREP_OPT* ]]; then compset -q @@ -27,6 +28,10 @@ if [[ $service != (|g|z|gz|bz)[ef]grep ]]; then $matchers{--basic-regexp,-G}'[use basic regular expression]' ) fi +[[ $service = rgrep ]] || arguments+=( + '(--directories -d -r --recursive)'{--directories=,-d+}'[specify handling of directories]:action on directory:(read skip recurse)' + '(--recursive -r --dereference-recursive -R -d --directories)'{--recursive,-r}'[recurse subdirectories]' +) arguments+=( '(--after-context -A)'{--after-context=,-A+}'[specify lines of trailing context]:lines' @@ -37,7 +42,6 @@ arguments+=( '(--byte-offset -b -c)'{--byte-offset,-b}'[print the byte offset with output lines]' '(--text -a -I)--binary-files=[specify type to assume for binary files]:file type:(binary without-match text)' '(--count -c --byte-offset -b --line-number -n)'{--count,-c}'[only print a count of matching lines]' - '(--directories -d -r --recursive)'{--directories=,-d+}'[specify handling of directories]:action on directory:(read skip recurse)' '(--devices -D)'{--devices=,-D+}'[specify handling of devices, FIFOs and sockets]:action on device:(read skip)' '(1)*'{--regexp=,-e+}'[specify pattern]:pattern' '(1)*'{--file=,-f+}'[specify pattern file]:file:_files' @@ -53,11 +57,10 @@ arguments+=( '(--line-number -n -c)'{--line-number,-n}'[prefix output with line numbers]' '(--only-matching -o --files-with-matches -l --files-without-match -L)'{--only-matching,-o}'[show only matching part of line]' '(--quiet --silent -q)'{--quiet,--silent,-q}'[suppress normal output]' - '(--recursive -r --dereference-recursive -R -d --directories)'{--recursive,-r}'[recurse subdirectories]' '*--include=[examine files matching specified pattern]:file pattern' '*--exclude=[skip files matching specified pattern]:file pattern' '*--exclude-dir=[skip directories matching specified pattern]:directory pattern' - '(--no-messages -s)'{--no-messages,-s}'[suppress messages about unreadable]' + '(--no-messages -s)'{--no-messages,-s}'[suppress messages about unreadable or non-existent files]' '(--version -V)'{--version,-V}'[display version info]' '(--invert-match -v)'{--invert-match,-v}'[select non-matching lines]' '(--word-regexp -w --line-regexp -x)'{--word-regexp,-w}'[force pattern to match only whole words]' @@ -72,6 +75,12 @@ case $variant:$OSTYPE in $matchers{--perl-regexp,-P}'[use perl regular expression]' ) ;| + *:openbsd*|unix:freebsd*) + arguments=( # argument to context is optional and after = only + ${arguments:#((#s)|*\))-(C|-context)*} + '(--context -C)'{--context=-,-C-}'[specify lines of context]::lines' + ) + ;| (gnu:*|gpl2:(free|net)bsd*)) arguments+=( '*--exclude-from=[skip files matching pattern in specified file]:file:_files' @@ -85,15 +94,15 @@ case $variant:$OSTYPE in '(-Z --decompress -J --bz2decompress)'{-Z,--decompress}"[decompress gzip'ed input before searching]" ) ;| - gpl2:darwin*) + (gpl2:darwin*|unix:freebsd*)) arguments+=( - '(-p -S)-O[follow symlinks on the command line]' - '(-O -S)-p[do not follow symlinks]' - '(-O -p)-S[follow all symlinks]' + '(-p -S)-O[recurse symlinks on the command line]' + "!(-O -S)-p[don't recurse symlinks]" + '(-O -p)-S[recurse all symlinks]' '*--include-dir=[only search directories matching specified pattern]:directory pattern' ) ;| - (gnu:*|gpl2:netbsd*)) + (gnu:*|gpl2:netbsd*|unix:freebsd*)) arguments+=( '(--null -Z --no-filename -h)'{--null,-Z}'[print 0 byte after each filename]' ) @@ -106,6 +115,15 @@ case $variant:$OSTYPE in '(--recursive -r --dereference-recursive -R -d --directories)'{--dereference-recursive,-R}'[recurse subdirectories, following symlinks]' ) ;; + unix:freebsd*) + arguments+=( + '!(-U --binary --binary-files)'{-U,--binary} + '--mmap[use mmap(2) instead of read(2) to read input]' + ) + [[ $service = rgrep ]] || arguments+=( + '(--recursive -r -d --directories)-R[recurse subdirectories]' + ) + ;; gpl2:*) arguments=( ${${arguments:#*\)-r}/\)-r/\)-R} ) ;; *:openbsd*) arguments=( @@ -122,4 +140,3 @@ case $variant:$OSTYPE in esac _arguments -S -s $arguments[@] - diff --git a/Completion/Unix/Command/_growisofs b/Completion/Unix/Command/_growisofs index 8f4da4030..206d2c2c7 100644 --- a/Completion/Unix/Command/_growisofs +++ b/Completion/Unix/Command/_growisofs @@ -270,7 +270,7 @@ else '-sort[sort files on the image based on weights defined in the given file]:sort-weighting file:_files' \ '-sparc-label[set the sun disk-label-name used for the -sparc-boot option]:label' \ '-split-output[split the output image into several files ~1GiB in size]' \ - '-stream-media-size[enable streaming operation and set media size to given number of sectors]:media size in sectors' \ + '-stream-media-size[enable streaming operation and set media size to given number of sectors]:media size (sectors)' \ '-stream-file-name[reserved for future use]:name' \ '-sunx86-boot[specify a comma-separated list of file-system images needed to make a bootable Solaris-x86-CD]:list' \ '-sunx86-label[specify the SVr4 disk-label-name for the SVr4 disk-label created with the -sunx86-boot option]:label' \ diff --git a/Completion/Unix/Command/_gzip b/Completion/Unix/Command/_gzip index 42d4ae705..8354b34d4 100644 --- a/Completion/Unix/Command/_gzip +++ b/Completion/Unix/Command/_gzip @@ -9,10 +9,14 @@ files=( '*:files:->files' ) case "$service" in unpigz|pigz) pigz=( - '(-K --zip)'{-K,--zip}'[compress to PKWare zip format]' + '(-A --alias)'{-A+,--alias=}'[specify filename to use in zip entry for stdin]:filename' + '(-C --comment)'{-C+,--comment=}'[put specified comment in the gzip or zip header]' + '(-H --huffman -U --rle)'{-H,--huffman}'[use only Huffman coding for compression]' + '(-U --rle -H --huffman)'{-U,--rle}'[use run-length encoding for compression]' + '(-K --zip -z --zlib)'{-K,--zip}'[compress to PKWare zip format]' '(-b --blocksize)'{-b+,--blocksize}'[set compression block size]:size (KiB)' '(-p --processes)'{-p,--processes}'[specify number of processes to use]' - '(-z --zlib)'{-z,--zlib}'[compress to zlib (.zz) format]' + '(-z --zlib -K --zip)'{-z,--zlib}'[compress to zlib (.zz) format]' '(-m --no-time)'{-m,--no-time}"[don't store/restore modification time in/from header]" '(-M --time)'{-M,--time}"[store/restore modification time in/from header]" '(--synchronous)-Y[force output file write to permanent storage]' diff --git a/Completion/Unix/Command/_head b/Completion/Unix/Command/_head index 1e968cc11..0771b1e4d 100644 --- a/Completion/Unix/Command/_head +++ b/Completion/Unix/Command/_head @@ -18,7 +18,13 @@ else case $OSTYPE in (freebsd*|darwin*|dragonfly*|netbsd*) args+=( '(-n)-c+[display the first specified bytes]:number of bytes' ) - ;; + ;| + dragonfly*|netbsd*) + args+=( + '(-v)-q[never print headers giving file names]' + '(-q)-v[always print headers giving file names]' + ) + ;; esac fi @@ -26,20 +32,14 @@ _arguments -C -s -S $opts : $args '*:file:_files' && return 0 case $state in (number) - local mlt sign digit - mlt='multiplier:multiplier:((b\:512 K\:1024 KB\:1000 M\:1024\^2' - mlt+=' MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4))' - sign='sign:sign:((-\:"print all but the last specified bytes/lines"' - sign+=' +\:"print the first specified bytes/lines (default)"))' - digit='digits:digit:(0 1 2 3 4 5 6 7 8 9)' - if compset -P '(-|+|)[0-9]##'; then - _alternative $mlt $digit && ret=0 - elif [[ -z $PREFIX ]]; then - _alternative $sign $digit && ret=0 - elif compset -P '(+|-)'; then - _alternative $digit && ret=0 - fi - ;; + local alts + [[ -z $PREFIX ]] && alts=( + 'sign:sign:((-\:"print all but the last specified bytes/lines" +\:"print the first specified bytes/lines (default)"))' + ) + compset -P '+' + alts+=( 'numbers: :_numbers -N $state_descr b\:512 K\:1024 KB\:1000 M\:1024\^2 MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4' ) + _alternative $alts && ret=0 + ;; esac return ret diff --git a/Completion/Unix/Command/_imagemagick b/Completion/Unix/Command/_imagemagick index 3afa108ae..b7671fe49 100644 --- a/Completion/Unix/Command/_imagemagick +++ b/Completion/Unix/Command/_imagemagick @@ -262,7 +262,10 @@ case "$service" in _arguments -C -M 'm:{a-z}={A-Z}' \ '-adjoin[join images]' \ '-affine[drawing transform matrix]:matrix' \ + '-alpha[set the alpha channel]:alpha' \ '-antialias[remove pixel aliasing]' \ + '-authenticate[decrypt image with specified password]:password' \ + '-attenuate[lessen (or intensify) when adding noise to an image]:value' \ '-append[append image sequence]' \ '-average[average image sequence]' \ '-background[specify background color]:color:_x_color' \ @@ -301,6 +304,7 @@ case "$service" in '(-endian)+endian' \ '-enhance[enhance image]' \ '-equalize[histogram equalization]' \ + '-features[analyze image features (e.g. contrast, correlation)]:distance' \ '-fill[specify color to use when filling a graphic primitive]:color:_x_color' \ '-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ '-flatten[flatten a sequence of images]' \ @@ -315,12 +319,14 @@ case "$service" in '-gravity:image gravity:(Center North NorthEast East SouthEast South SouthWest West NorthWest)' \ '-implode:implosion factor (0.0 - 99.9%%)' \ '-interlace:interlacing scheme:(None Line Plane Partition)' \ + '-interpolative-resize[resize image using point sampled interpolation]:geometry' \ '-label:label string' \ '-layer:layer type:(Red Green Blue Matte)' \ '-linewidth:line width' \ '-loop:number of iterations (GIF animation)' \ '-map[single image colormap file]:picture file for colors:_imagemagick' \ '+map[all images colormap file]:picture file for colors:_imagemagick' \ + '-mask[associate a mask with the image]:file:_files' \ '-matte[store matte channel]' \ '-modulate:<brightness>,<saturation>,<hue>' \ '-monochrome[transform to black and white]' \ @@ -352,6 +358,7 @@ case "$service" in '-size:image size (<width>x<height>+<offset>)' \ '-solarize:solarization threshold' \ '-spread:neighborhood size' \ + '-support[specify resize support]:support (>1.0 is blurry, < 1.0 is sharp)' \ '-swirl:swirl tightness' \ '-texture:background texture image:_imagemagick' \ '-threshold:threshold for maximum intensity' \ diff --git a/Completion/Unix/Command/_initctl b/Completion/Unix/Command/_initctl index 2d7c2494b..b60bdbc5b 100644 --- a/Completion/Unix/Command/_initctl +++ b/Completion/Unix/Command/_initctl @@ -51,14 +51,14 @@ _initctl_known_events() _initctl_multiple_known_events() { [[ ${#_initctl_events_list} -eq 0 ]] && _initctl_fillarray_events_args - _values -s "," "Events" "$_initctl_events_list[@]" + _values -s "," "event" "$_initctl_events_list[@]" } # list KEY= arguments, generate array if necessary _initctl_known_eventargs() { [[ ${#_initctl_eventargs_list} -eq 0 ]] && _initctl_fillarray_events_args - _values "Argument Keys" "$_initctl_eventargs_list[@]" + _values "argument key" "$_initctl_eventargs_list[@]" } # describe and offer commands for initctl, then call matching completion function @@ -82,7 +82,7 @@ _initctl_command() ) if (( CURRENT == 1 )); then - _describe -t command "initctl Commands" cmds + _describe -t command "initctl command" cmds fi local cmd=$words[1] @@ -97,8 +97,8 @@ _initctl_startstop() _arguments \ '--no-wait[do not wait for operation to complete before exiting]' \ "${common_args[@]}" \ - ':Upstart Jobs:_initctl_helper_jobs' \ - '*::Argument Keys:_initctl_known_eventargs' + ':upstart job:_initctl_helper_jobs' \ + '*::argument key:_initctl_known_eventargs' } # completion for anything that takes one job @@ -106,7 +106,7 @@ _initctl_argjob() { _arguments \ "${common_args[@]}" \ - ':Upstart Jobs:_initctl_helper_jobs' \ + ':upstart job:_initctl_helper_jobs' \ '*::' } @@ -116,8 +116,8 @@ _initctl_emit() _arguments \ '--no-wait[do not wait for event to finish before exiting]' \ "${common_args[@]}" \ - ':Events:_initctl_known_events' \ - '*::Argument Keys:_initctl_known_eventargs' + ':event:_initctl_known_events' \ + '*::argument key:_initctl_known_eventargs' } # the fallback, just the options @@ -133,7 +133,7 @@ _initctl_show-config() _arguments \ "(-e --enumerate)"{-e,--enumerate}"[enumerate emit lines]" \ "${common_args[@]}" \ - '::Upstart Jobs:_initctl_helper_jobs' \ + '::upstart job:_initctl_helper_jobs' \ '*::' } @@ -144,7 +144,7 @@ _initctl_check-config() "(-i --ignore-events)"{-i,--ignore-events}"[list of comma-separated events to ignore]:Events:_initctl_multiple_known_events" \ "(-w --warn)"{-w,--warn}"[treat any unknown jobs or events as error]" \ "${common_args[@]}" \ - '::Upstart Jobs:_initctl_helper_jobs' \ + '::upstart job:_initctl_helper_jobs' \ '*::' } @@ -157,7 +157,7 @@ _initctl() '--system[talk via DBUS system bus instead of socket]' '(-q --quiet)'{-q,--quiet}'[reduce output to errors only]' '(-v --verbose)'{-v,--verbose}'[increase output to include informational messages]' - '--dest=[D-Bus name for init, defaults to com.ubuntu.Upstart]' + '--dest=[specify D-Bus name for init]:D-Bus name [com.ubuntu.Upstart]' '--help[display help and exit]' '--version[output version information and exit]' ) @@ -172,7 +172,7 @@ _initctl() # depending on which command was used, call different completion functions case $service in initctl) - _arguments "${common_args[@]}" '*::Initctl Commands:_initctl_command' + _arguments "${common_args[@]}" '*::initctl command:_initctl_command' ;; start|stop|restart|reload|status) _call_function ret _initctl_${cmd_completion_funcs[${service}]-${cmd_completion_default}} diff --git a/Completion/Unix/Command/_install b/Completion/Unix/Command/_install index 5ad84645e..364119961 100644 --- a/Completion/Unix/Command/_install +++ b/Completion/Unix/Command/_install @@ -106,7 +106,7 @@ case $state in 'a[symlinks use absolute path]' 'r[symlinks use relative path]' ) - _values -S '' 'link flags' $tmp && ret=0 + _values -S '' 'link flag' $tmp && ret=0 ;; esac diff --git a/Completion/Unix/Command/_iostat b/Completion/Unix/Command/_iostat index f5291a19b..1152b0d8b 100644 --- a/Completion/Unix/Command/_iostat +++ b/Completion/Unix/Command/_iostat @@ -128,10 +128,13 @@ case $OSTYPE:l in '-c[display CPU utilization report]' '-d[display device utilization report]' '--dec=-[specify the number of decimal places to use]:decimal places [2]:(0 1 2)' + '-f[specify alternative directory to read device statistics from]:directory:_directories' + '+f[specify additional directory to read device statistics from]:directory:_directories' '*-g[display statistics for a group of devices]:group name' '-H[only display global statistics for group]' '(--human)-h[human readable device utilization report]' '--human[print sizes in human readable format]' + '--pretty[make report easier to read by a human]' '-j[display persistent device name]:name type:(ID LABEL PATH UUID)' '(-m)-k[display statistics in kB/s]' '(-k)-m[display statistics in MB/s]' diff --git a/Completion/Unix/Command/_java b/Completion/Unix/Command/_java index ee0441d97..ff6e82645 100644 --- a/Completion/Unix/Command/_java +++ b/Completion/Unix/Command/_java @@ -24,18 +24,24 @@ javac) '(-cp -classpath)'{-cp,-classpath}'[specify where to find user class files]:class path:->classpath' \ '-sourcepath[specify where to find input source files]:source path:->sourcepath' \ '-bootclasspath[override location of bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ + '-endorseddirs[override location of endorsed standards path]:path:->extdirs' \ '-extdirs[override location of installed extensions]:extensions directories:->extdirs' \ '-d[specify where to place generated class files]:directory:_files -/' \ '-encoding[specify character encoding used by source files]:encoding:->encoding' \ '-proc\:-[control annotation processing]:annotation processing:(none only)' \ '-processor[specify annotation processors to run]:class:_files' \ '-processorpath[specify where to find annotation processors]:directory:_directories' \ + '-parameters[generate metadata for reflection on method parameters]' \ '-s[specify directory for generated source files]:directory:_directories' \ + '-h[specify where to place generated native header files]:directory:_directories' \ '-source[provide source compatibility with specified release]:release:(1.{2..8} {5..8})' \ '-target[specify VM version]:release:(1.{1..5})' \ + '-profile[check that API used is available in the specified profile]:profile' \ '(-)-help[print a synopsis of standard options]' \ '(-)-version[print version information]' \ '(-)-X[display information about non-standard options]' \ + '-J-[pass flag directly to the runtime system]:flag' \ + '-Werror[terminate compilation if warnings occur]' \ '*:java source file:_files -g \*.java\(-.\)' && return 0 ;; @@ -75,6 +81,7 @@ java) '(- 1)-'{\?,help}'[print help message]' \ '(- 1)-X-[non-standard java option]:option' \ '(- 1)-jar[specify a program encapsulated as jar]:jar:_files -g \*.jar\(-.\)' \ + '-splash\:-[show splash screen with specified image]:image:_files' \ '(-):class:_java_class -m main ${(kv)opt_args[(i)(-classpath|-cp)]}' \ '*::args:= _normal' \ && return 0 @@ -90,15 +97,20 @@ javadoc) '-help[print help message]' \ '-doclet[specify a doclet]:doclet:_java_class -t doclet ${(kv)opt_args[(i)-classpath]}' \ '-docletpath[specify a path to search doclet]:doclet path:->docletpath' \ - '-1.1[Javadoc 1.1 compatible output]' \ '-sourcepath[specify path for source files]:source path:->sourcepath' \ - '-classpath[specify path for user class files]:class path:->classpath' \ + {-cp,-classpath}'[specify path for user class files]:class path:->classpath' \ + '-exclude[specify a list of packages to exclude]:package list' \ + '-subpackages[specify subpackages to recursively load]:subpackage list' \ + '-breakiterator[compute first sentence with BreakIterator]' \ '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ + '-source[provide source compatibility with specified release]:release' \ '-extdirs[specify directories for extensions]:extensions directories:->extdirs' \ '-verbose[print verbose messages]' \ '-locale[specify locale]:language_country_variant:' \ '-encoding[specify character encoding for source files]:encoding:->encoding' \ + "-quiet[don't display status messages]" \ '-J-[specify java option]:java option:' \ + '-X[print a synopsis of nonstandard options and exit]' \ '-d[specify destination directory]:destination directory:_files -/' \ '-use[display pages for use]' \ '-version[include @version text]' \ @@ -111,15 +123,27 @@ javadoc) '-bottom[specify bottom text]:bottom text:' \ '-link[generate a link to external reference classes]:document URL:' \ '-linkoffline[generate a link for external reference class names]:document URL::package list URL:' \ + '-excludedocfilessubdir[exclude any doc-files subdirectories with given name]:name:_directories' \ '-group[generate tables for each group]:group heading::package patterns:' \ - '-nodeprecated[do not document deprecated API]' \ - '-nodeprecatedlist[do not generate deprecated API list]' \ - '-notree[do not generate class and interface hierarchy]' \ - '-noindex[do not generate index]' \ - '-nohelp[do not generate help link]' \ - '-nonavbar[do not generate navigation bar]' \ + "-nodeprecated[don't include @deprecated information]" \ + '-noqualifier[exclude the list of qualifiers from the output]:qualifier list' \ + "-nosince[don't include @since information]" \ + "-notimestamp[don't include hidden time stamp]" \ + "-nodeprecatedlist[don't generate deprecated API list]" \ + "-notree[don't generate class and interface hierarchy]" \ + "-noindex[don't generate index]" \ + "-nohelp[don't generate help link]" \ + "-nonavbar[don't generate navigation bar]" \ + '-serialwarn[generate warning about @serial tag]' \ + '*-tag[specify single argument custom tag]:tag' \ + '-taglet[specify fully qualified name of Taglet to register]:taglet' \ + '-tagletpath[specify path to Taglets]:path:_directories' \ + '-charset[specify charset of generated documentation]:charset:->encoding' \ '-helpfile[specify alternative help link]:helpfile path/filename:' \ - '-stylesheet[specify alternative HTML style sheet]:stylesheet path/filename:' \ + '-linksource[generate source in HTML]' \ + '-sourcetab[specify the number of spaces each tab takes up in the source]:spaces' \ + '-keywords[include HTML meta tags with package, class and member info]' \ + '-stylesheetfile[specify alternative HTML style sheet]:stylesheet path/filename:_directories' \ '-docencoding[specify character encoding for output HTML files]:encoding:->encoding' \ '*:package name, source file or @list:->docsrc' && ret=0 ;; @@ -143,9 +167,11 @@ jar) 'f[specify archive file]' \ 'v[verbose mode]' \ '(e)m[specify manifest file]' \ + 'n[perform Pack200 normalization after creating a new archive]' \ '(m)e[specify class of for application entry point]' \ '0[store only without using ZIP compression]' \ - 'M[do not create manifest file]' \ + "M[don't create manifest file]" \ + "P[preserve leading / and .. components on file names]" \ 'i[generate index information for specified jar files]' && return else jar_cmd="${words[2]#-}" @@ -171,7 +197,7 @@ javah|javah_g) '-help[print help message]' \ '-version[print version]' \ '-jni[JNI-style native method function prototypes]' \ - '-classpath[specify path for user class files]:class path:->classpath' \ + {-cp,-classpath}'[specify path for user class files]:class path:->classpath' \ '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ '-old[generate old JDK1.0-style header files]' \ '-force[force output]' \ @@ -182,17 +208,19 @@ javah|javah_g) javap) _arguments -C \ '-help[print help message]' \ + '-version[print version information]' \ + {-v,-verbose}'[print additional information]' \ '-l[line and local variable tables]' \ - '-b[backward compatible to JDK1.1]' \ - '-public[only public classes and members]' \ - '-protected[only protected and public classes and members]' \ - '-package[only package, protected and public classes and members (default)]' \ - '-private[all classes and members]' \ + '(-protected -package -p -private)-public[show only public classes and members]' \ + '(-public -package -p -private)-protected[show only protected/public classes and members]' \ + '(-public -protected -p -private)-package[show only package/protected/public classes and members (default)]' \ + '(-public -package -protected -p -private)'{-p,-private}'[show all classes and members]' \ '-J-[specify java option]:java option:' \ - '-s[internal type signatures]' \ '-c[disassemble code]' \ - '-verbose[stack size, number of locals and args for methods]' \ - '-classpath[specify path for user class files]:class path:->classpath' \ + '-s[print internal type signatures]' \ + '-sysinfo[show system info (path, size, date, MD5 hash) of class being processed]' \ + '-constants[show final constants]' \ + {-cp,-classpath}'[specify path for user class files]:class path:->classpath' \ '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ '-extdirs[specify directories for extensions]:extensions directories:->extdirs' \ '*:class:_java_class ${(kv)opt_args[(i)-classpath]}' && return 0 diff --git a/Completion/Unix/Command/_joe b/Completion/Unix/Command/_joe index 592c34a10..74b0bf1a3 100644 --- a/Completion/Unix/Command/_joe +++ b/Completion/Unix/Command/_joe @@ -36,4 +36,4 @@ _arguments \ '-linums[display line numbers before each line]' \ '-rdonly[make file read-only]' \ '-keymap[use an alternate section of joerc for keybindings]:keymap name' \ - '*:files:_files' + '*:file:_files' diff --git a/Completion/Unix/Command/_killall b/Completion/Unix/Command/_killall index 36accb2e0..3ddd36341 100644 --- a/Completion/Unix/Command/_killall +++ b/Completion/Unix/Command/_killall @@ -38,15 +38,9 @@ if _pick_variant psmisc=PSmisc unix --version; then case $state in (time) - local -a units=( 's:seconds' 'm:minutes' 'h:hours' 'd:days' - 'w:weeks' 'M:months' 'y:years' ) - if compset -P '[0-9]##(|.[0-9]#)'; then - _alternative 'float-numbers:: _message "float number"' \ - 'units:: _describe unit units' && ret=0 - else - _message 'float number and unit' && ret=0 - fi - ;; + _numbers -fN age 's:seconds' 'm:minutes' 'h:hours' 'd:days' \ + 'w:weeks' 'M:months' 'y:years' + ;; esac return ret diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less index cb71314a6..69f75fd0e 100644 --- a/Completion/Unix/Command/_less +++ b/Completion/Unix/Command/_less @@ -1,7 +1,7 @@ #compdef less -value-,LESS,-default- -value-,LESSCHARSET,-default- -local curcontext="$curcontext" state line expl ret=1 -local -a files +local curcontext="$curcontext" fgbg=foreground ret=1 +local -a state line expl files basic suf case $service in *LESSCHARSET*) @@ -37,15 +37,15 @@ _arguments -S -s -A "[-+]*" \ '(-b --buffers)'{-b+,--buffers=}'[specify amount of buffer space used for each file]:buffer space (kilobytes)' \ '(-B --auto-buffers)'{-B,--auto-buffers}"[don't automatically allocate buffers for pipes]" \ '(-C --CLEAR-SCREEN -c --clear-screen)'{-c,--clear-screen}'[repaint screen instead of scrolling]' \ - '(-c --clear-screen -C --CLEAR-SCREEN)'{-C,--CLEAR-SCREEN}'[clear screen before repaints]' \ + '!(-c --clear-screen)'{-C,--CLEAR-SCREEN} \ '(-d --dumb)'{-d,--dumb}'[suppress error message if terminal is dumb]' \ + '*'{-D+,--color=}'[set screen colors]: :->colors' \ '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-e,--quit-at-eof}'[exit the second time end-of-file is reached]' \ '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-E,--QUIT-AT-EOF}'[exit when end-of-file is reached]' \ '(-f --force)'{-f,--force}'[force opening of non-regular files]' \ '(-F --quit-if-one-screen)'{-F,--quit-if-one-screen}'[exit if entire file fits on first screen]' \ '(-G --HILITE-SEARCH -g --hilite-search)'{-g,--hilite-search}'[highlight only one match for searches]' \ '(-g --hilite-search -G --HILITE-SEARCH)'{-G,--HILITE-SEARCH}'[disable highlighting of search matches]' \ - '--old-bot[revert to the old bottom of screen behavior]' \ '(-h --max-back-scroll)'{-h+,--max-back-scroll=}'[specify backward scroll limit]:backward scroll limit (lines)' \ '(-I --IGNORE-CASE -i --ignore-case)'{-i,--ignore-case}'[ignore case in searches that lack uppercase]' \ '(-i --ignore-case -I --IGNORE-CASE)'{-I,--IGNORE-CASE}'[ignore case in all searches]' \ @@ -80,21 +80,52 @@ _arguments -S -s -A "[-+]*" \ '--no-keypad[disable use of keypad terminal init string]' \ '(-y --max-forw-scroll)'{-y,--max-forw-scroll}'[specify forward scroll limit]' \ '(-z --window)'{-z+,--window=}'[specify scrolling window size]:lines' \ - '(-\" --quotes)'{-\"+,--quotes=}'[change quoting character]:quoting characters' \ + '(-\" --quotes)'{'-\"+',--quotes=}'[change quoting character]:quoting characters' \ '(-~ --tilde)'{-~,--tilde}"[don't display tildes after end of file]" \ - '(-\# --shift)'{-\#+,--shift=}"[specify amount to move when scrolling horizontally]:number" \ + '(-\# --shift)'{'-\#+',--shift=}"[specify amount to move when scrolling horizontally]:number" \ + '--file-size[automatically determine the size of the input file]' \ + '--incsearch[search file as each pattern character is typed in]' \ + '--line-num-width=[set the width of line number field]:width [7]' \ '--follow-name[the F command changes file if the input file is renamed]' \ '--mouse[enable mouse input]' \ '--no-histdups[remove duplicates from command history]' \ '--rscroll=[set the character used to mark truncated lines]:character [>]' \ '--save-marks[retain marks across invocations of less]' \ + '--status-col-width=[set the width of the -J status column]:width [2]' \ '--use-backslash[subsequent options use backslash as escape char]' \ + '--use-color[enable colored text]' \ '--wheel-lines=[specify lines to move for each click of the mouse wheel]:lines' \ "$files[@]" && ret=0 if [[ -n "$state" ]]; then case $state in + colors) + if compset -P 1 \?; then + [[ $IPREFIX[-1] != [a-z] ]] || compset -P 1 + || _describe 'color application' '( +:add\ to\ existing\ attribute )' + suf=( -S '' ) + compset -P 1 '([-a-zA-Z]|*.)' && fgbg=background && suf=() + basic=( B:blue C:cyan G:green K:black M:magenta R:red W:white Y:yellow ) + _describe -t colors "$fgbg color" \ + "( -:default ${(j. .)${(@)basic/:/:light\ }} ${(Lj. .)basic} )" "$suf[@]" && ret=0 + else + _describe 'text' '( + B:binary\ characters + C:control\ characters + E:errors\ and\ informational\ messages + M:mark\ letters\ in\ the\ status\ column + N:line\ numbers\ enabled\ via\ the\ -N\ option + P:prompts + R:the\ rscroll\ character + S:search\ results + W:the\ highlight\ enabled\ via\ the\ -w\ option + d:bold\ text + k:blinking\ text + s:standout\ text + u:underlined\ text + )' -S '' && ret=0 + fi + ;; prompts) if compset -p 1; then _message -e prompt diff --git a/Completion/Unix/Command/_lldb b/Completion/Unix/Command/_lldb index 0426f69f2..eae8e1d3a 100644 --- a/Completion/Unix/Command/_lldb +++ b/Completion/Unix/Command/_lldb @@ -6,12 +6,12 @@ typeset -a opts args [[ $EUID = 0 || $_comp_priv_prefix[1] = sudo ]] && opts=( -a ) args=( - '*'{-o+,--one-line=}'[run one-line lldb command after loading executable]:lldb command: ' - '*'{-s+,--source=}'[run lldb commands from a file after loading executable]:file:_files' - '*'{-O+,--one-line-before-file=}'[run one-line lldb command before loading executable]:lldb command' - '*'{-S+,--source-before-file=}'[run lldb commands from a file before loading executable]:file:_files' - '(-k --one-line-on-crash)'{-k+,--one-line-on-crash=}'[run one-line lldb command if target crashes in batch mode]:lldb command' - '(-K --source-on-crash)'{-K+,--source-on-crash=}'[run lldb commands from a file if target crashes in batch mode]:file:_files' + '*'{-o+,--one-line}'[run one-line lldb command after loading executable]:lldb command: ' + '*'{-s+,--source}'[run lldb commands from a file after loading executable]:file:_files' + '*'{-O+,--one-line-before-file}'[run one-line lldb command before loading executable]:lldb command' + '*'{-S+,--source-before-file}'[run lldb commands from a file before loading executable]:file:_files' + '(-k --one-line-on-crash)'{-k+,--one-line-on-crash}'[run one-line lldb command if target crashes in batch mode]:lldb command' + '(-K --source-on-crash)'{-K+,--source-on-crash}'[run lldb commands from a file if target crashes in batch mode]:file:_files' '(-b --batch)'{-b,--batch}'[run commands from -s -S -o -O and quit]' '(-Q --source-quietly)'{-Q,--source-quietly}'[suppress output from -s, -S, -o or -O]' '(-e --editor)'{-e,--editor}'[open source files using "external editor" mechanism]' @@ -19,21 +19,21 @@ args=( '(-X --no-use-colors)'{-X,--no-use-colors}'[do not use colors]' '(-d --debug)'{-d,--debug}'[print extra information for debugging itself]' '(-r --repl)'{-r,--repl}'[run lldb in REPL mode]' - '(-l --script-language)'{-l+,--script-language=}'[use the specified scripting language]:language:(Python Perl Ruby Tcl)' + '(-l --script-language)'{-l+,--script-language}'[use the specified scripting language]:language:(Python Perl Ruby Tcl)' - info '(-)'{-h,--help}'[print the usage information]' '(-)'{-v,--version}'[print the current version number]' '(-)'{-P,--python-path}'[print path to the lldb.py file]' - file - '(-f --file)'{-f+,--file=}'[specify executable file to debug]:executable:_files -g "*(-*)"' - '(-a --arch)'{-a+,--arch=}'[use the specified architecture]:arch' - '(-c --core)'{-c+,--core=}'[specify core file to open]:core file:_files -g "*core*(-.)"' + '(-f --file)'{-f+,--file}'[specify executable file to debug]:executable:_files -g "*(-*)"' + '(-a --arch)'{-a+,--arch}'[use the specified architecture]:arch' + '(-c --core)'{-c+,--core}'[specify core file to open]:core file:_files -g "*core*(-.)"' '*::executable and arguments:->exe_args' - name - '(-n --attach-name)'{-n+,--attach-name=}"[attach to the named process]: :_process_names $opts" + '(-n --attach-name)'{-n+,--attach-name}"[attach to the named process]: :_process_names $opts" '(-w --wait-for)'{-w,--wait-for}'[wait for the specified process to launch]' - pid - '(-p --attach-pid)'{-p+,--attach-pid=}'[attach to the specified process]:pid:_pids' + '(-p --attach-pid)'{-p+,--attach-pid}'[attach to the specified process]:pid:_pids' ) _arguments -C -s -S : $args && return 0 diff --git a/Completion/Unix/Command/_locale b/Completion/Unix/Command/_locale index a7fd88f65..b2ee14ee0 100644 --- a/Completion/Unix/Command/_locale +++ b/Completion/Unix/Command/_locale @@ -28,6 +28,7 @@ elif [[ $OSTYPE == openbsd* ]]; then specs=( '(-m)-a[list all available locales]' '(-a)-m[list all available charmaps]' + '(-a -m)1:name:(charmap)' ) else diff --git a/Completion/Unix/Command/_locate b/Completion/Unix/Command/_locate index 23305f798..af07473b3 100644 --- a/Completion/Unix/Command/_locate +++ b/Completion/Unix/Command/_locate @@ -44,7 +44,7 @@ case $variant in -u'[create slocate database starting at path /]' -U'[create slocate database starting at given path]:directory:_files -/' -c'[parse GNU locate updatedb with -u, -U]' - -e'[exclude directories with -u, -U]:directories:_files -/' + -e'[exclude directories with -u, -U]: : _dir_list -s,' -f'[exclude file system types from db with -u, -U]:file system:_file_systems' -l'[security level]:level:(0 1)' -q'[quiet mode]' diff --git a/Completion/Unix/Command/_logger b/Completion/Unix/Command/_logger new file mode 100644 index 000000000..0d47d2f03 --- /dev/null +++ b/Completion/Unix/Command/_logger @@ -0,0 +1,80 @@ +#compdef logger + +local variant ign +local -a args common +local -a priorities + +_pick_variant -r variant linux=util-linux busybox=BusyBox $OSTYPE -V + +priorities=( {kern,user,mail,daemon,auth,syslog,lpr,news,uucp,cron,authpriv,ftp,ntp,security,console,local{0..7}}.{emerg,panic,alert,crit,err,error,warn,warning,notice,info,debug} ) +args=( "(--id)-i[log the logger command's pid]" ) +common=( + '(-f --file --journald *)'{-f+,--file=}'[log contents of specified file]:file:_files' + '(-s --stderr)'{-s,--stderr}'[output message to standard error as well]' + '(-P --port)'{-P+,--port}'[use specified port for UDP or TCP connection]:port [514]:_ports' + '(-p --priority)'{-p+,--priority}'[mark message with specified priority]:priority:_multi_parts . priorities' + '(-t --tag)'{-t+,--tag}"[specify tag to mark log line with]:tag [$USER]" +) + +case $variant in + (net|open)bsd*) + args+=( ${(M)common:#*\)-[fpst]*} + '-c[write the message to the console if unable to use syslogd(8)]' + ) + ;| + dragonfly*|freebsd*) + args+=( + '(-6)-4[use IPv4 addresses only]' + '(-4)-6[use IPv6 addresses only]' + '-A[send the message to all addresses]' + ) + ;| + darwin*|dragonfly*) args+=( ${(M)common:#*\)-[sfpt]*} ) ;| + freebsd*) + args+=( ${common:#*\)--*} + "-H+[set value for hostname in message header]:hostname [${HOST%%.*}]" + '-h+[write to specified remote syslog server or socket]: : _alternative + "hosts\:server\:_hosts" + "sockets\:socket\:_files -g \*\(=\)"' + '-S+[specify source address and port when using -h]: :_bind_addresses -0bh' + ) + ;; + dragonfly*) + args+=( '-h+[write to specified remote syslog server]:server:_hosts' ) + ;; + busybox) args=( ${(M)common:#*\)-[spt]*} ) ;; # no -i + solaris*) args+=( ${(M)common:#*\)-[fpt]*} ) ;; + netbsd*) + args+=( + '-d+[log this in the structured data (SD) field]:sd field' + '-m+[specify message ID used for the message]:message id' + '-n[open log file immediately]' + ) + ;; + linux) + (( $#words > 2 )) && ign='!' + args+=( $common + "(-i)--id=-[log the given id, or otherwise the pid]::id [$$]:_pids" + '(* -e --skip-empty)'{-e,--skip-empty}"[don't log empty lines when processing files]" + '--no-act[do everything except the write the log]' + '--octet-count[use rfc6587 octet counting]' + '(*)--prio-prefix[look for a prefix on every line read from stdin]' + '(-S --size)'{-S+,--size=}'[specify maximum size for a single message]:size [1KiB]' + '(-n --server)'{-n+,--server=}'[write to specified remote syslog server]:server:_hosts' + '(-T --tcp -d --udp)'{-T,--tcp}'[use TCP only]' + '(-d --udp -T --tcp)'{-d,--udp}'[use UDP only]' + '(--rfc5424 --msgid --sd-id --sd-param)--rfc3164[use the obsolete BSD syslog protocol]' + '(--rfc3164)--rfc5424=-[use the syslog protocol (default for remote)]::without:_sequence compadd - notime notq nohost' + '(--rfc3164)*--sd-id=[specify rfc5424 structured data ID]:id' + '(--rfc3164)*--sd-param=[specify rfc5424 structured data name=value]:data' + '(--rfc3164)--msgid=[set rfc5424 message id field]:message id' + '(-u --socket)'{-u,--socket=}'[write to specified Unix socket]:socket:compadd -f -M "r\:|_=* r\:|=*" ${${(M)${(f)"$(</proc/net/unix)"}\:#* /*}##* }' + '--socket-errors=-[print connection errors when using Unix sockets]::state:(on off auto)' + '(* -f --file)--journald=-[write journald entry]::file:_files' + "${ign}(- *)"{-h,--help}'[display usage information]' + "${ign}(- *)"{-V,--version}'[display version information]' + ) + ;; +esac + +_arguments -s -S -A "-*" $args '*: :_guard "^-*" message' diff --git a/Completion/Unix/Command/_lp b/Completion/Unix/Command/_lp index e84d9ad04..ad7e97203 100644 --- a/Completion/Unix/Command/_lp +++ b/Completion/Unix/Command/_lp @@ -58,6 +58,9 @@ _lp_job_options() '6:rotated 180 degrees') _describe "orientation requested" desc_opts ;; + (job-sheets(|-*)) + compadd "$@" /usr/share/cups/banners/*(:t) + ;; (sides) compadd "$@" one-sided two-sided-{long,short}-edge ;; @@ -80,7 +83,7 @@ _lp_job_options() "DuplexTumble:flip short side" "DuplexNoTumble:flip long side" "None") - _describe "duplex options" desc_opts + _describe "duplex option" desc_opts ;; (*) @@ -100,11 +103,11 @@ _lp_job_options() eq_suffix=(-S '=') fi - _description lpopts expl "generic printer options" + _description lpopts expl "generic printer option" compadd "$expl[@]" $eq_suffix $lopts_with_args compadd "$expl[@]" $lopts_no_args - _description printeropts expl "printer specific options" + _description printeropts expl "printer specific option" compadd "$expl[@]" $eq_suffix \ $(_call_program list-printer-options \ lpoptions $printer -l | cut -d/ -f1) @@ -163,128 +166,128 @@ _lp() case $service in (lpq) _arguments \ - '-E[Force encryption]' \ + '-E[force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ - '(-a)-P+[Destination printer]:printers:_printers' \ - '(-P)-a[All printers]' \ - '-l[Long listing]' \ - '*:poll interval (+seconds):' + '(-a)-P+[destination printer]:printer:_printers' \ + '(-P)-a[all printers]' \ + '-l[long listing]' \ + '*:poll interval (+seconds)' ;; (lprm) _arguments \ - '-E[Force encryption]' \ + '-E[force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ - '-P+[Destination printer]:printers:_printers' \ - '*:job ids:_lp_list_jobs' + '-P+[destination printer]:printer:_printers' \ + '*:job id:_lp_list_jobs' ;; (lpoptions) _arguments \ - '-E[Force encryption]' \ + '-E[force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ - '(-p -l -r -x)-d+[Set default printer]:printers:_printers' \ - '(-l -x)*-o:job options:_lp_job_options' \ - '(-d -x)-p+[Destination printer for options]:printers:_printers' \ - '(-d -o -r -x)-l[List options]' \ + '(-p -l -r -x)-d+[set default printer]:printer:_printers' \ + '(-l -x)*-o:job option:_lp_job_options' \ + '(-d -x)-p+[destination printer for options]:printer:_printers' \ + '(-d -o -r -x)-l[list options]' \ '(-d -l -x)*-r:remove option:_lp_job_options' \ - '(-d -l -r -o)-x+[Remove all options]:printers:_printers' + '(-d -l -r -o)-x+[remove all options]:printer:_printers' ;; (lpstat) _arguments \ - '-E[Force encryption]' \ - '-R[Shows print job ranking]' \ + '-E[force encryption]' \ + '-R[shows print job ranking]' \ '-U:username (for connection to server):_users' \ - '-W:which jobs:(completed not-completed)' \ - '-a+[Show accepting state]:printers:_printers' \ - '-c:printer classes:' \ - '-d[Show current default destination]' \ + '-W:which job:(completed not-completed)' \ + '-a+[show accepting state]:printer:_printers' \ + '-c:printer class' \ + '-d[show current default destination]' \ '-h:hostname (alternate server):_hosts' \ - '-l[Long listing]' \ - '-o+[Destinations]:printers:_printers' \ - '-p+:printers:_printers' \ + '-l[long listing]' \ + '-o+[destinations]:printer:_printers' \ + '-p+:printer:_printers' \ '-r[CUPS server running status]' \ - '-s[Status summary]' \ - '-t[All status info]' \ - '-u[List jobs by users]:users:_users' \ - '-v+[Show devices]:printers:_printers' + '-s[status summary]' \ + '-t[all status info]' \ + '-u[list jobs by users]:user:_users' \ + '-v+[show devices]:printer:_printers' ;; (lpr) _arguments \ - '-E[Force encryption]' \ + '-E[force encryption]' \ '-H:hostname (alternate server):_hosts' \ - '(-C -J -T)'-{C,J,T}':job name:' \ - '-P+[Destination printer]:printers:_printers' \ + '(-C -J -T)'-{C,J,T}':job name' \ + '-P+[destination printer]:printer:_printers' \ '-U:username (for connection to server):_users' \ - '-#[Copies]:copies (1--100):' \ - '-h[Disables banner printing]' \ - '-l[Raw file]' \ - '-m[Send an email on job completion]' \ - '*-o:print job options:_lp_job_options' \ - '-p[Format with shaded header incl. date, time etc.]' \ - '-q[Hold job for printing.]' \ - '-r[Delete files after printing]' \ - '*:PS/PDF files:_pspdf' + '-#[copies]:copies (1--100)' \ + '-h[disables banner printing]' \ + '-l[raw file]' \ + '-m[send an email on job completion]' \ + '*-o:print job option:_lp_job_options' \ + '-p[format with shaded header incl. date, time etc.]' \ + '-q[hold job for printing]' \ + '-r[delete files after printing]' \ + '*:PS/PDF file:_pspdf' ;; (lp) _arguments \ - '-E[Force encryption]' \ - '-U[Username (for connection to server)]:username:_users' \ + '-E[force encryption]' \ + '-U[username (for connection to server)]:username:_users' \ '-c[(OBSOLETE) copy to spool dir before printing]' \ - '-d+[Destination printer]:printers:_printers' \ + '-d+[destination printer]:printer:_printers' \ '-h:hostname (alternate server):_hosts' \ - '-i[Job id to modify]:job id:' \ - '-m[Send an email on job completion]' \ - '-n[Copies]:copies (1--100):' \ - '*-o:print job options:_lp_job_options' \ - '-q[Job priority -- 1 (lowest) to 100 (highest)]:priority:' \ - "-s[Don't report resulting job IDs]" \ - '-t[Sets the job name]:job name:' \ - '-u[Job submission username]:username:_users' \ - '-H[Time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \ - '-P:page range list:' \ - '*:PS/PDF files:_pspdf' + '-i[job id to modify]:job id' \ + '-m[send an email on job completion]' \ + '-n[copies]:copies (1--100)' \ + '*-o:print job option:_lp_job_options' \ + '-q[job priority -- 1 (lowest) to 100 (highest)]:priority' \ + "-s[don't report resulting job IDs]" \ + '-t[set the job name]:job name' \ + '-u[job submission username]:username:_users' \ + '-H[time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \ + '-P:page range list' \ + '*:PS/PDF file:_pspdf' ;; (lpinfo) _arguments \ - '-E[Force encryption]' \ - '-U[Username (for connection to server)]:username:_users' \ + '-E[force encryption]' \ + '-U[username (for connection to server)]:username:_users' \ '-h:hostname (alternate server):_hosts' \ - '-l[Shows a "long" listing of devices or drivers]' \ - {--exclude-schemes,--include-schemes}'[Device/PPD schemes to filter from results]:scheme-list:' \ - '(-v --timeout)--device-id[IEEE-1284 device ID to match]:device-id-string:' \ - '(-v --timeout)--language:locale:' \ - '(-v --timeout)--product[Product to match]:name:' \ - '(-v --timeout)--make-and-model[Make and model to match]:name:' \ - '(-v --timeout)-m[List available drivers]' \ - '(-m --device-id --language --make-and-model --product)--timeout[Timeout when listing devices with -v]:timeout (seconds):' \ - '(-m --device-id --language --make-and-model --product)-v[List available devices]' + '-l[show a "long" listing of devices or drivers]' \ + {--exclude-schemes,--include-schemes}'[device/PPD schemes to filter from results]:scheme-list' \ + '(-v --timeout)--device-id[IEEE-1284 device ID to match]:device-id-string' \ + '(-v --timeout)--language:locale' \ + '(-v --timeout)--product[product to match]:name' \ + '(-v --timeout)--make-and-model[make and model to match]:name' \ + '(-v --timeout)-m[list available drivers]' \ + '(-m --device-id --language --make-and-model --product)--timeout[timeout when listing devices with -v]:timeout (seconds)' \ + '(-m --device-id --language --make-and-model --product)-v[list available devices]' ;; (lpadmin) _arguments \ - '-E[Force encryption/Enable destination]' \ - '-U[Username (for connection to server)]:username:_users' \ + '-E[force encryption/enable destination]' \ + '-U[username (for connection to server)]:username:_users' \ '-h:hostname (alternate server):_hosts' \ - '(-p -R -x -o)-d+[Default printer]:printers:_printers' \ - '(-d -x)-p+[Configure printer]:printers:_printers' \ - '(-p -R -d -o)-x+[Delete printer]:printers:_printers' \ - '(-x -d)-R[Name-default]:name-default:' \ - '-c:printer classes:' \ - '-m:model:' \ - '(-x -d)*-o:options:_lp_job_options' \ - '-r[Remove from class]:class:' \ - '-u[Access policy]:access policy:' \ - '-v[Device-uri of printer queue]:device-uri:' \ - '-D[Text description of destination]:info:' \ - '-L[Location of the printer]:location:' \ + '(-p -R -x -o)-d+[default printer]:printer:_printers' \ + '(-d -x)-p+[configure printer]:printer:_printers' \ + '(-p -R -d -o)-x+[delete printer]:printer:_printers' \ + '(-x -d)-R[name-default]:name-default' \ + '-c:printer class' \ + '-m:model' \ + '(-x -d)*-o:option:_lp_job_options' \ + '-r[remove from class]:class' \ + '-u[access policy]:access policy' \ + '-v[device-uri of printer queue]:device-uri' \ + '-D[text description of destination]:info' \ + '-L[location of the printer]:location' \ '-P[PPD file to use]:PPD file:_files "*.(#i)ppd(-.)"' esac } diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls index 1fd9383f5..df14e7e2c 100644 --- a/Completion/Unix/Command/_ls +++ b/Completion/Unix/Command/_ls @@ -196,7 +196,7 @@ else '(-q --hide-control-chars)--show-control-chars' '(- :)--help[display help information]' '(- :)--version[display version information]' - '*:files:_files' + '*:file:_files' ) if [[ $OSTYPE = linux* ]]; then arguments+=( diff --git a/Completion/Unix/Command/_lsof b/Completion/Unix/Command/_lsof index 754012e3b..8afb55e1d 100644 --- a/Completion/Unix/Command/_lsof +++ b/Completion/Unix/Command/_lsof @@ -34,7 +34,7 @@ _arguments -C -s -S $args \ '-f[inhibit listing of kernel file structure info]::info type:->file-structures' \ '+f[enable listing of kernel file structure info]::info type:->file-structures' \ '-F[select output fields]:fields:->fields' \ - '-g[select by process group id]::process group id' \ + '-g[select by process group id]::process group id:_sequence -s , _pgids' \ '(*)*-i[select internet files]::address:->addresses' \ '-K+[select listing of tasks of processes]::value:((i\:ignore\ tasks))' \ '-k[specify kernel name list file]:kernel file:_files' \ diff --git a/Completion/Unix/Command/_luarocks b/Completion/Unix/Command/_luarocks index 0915765dc..42169c22a 100644 --- a/Completion/Unix/Command/_luarocks +++ b/Completion/Unix/Command/_luarocks @@ -34,8 +34,8 @@ local option_deps_modes='--deps-mode=[specify how to handle dependencies]:mode:_ 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"}' + '--summary=[a short one-line description summary]:summary' + '--detailed=[a longer description string]:detailed description' '--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: ' @@ -321,7 +321,7 @@ __luarocks_rock(){ continue ;; (rockpack) - alts+=(':rock file:{_files -g "*.src.rock(-.)"}') + alts+=( ':rock file:_files -g "*.src.rock(-.)"' ) shift 1 continue ;; @@ -332,7 +332,7 @@ __luarocks_rock(){ ;; (installed) tree="$2" - alts+=(":local rock:{__luarocks_installed_rocks ${tree}}") + alts+=(":local rock: __luarocks_installed_rocks ${tree}") if [[ -z "${tree}" ]]; then shift else @@ -364,7 +364,7 @@ __luarocks_git_tags(){ local make_command_options=( '--pack-binary-rock[produce a .rock file with the contents of compilation inside the current directory instead of installing it]' '--keep[do not remove previously installed versions of the rock after building a new one]' - '--branch=[override the `source.branch` field in the loaded rockspec]:NAME:{_message "branch name"}' + '--branch=[override the `source.branch` field in the loaded rockspec]:branch name' ) local build_command_options=( "${make_command_options[@]}" @@ -375,8 +375,8 @@ local build_command_options=( _luarocks_build(){ _arguments -A "-*" \ "${build_command_options[@]}" \ - '1: :{__luarocks_rock "rockspec" "external"}' \ - '2:: :{__luarocks_rock_version "external_or_local"}' + '1: : __luarocks_rock "rockspec" "external"' \ + '2:: : __luarocks_rock_version "external_or_local"' } # arguments: # - must: option @@ -402,7 +402,7 @@ local doc_command_options=( _luarocks_doc(){ _arguments \ "${doc_command_options[@]}" \ - "1: :{__luarocks_rock installed ${opt_args[--tree]}}" + "1: : __luarocks_rock installed ${opt_args[--tree]}" } # arguments: # - must: external only rockspec @@ -416,14 +416,14 @@ local download_command_options=( _luarocks_download(){ _arguments -A "-*" \ "${download_command_options[@]}" \ - '1: :{__luarocks_rock "external"}' \ - '2:: :{__luarocks_rock_version "external_or_local"}' + '1: : __luarocks_rock "external"' \ + '2:: : __luarocks_rock_version "external_or_local"' } # arguments: # must: luarocks sub command (( $+functions[_luarocks_help] )) || _luarocks_help(){ - _arguments '1: :__luarocks_command' + _arguments '1: : __luarocks_command' } (( $+functions[_luarocks_init] )) || @@ -446,7 +446,7 @@ _luarocks_install(){ # - must: rockspec file (first and last) (( $+functions[_luarocks_lint] )) || _luarocks_lint(){ - _arguments '1:: :{__luarocks_rock "rockspec"}' + _arguments '1:: : __luarocks_rock "rockspec"' } # arguments: # NOTE: receives only options @@ -463,7 +463,7 @@ _luarocks_list(){ # NOTE: it's options were already described above. (( $+functions[_luarocks_make] )) || _luarocks_make(){ - _arguments '1:: :{__luarocks_rock "rockspec"}' + _arguments '1:: : __luarocks_rock "rockspec"' } # arguments: # - optional: .rockspec file / external rock @@ -476,8 +476,8 @@ local new_version_command_options=( _luarocks_new_version(){ _arguments -A "-*" \ "${new_version_command_options[@]}" \ - '1:: :{__luarocks_rock "external" "rockspec"}' \ - '2:: :{__luarocks_rock_version "external_or_local"}' \ + '1:: : __luarocks_rock "external" "rockspec"' \ + '2:: : __luarocks_rock_version "external_or_local"' \ '3:: :_urls' } # arguments: @@ -524,8 +524,8 @@ local remove_command_options=( _luarocks_remove(){ _arguments -A "-*" \ "${remove_command_options[@]}" \ - "1: :{__luarocks_rock installed ${opt_args[--tree]}}" \ - "2:: :{__luarocks_rock_version installed ${opt_args[--tree]}}" + "1: : __luarocks_rock installed ${opt_args[--tree]}" \ + "2:: : __luarocks_rock_version installed ${opt_args[--tree]}" } # arguments: # - must: string as a search query @@ -558,8 +558,8 @@ local show_command_options=( _luarocks_show(){ _arguments \ "${show_command_options[@]}" \ - "1: :{__luarocks_rock installed "${opt_args[--tree]}"}" \ - "2:: :{__luarocks_rock_version installed ${opt_args[--tree]}}" + "1: : __luarocks_rock installed "${opt_args[--tree]}"" \ + "2:: : __luarocks_rock_version installed ${opt_args[--tree]}" } (( $+functions[_luarocks_test] )) || @@ -567,7 +567,7 @@ _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' \ + '1: : __luarocks_rock' \ '*:arg' } @@ -581,7 +581,7 @@ local unpack_command_options=( _luarocks_unpack(){ _arguments \ "${unpack_command_options[@]}" \ - '1: :{__luarocks_rock "rockpack" "external"}' + '1: : __luarocks_rock "rockpack" "external"' } # arguments: # - must: rockspec file @@ -595,7 +595,7 @@ local upload_command_options=( _luarocks_upload(){ _arguments \ "${upload_command_options[@]}" \ - '1: :{__luarocks_rock "rockspec"}' + '1: : __luarocks_rock "rockspec"' } (( $+functions[_luarocks_which] )) || @@ -609,8 +609,8 @@ _luarocks_write_rockspec(){ "${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"}' \ + '1::new rock name' \ + '2:: : __luarocks_rock_version "new_rock"' \ '3:: :_urls' } diff --git a/Completion/Unix/Command/_lz4 b/Completion/Unix/Command/_lz4 index 2697c4d11..6676943c4 100644 --- a/Completion/Unix/Command/_lz4 +++ b/Completion/Unix/Command/_lz4 @@ -42,8 +42,8 @@ args=( '(b t -k --keep)--rm[remove source file]' '!(b t -c --stdout)--to-stdout' + b # Benchmark-mode options - "(C c d t)-b-[benchmark file using specified compression level]::compression level:(${(j< >)levels//-/})" - "(C c d t)-e-[specify upper compression level limit (with -b)]:compression level:(${(j< >)levels//-/})" + "(C c d t)-b-[benchmark file using specified compression level]:: :->levels" + "(C c d t)-e-[specify upper compression level limit (with -b)]: :->levels" '(C c d t)-i-[specify minimum evaluation time (with -b)]:evaluation time (seconds)' + c # Compress-mode options "(b d t ${(j< >)levels} -c0 -c1 -c2 -hc)"${^levels} @@ -98,6 +98,11 @@ case $state in _message 'no more arguments' && ret=0 fi ;; + levels) + _wanted levels expl 'compression level' \ + compadd -o numeric - ${levels/#-/} \ + && ret=0 + ;; esac return ret diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make index 21ed56184..ae91440f0 100644 --- a/Completion/Unix/Command/_make +++ b/Completion/Unix/Command/_make @@ -204,7 +204,7 @@ _make() { ;; (debug) - _values -s , 'debug options' \ + _values -s , 'debug option' \ '(b v i j m)a[all debugging output]' \ 'b[basic debugging output]' \ '(b)v[one level above basic]' \ diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man index 7d55201e3..dba1d13dc 100644 --- a/Completion/Unix/Command/_man +++ b/Completion/Unix/Command/_man @@ -6,7 +6,6 @@ # - We assume that Linux distributions are using either man-db or mandoc # - @todo Would be nice to support completing the initial operand as a section # name (on non-Solaris systems) -# - @todo We don't support the man-db syntax <name>.<section> (e.g., `ls.1`) # - @todo We don't support the man-db feature of 'sub-pages' — that is, treating # pairs of operands like `git diff` as `git-diff` # - @todo Option exclusivity isn't super accurate @@ -415,7 +414,7 @@ _man() { } _man_pages() { - local pages sopt + local pages sopt tmp # What files corresponding to manual pages can end in. local suf='.((?|<->*|ntcl)(|.gz|.bz2|.z|.Z|.lzma))' @@ -444,13 +443,20 @@ _man_pages() { # `POSIX.1.5'. [[ $variant = solaris* ]] && sopt='-s ' - if ((CURRENT > 1 || noinsert)) || - ! zstyle -t ":completion:${curcontext}:manuals.$sect_dirname" insert-sections - then - compadd "$@" - ${pages%$~suf} - else - compadd "$@" -P "$sopt$sect_dirname " - ${pages%$~suf} + if ! ((CURRENT > 1 || noinsert)); then + zstyle -s ":completion:${curcontext}:manuals.$sect_dirname" insert-sections tmp fi + case "$tmp" in + prepend|true|on|yes|1) + compadd "$@" -P "$sopt$sect_dirname " - ${pages%$~suf} + ;; + suffix) + compadd "$@" -s ".$sect_dirname" - ${pages%$~suf} + ;; + *) + compadd "$@" - ${pages%$~suf} + ;; + esac } _man "$@" diff --git a/Completion/Unix/Command/_md5sum b/Completion/Unix/Command/_md5sum index 3dfcd6322..e0de826a7 100644 --- a/Completion/Unix/Command/_md5sum +++ b/Completion/Unix/Command/_md5sum @@ -45,6 +45,9 @@ args+=( '(sum -w --status --warn)'{-w,--warn}'[warn about each improperly formatted checksum line]' ) # Operands -args+=( '*: :_files' ) +args+=( + + operand + '*: :_files' +) _arguments -s -S : $args diff --git a/Completion/Unix/Command/_module b/Completion/Unix/Command/_module index 2a4dba740..23cf0c589 100644 --- a/Completion/Unix/Command/_module +++ b/Completion/Unix/Command/_module @@ -85,7 +85,7 @@ _module_available_modules() { if [[ -n $MODULEPATH ]] && [[ ${+_available_modules} -eq 0 ]] then - _available_modules=(${$(find -L ${(e)=MODULEPATH//:/ } -type f -print 2>/dev/null | grep -v \\.version | sed -e 's,\('${${(e)=MODULEPATH//:/\/\\\|}%\\\|}'\),,g' -e 's,^/*,,g'):#*\~}) + _available_modules=(${$(find -L ${(e)=MODULEPATH//:/ } -type f -print 2>/dev/null | grep -v \\.version | sed -e 's,\('${${(e)=MODULEPATH//:/\/\\\|}%\\\|}'\),,g' -e 's,^/*,,g' -e 's,\.lua$,,g'):#*\~}) fi } diff --git a/Completion/Unix/Command/_moosic b/Completion/Unix/Command/_moosic index 54d768c8c..475a0c75c 100644 --- a/Completion/Unix/Command/_moosic +++ b/Completion/Unix/Command/_moosic @@ -216,7 +216,7 @@ _moosic_cmd_version() { _moosic_song_files() { _arguments -A '-*' $main_opts $filelist_opts $auto_opts \ - '*:song files:_files' + '*:song file:_files' } _moosic_cmd_append() { @@ -282,7 +282,7 @@ _moosic_cmd_stagger-merge() { _moosic_cmd_interval-add() { _arguments -A '-*' $main_opts $filelist_opts \ '1:interval:' \ - '*:song files:_files' + '*:song file:_files' } ### REMOVING COMMANDS diff --git a/Completion/Unix/Command/_mtr b/Completion/Unix/Command/_mtr index 806e344d1..9a73cfbd4 100644 --- a/Completion/Unix/Command/_mtr +++ b/Completion/Unix/Command/_mtr @@ -4,6 +4,7 @@ _arguments -s -S \ '(H -F --filename)'{-F,--filename}'[read hostnames from a file]' \ '(H -6)-4[use IPv4 only]' \ '(H -4)-6[use IPv6 only]' \ + '(H -I --interface)'{-I+,--interface=}'[use named network interface]: :_net_interfaces' \ '(H -a --address)'{-a+,--address=}'[bind outgoing packets to specific interface]:source IP:_hosts' \ '(H -f --first-ttl)'{-f+,--first-ttl=}'[specify TTL to start]:TTL [1]' \ '(H -m --max-ttl)'{-m+,--max-ttl=}'[specify maximum number of hops to probe]:hops [30]' \ @@ -17,7 +18,6 @@ _arguments -s -S \ '(H -Q --tos)'{-Q+,--tos=}'[specify type of service for IP header]:tos (0-255)' \ '(H -e --mpls)'{-e,--mpls}'[display ICMP MPLS information]' \ '(H -Z --timeout)'{-Z+,--timeout=}'[specify how long to keep probe sockets open before giving up on the connection]:timeout (seconds)' \ - '(H -M --mark)'{-M+,--mark=}'[mark each sent packet]:mark' \ '(H -r --report)'{-r,--report}'[report mode]' \ '(H -w --report-wide)'{-w,--report-wide}"[wide report mode\: don't truncate hostnames]" \ '(H -c --report-cycles)'{-c+,--report-cycles=}'[report cycles]:number of pings' \ diff --git a/Completion/Unix/Command/_mysql_utils b/Completion/Unix/Command/_mysql_utils index f1ad97bcd..9f70687b0 100644 --- a/Completion/Unix/Command/_mysql_utils +++ b/Completion/Unix/Command/_mysql_utils @@ -187,7 +187,7 @@ _mysqladmin() { _wanted databases expl "MySQL database" _mysql_databases && ret=0 ;; kill) - _message -e ids 'thread ids' + _message -e ids 'thread id' ;; password) _message -e passwords 'new password' @@ -220,8 +220,8 @@ _mysql_utils() { ) _mysql_variables_opts=( - '--max_allowed_packet[maximum allowed packet size]:packet size in bytes' - '--net_buffer_length[network buffer length]:buffer length in bytes' + '--max_allowed_packet[maximum allowed packet size]:packet size (bytes)' + '--net_buffer_length[network buffer length]:buffer length (bytes)' '--connect_timeout:timeout' '--select_limit:limit' '--max_join_size:size' diff --git a/Completion/Unix/Command/_mysqldiff b/Completion/Unix/Command/_mysqldiff index 4b46c86df..2515834e0 100644 --- a/Completion/Unix/Command/_mysqldiff +++ b/Completion/Unix/Command/_mysqldiff @@ -6,7 +6,7 @@ _mysqldiff () { {-p{,1,2},--password{,1,2}=}':server password: ' \ {-u{,1,2},--user{,1,2}=}':server username:_mysql_users' \ {-s{,1,2},--socket{,1,2}=}':server socket:_directories' \ - {-d,--debug=}':debugging level (default 1):(1 2 3 4 5 6 7 8)' \ + {-d,--debug=}':debugging level [1]:(1 2 3 4 5 6 7 8)' \ {-i,--tolerant}':ignore DEFAULT and formatting changes: ' \ {-k,--keep-old-tables}":don\'t output DROP TABLE commands: " \ {-n,--no-old-defs}"[don't output old defs as comments]" \ @@ -20,8 +20,8 @@ _mysqldiff () { _mysql_db_or_file () { _alternative \ - 'databases:MySQL databases:_mysql_databases' \ - 'files:MySQL database definition files:_files -g "*.(my|)sql(-.)"' + 'databases:MySQL database:_mysql_databases' \ + 'files:MySQL database definition file:_files -g "*.(my|)sql(-.)"' } _mysql_utils diff --git a/Completion/Unix/Command/_netstat b/Completion/Unix/Command/_netstat index 94aa1688d..67133dc6c 100644 --- a/Completion/Unix/Command/_netstat +++ b/Completion/Unix/Command/_netstat @@ -5,10 +5,10 @@ local lopt='[show only listening sockets]' local zopt='-z[reset statistic counters after displaying them]' local popt='(-f)-p+[filter by protocol]:protocol:compadd -a plist' local Iopt='(-i)-I+[show information about the specified interface]:interface:_net_interfaces' -local set sel +local set sel tblopt local -A sets local -a Mopts families flist plist args sockets extend interval verbose -local -a {sel_,}{bpf,dhcp,groups,interfaces,masquerade,media,memory,multicast,pcb,queues,routing,statistics,wireless} +local -a {sel_,}{bpf,dhcp,groups,interfaces,masquerade,media,memory,multicast,pcb,queues,rdomains,routing,statistics,wireless} case $OSTYPE in linux-gnu) @@ -130,7 +130,7 @@ case $OSTYPE in ) routing=( $families ) sel_memory=( '-m[display statistics recorded by the memory management routines]' ) - sel_interfaces+=( '(1 -a -f -i -p -s)-w+[display packet traffic at intervals]:interval (seconds)' ) + sel_interfaces+=( '(1 -a -f -i -p -s -u)-w+[display packet traffic at intervals]:interval (seconds)' ) ;| darwin*|dragonfly*|(net|free)bsd*) interfaces+=( '-a[show multicast addresses currently in use]' ) @@ -266,13 +266,15 @@ case $OSTYPE in ) ;; openbsd*) - sets+=( wireless '-W*' ) + sets+=( wireless '-W*' rdomains '-R' ) + sel_rdomains=( '-R[show all rdomains with associated interfaces and routing tables]' ) sel_wireless=( '-W+[display per-interface IEEE 802.11 wireless statistics]:interface' ) flist+=( local mpls ) - sockets+=( -l$lopt '-B[show buffer sizes for TCP sockets]' ) - routing+=( + tblopt='-T+[select an alternate routing table to query]:routing table:_routing_tables' + sockets+=( -l$lopt $tblopt '-B[show buffer sizes for TCP sockets]' ) + routing+=( $Mopts $tblopt + '-A[show the internal addresses of the routing table]' '-F[only show routes with gateway in the same address family as the destination]' - '-T+[select an alternate routing table to query]:routing table' ) interfaces+=( '-c+[show specified number of updates, then exit]:count' @@ -280,7 +282,8 @@ case $OSTYPE in '-q[only show interfaces that have seen packets]' '-t[show current value of the watchdog timer function]' ) - statistics+=( $popt ) + statistics+=( $popt '-r[display routing statistics]' ) + groups+=( -n$nopt ) pcb+=( $Mopts $verbose ) ;; netbsd*) @@ -300,6 +303,12 @@ case $OSTYPE in memory+=( $Xopt) statistics+=( $Xopt ) pcb+=( $Mopts $popt ) ;; + freebsd<13->.*) + sockets+=( + '-c[show TCP stack used for each session]' + '-C[show TCP congestion control algorithm and diagnostic]' + ) + ;& freebsd<11->.*) routing+=( '-F+[show specified routing table]:routing table' ) bpf=( '-z[reset statistic counters after displaying them]' ) diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm index 423fd3223..888f1ef87 100644 --- a/Completion/Unix/Command/_nm +++ b/Completion/Unix/Command/_nm @@ -53,7 +53,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu '(-C)--demangle[decode symbol names]' '(--format -P)-f+[specify output format]:format:(bsd sysv posix)' '(- *)--usage[give a short usage message]' - '(- *)-\\?[display help information]' + '(- *)-?[display help information]' ) ;; binutils) @@ -62,11 +62,12 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu '!(--no-recurse-limit)--recurse-limit' '--no-recurse-limit[disable demangling recursion limit]' '(-f --format -P)-f+[specify output format]:format:(bsd sysv posix)' - '(-C --no-demangle)--demangle=-[decode symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat rust dlang)' + '(-C --no-demangle)--demangle=-[decode symbol names]::style [auto]:(auto gnu lucid arm hp edg gnu-v3 java gnat rust dlang)' + '--ifunc-chars=[specify characters to use for indirect function symbols]:characters for global/local indirect function symbols [ii]' '--plugin[load specified plugin]:plugin' '--special-syms[include special symbols in the output]' '--synthetic[display synthetic symbols as well]' - "--target=[target object format]:targets:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })" + "--target=[target object format]:target:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })" '--with-symbol-versions[display version strings after symbol names]' ) ;; diff --git a/Completion/Unix/Command/_nmap b/Completion/Unix/Command/_nmap index b3d3d488a..2a507baa3 100644 --- a/Completion/Unix/Command/_nmap +++ b/Completion/Unix/Command/_nmap @@ -17,7 +17,7 @@ _arguments -C \ '-h[show help information]' \ '*-o-[log results]:log format:->log-forms:log filename:_files' \ '--resume[resume cancelled scan]:log filename:_files' \ - '--append_output[append results to any log files]' \ + '--append-output[append results to any log files]' \ '-iL[read target specifications from file]:file:_files' \ '-iR[scan random hosts]:num hosts' \ '-p[specify ports to try]:port numbers' \ @@ -26,24 +26,24 @@ _arguments -C \ '-S[specify source address]:address:_hosts' \ '-e[specify interface to use]:network interface:_net_interfaces' \ '-g[specify source port number]:port number' \ - '--data_length[add random data to packets]:data length' \ + '--data-length[add random data to packets]:data length' \ '(-R)-n[skip reverse DNS to speed things up]' \ '(-n)-R[always do reverse DNS on targets]' \ "-r[don't randomize order in which ports are scanned]" \ '-ttl[specify IPv4 time to live for sent packets]' \ - '--randomize_hosts[scan hosts in random order]' \ + '--randomize-hosts[scan hosts in random order]' \ '-M[specify maximum number of parallel TCP connects]:maximum TCP connects' \ - '--packet_trace[show all packets sent in tcpdump-like format]' \ - '--version_trace[show packets related to version scanning]' \ + '--packet-trace[show all packets sent in tcpdump-like format]' \ + '--version-trace[show packets related to version scanning]' \ '--datadir[specify directory containing data files]:directory:_directories' \ '-T[specify timing policy]:timing policy:(Paranoid Sneaky Polite Normal Aggressive Insane)' \ - '--host_timeout[specify maximum time for scanning a single host]:timeout (ms)' \ - '--max_rtt_timeout[maximum time for a probe response]:timeout (ms)' \ - '--min_rtt_timeout[minimum time to wait for a probe response]:time (ms)' \ - '--initial_rtt_timeout[specify initial probe timeout]:timeout (ms)' \ - '--max_parallelism[specify max number of scans to perform in parallel]:number' \ - '--min_parallelism[scan at least specified number of ports in parallel]:number' \ - '--scan_delay[specify minimum amount of time between probes]:delay (ms)' \ + '--host-timeout[specify maximum time for scanning a single host]:timeout (ms)' \ + '--max-rtt-timeout[maximum time for a probe response]:timeout (ms)' \ + '--min-rtt-timeout[minimum time to wait for a probe response]:time (ms)' \ + '--initial-rtt-timeout[specify initial probe timeout]:timeout (ms)' \ + '--max-parallelism[specify max number of scans to perform in parallel]:number' \ + '--min-parallelism[scan at least specified number of ports in parallel]:number' \ + '--scan-delay[specify minimum amount of time between probes]:delay (ms)' \ '--interactive[go into interactive mode]' \ '*:host:_hosts' && ret=0 diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump index 989cd3f0b..e2dde7e4c 100644 --- a/Completion/Unix/Command/_objdump +++ b/Completion/Unix/Command/_objdump @@ -67,7 +67,8 @@ case $variant in '(-z --disassemble-zeroes)'{-z,--disassemble-zeroes}"[don't skip blocks of zeroes when disassembling]" '--start-address=[only process data whose address is >= ADDR]:address' - '--stop-address=[only process data whose address is <= ADDR]:address' + '--stop-address=[only process data whose address is < ADDR]:address' + "--no-addresses[don't print address alongside disassembly]" '--prefix-addresses[print complete address alongside disassembly]' '(--show-raw-insn --no-show-raw-insn)'--{,no-}show-raw-insn'[display hex alongside symbolic disassembly]' '--insn-width=[display specified number of bytes on a single line with -d]:width (bytes)' @@ -80,6 +81,7 @@ case $variant in '--dwarf-start=[display DIEs at specified or deeper depth]:depth' '--dwarf-check[perform additional dwarf internal consistency checks]' '--ctf-parent=[use specified section as the CTF parent]:section' + '--visualize-jumps=-[visualize jumps by drawing ASCII art lines]::color:(color extended-color off)' ) ;; elfutils) @@ -165,6 +167,7 @@ case "$state" in _values -s "" "dwarf section" \ "l[rawline]" "L[decodedline]" "i[info]" "a[abbrev]" "p[pubnames]" \ "r[aranges]" "m[macro]" "f[frames]" "F[frames-interp]" "s[str]" \ + 'O[str-offsets]' \ "o[loc]" "R[ranges]" "t[pubtypes]" "U[trace_info]" "u[trace_abbrev]" \ "T[trace_aranges]" "g[gdb_index]" "A[addr]" "c[cu_index]" "k[links]" \ "K[follow-links]" && ret=0 @@ -172,7 +175,7 @@ case "$state" in dwarf-names) _sequence _wanted dwarf-sections expl "dwarf section" compadd - \ rawline decodedline info abbrev pubnames aranges macro frames \ - frames-interp str loc Ranges pubtypes gdb_index trace_info \ + frames-interp str str-offsets loc Ranges pubtypes gdb_index trace_info \ trace_abbrev trace_aranges addr cu_index links follow-links && ret=0 ;; bfdnames) @@ -184,7 +187,7 @@ case "$state" in ${=${(M)${(f)"$(_call_program targets objdump --help)"}##* supported architectures:*}##*: } && ret=0 ;; disassembler_options) - _values -s , "disassembler options" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:# [^ ]*}# }%% *}" && ret=0 + _values -s , "disassembler option" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:# [^ ]*}# }%% *}" && ret=0 ;; llvm_targets) _values "target architecture" "${(z)${(@)${(f)$(_call_program targets diff --git a/Completion/Unix/Command/_openstack b/Completion/Unix/Command/_openstack index fcb704ac8..d55686b80 100644 --- a/Completion/Unix/Command/_openstack +++ b/Completion/Unix/Command/_openstack @@ -34,8 +34,6 @@ if (( ! $+_cache_openstack_clnt_opts )); then typeset -gA _cache_openstack_clnt_opts typeset -gA _cache_openstack_clnt_cmds typeset -gA _cache_openstack_clnt_cmds_opts - typeset -gA _cache_openstack_clnt_cmds_subcmds - typeset -gA _cache_openstack_clnt_cmds_subcmd_opts fi local -a conn_opts @@ -61,65 +59,78 @@ if [[ -n ${clnts_compl_new[(r)$service]} ]]; then # Populate caches - clnt_outputs is command raw output used later _cache_openstack_clnt_outputs[$service]=${:-"$($service ${(Q)conn_opts} complete 2>/dev/null)"} _cache_openstack_clnt_opts[$service]=${${${${(M)${${${${=${(f)"$($service help 2>/dev/null)"}}/\[}/\]}/\;}:#-[-0-9A-Za-z]*}/,}/\.}%--os-} - _cache_openstack_clnt_cmds[$service]=${${${${_cache_openstack_clnt_outputs[$service]}/* cmds=\'}/\'*}/complete} fi - local cmd subcmd - # Determine the command - for word in ${words:1}; do - local s=${_cache_openstack_clnt_cmds[$service]} - [[ $s[(wI)$word] -gt 0 ]] && cmd=$word && break - done - # Populate the subcommand cache - if [[ -n $cmd && -z $_cache_openstack_clnt_cmds_subcmds[$service$cmd] ]]; then - local t=cmds_${cmd//-/_} - _cache_openstack_clnt_cmds_subcmds[$service$cmd]=${${${_cache_openstack_clnt_outputs[$service]}/* $t=\'}/\'*} + + # get worlds left of the curser into an array + local -a left_words + left_words=(${=LBUFFER}) + + # if curser is directly at a word (no space at the end), + # exclude the last word to offer right matches + # the last word could be a partial match that is later checked (prefix-needed) + local partial="" + if [[ "${LBUFFER[-1]}" != " " ]]; then + partial=${(@)left_words[-1]} + left_words=(${(@)left_words[1,$#left_words-1]}) fi - # Determine the subcommand - if [[ -n $cmd ]]; then - for word in ${words:2}; do - local s=${_cache_openstack_clnt_cmds_subcmds[$service$cmd]} - [[ $s[(wI)$word] -gt 0 ]] && subcmd=$word && break - done - # Populate subcommand option cache - if [[ -n $subcmd && -z $_cache_openstack_clnt_cmds_subcmd_opts[$service${cmd}--$subcmd] ]]; then - local t=cmds_${cmd//-/_}_${subcmd//-/_} - _cache_openstack_clnt_cmds_subcmd_opts[$service${cmd}--$subcmd]=${${${_cache_openstack_clnt_outputs[$service]}/* $t=\'}/\'*} - fi + # remove $service + left_words=(${left_words:1}) + + # filter out "help" + if [[ $left_words[1] == help ]]; then + left_words=(${(@)left_words[2,$#left_words]}) fi - # Special treatment for the help command - if [[ $cmd == help ]]; then - if [[ $words[CURRENT-1] == $cmd && $words[CURRENT] != -* ]]; then - # Offer commands - [[ -n $_cache_openstack_clnt_cmds[$service] ]] && _values -w option ${(u)=_cache_openstack_clnt_cmds[$service]} && ret=0 - elif [[ $words[CURRENT-2] == $cmd && $words[CURRENT-1] != -* && $words[CURRENT] != -* ]]; then - # Offer subcommands - local cmd=$words[CURRENT-1] - local t=cmds_${cmd//-/_} - [[ -z $_cache_openstack_clnt_cmds_subcmds[$service$cmd] ]] && _cache_openstack_clnt_cmds_subcmds[$service$cmd]=${${${_cache_openstack_clnt_outputs[$service]}/* $t=\'}/\'*} - [[ -n $_cache_openstack_clnt_cmds_subcmds[$service$cmd] ]] && _values -w option ${(u)=_cache_openstack_clnt_cmds_subcmds[$service$cmd]} && ret=0 - else - # Handle help<TAB> properly - _values -w option help && ret=0 - fi - # Client options - elif [[ -z $cmd && $words[CURRENT] == -* ]]; then - _values -w option ${(u)=_cache_openstack_clnt_opts[$service]} && ret=0 - # Commands - elif [[ -z $cmd ]]; then - if [[ -z $_cache_openstack_clnt_cmds[$service] ]]; then - _message "missing authentication options" + + # filter out options (-*) + left_words=(${left_words//-*}) + + local -a subcmd_array cmds_array cache_key_array cache_values + subcmd_array=() + cmds_array=(cmds) + cache_key_array=(${service}) + cache_values=() + local cache_key cmds + cache_key="" + cmds="" + + # Check for matches one level at a time + # example: "" server create + for word in "" ${(@)left_words}; do # first loop second loop third loop + subcmd_array=(${(@)subcmd_array} ${word}) # () (server) (server create) + cmds_array=(${(@)cmds_array} ${word}) # (cmds) (cmds server) (cmds server create) + cmds=${${(j:_:)cmds_array}/-/_} # cmds cmds_openstack cmds_server_create + cache_key_array=(${(@)cache_key_array} ${word}) # (openstack) (openstack server) (openstack server create) + cache_key=${${(j:_:)cache_key_array}/-/_} # openstack openstack_server openstack_server_create + + # lookup if current word is in cache_values of last elements + if [[ ${cache_values[(wI)${word}]} -gt 0 || $word == "" ]]; then + _cache_openstack_clnt_cmds[${cache_key}]=${${${_cache_openstack_clnt_outputs[${service}]}/* ${cmds}=\'}/\'*} else - _values -w option ${(u)=_cache_openstack_clnt_cmds[$service]} && ret=0 + # unknown word: set cache_key to last cache_key and break + cache_key=${${(j:_:)${cache_key_array:0:${#cache_key_array}-1}}/-/_} + break fi - # Subcommands - elif [[ -z $subcmd ]]; then - [[ -n $_cache_openstack_clnt_cmds_subcmds[$service$cmd] ]] && _values -w option ${(u)=_cache_openstack_clnt_cmds_subcmds[$service$cmd]} && ret=0 - # Subcommand options + # set cache_values for next loop + cache_values=${_cache_openstack_clnt_cmds[${cache_key}]} + done + + # Populate the command cache + if [[ -z $_cache_openstack_clnt_cmds[${cache_key}] ]]; then + _message "missing authentication options" else - { ! zstyle -T ":completion:${curcontext}:options" prefix-needed || [[ -prefix - ]] } && \ - [[ -n $_cache_openstack_clnt_cmds_subcmd_opts[$service${cmd}--$subcmd] ]] && _values -w option ${(u)=_cache_openstack_clnt_cmds_subcmd_opts[$service${cmd}--$subcmd]//\:/\\\:} && ret=0 + # add global options to completion list if current word start with -* + local extra_opts + if [[ $words[CURRENT] == -* ]]; then; + extra_opts=${_cache_openstack_clnt_opts[$service]} + fi + + { ! zstyle -T ":completion:${curcontext}:options" prefix-needed \ + || [[ -n "${partial}" && ${${_cache_openstack_clnt_cmds[${cache_key}]}[(Iw)${partial}*]} -gt 0 || -prefix - ]] } \ + && _values -w option ${(u)=_cache_openstack_clnt_cmds[${cache_key}]} ${(u)=extra_opts} \ + && ret=0 fi + # Old style clients elif [[ -n ${clnts_compl_old[(r)$service]} ]]; then if [[ -z $_cache_openstack_clnt_cmds[$service] ]]; then diff --git a/Completion/Unix/Command/_opustools b/Completion/Unix/Command/_opustools new file mode 100644 index 000000000..1fd97798a --- /dev/null +++ b/Completion/Unix/Command/_opustools @@ -0,0 +1,71 @@ +#compdef opusenc opusdec opusinfo + +case $service in + opusenc) + _arguments -S \ + '1:input file:_files -g "*.(#i)(wav|flac|ogg|aif(|f))(-.)"' \ + '2:output file:_files -g "*.(#i)opus(-.)"' \ + '(- 1 *)'{-h,--help}'[show usage information]' \ + '(- 1 *)'{-V,--version}'[show version information]' \ + '(- 1 *)--help-picture[show help on attaching album art]' \ + '--quiet[enable quiet mode]' \ + '--bitrate[set target bitrate per channel]:target bitrate per channel (kbps) (6-256)' \ + '--comp[set encoding complexity]:encoding complexity (1-10) [10]:(1 2 3 4 5 6 7 8 9 10)' \ + '--cvbr[use constrained variable bitrate encoding]' \ + '--downmix-mono[downmix to mono]' \ + '--downmix-stereo[downmix to stereo (if >2 channels)]' \ + '--expect-loss[set expected packet loss]:expected packet loss (%%) (0-100) [0]' \ + '--framesize[set maximum frame size]:maximum frame size (milliseconds) [20]:(2.5 5 10 20 40 60)' \ + '--hard-cbr[use hard constant bitrate encoding]' \ + '--max-delay[set maximum container delay]:maximum container delay (milliseconds) (0-1000) [1000]' \ + '--music[tune low bitrates for music (override automatic detection)]' \ + '--no-phase-inv[disable use of phase inversion for intensity stereo]' \ + '--speech[tune low bitrates for speech (override automatic detection)]' \ + '--vbr[use variable bitrate encoding (default)]' \ + '--album[set album or collection]:album or collection' \ + '--date[set date of track]:date of track (YYYY, YYYY-MM, or YYYY-MM-DD):_dates -f "%F"' \ + '--discard-comments[discard metadata when transcoding]' \ + '--discard-pictures[discard pictures when transcoding]' \ + '--padding[reserve extra bytes for metadata]:padding size (bytes) [512]' \ + '--title[set track title]:track title' \ + '--tracknumber[set track number]:track number' \ + '*--artist[add artist or author]:artist or author' \ + '*--comment[add an extra comment]:comment (tag=val)' \ + '*--genre[add genre]:genre' \ + '*--picture[attach album art]:album art:_files -g "*.(#i)(jp(|e)g|png|gif)(-.)"' \ + '--ignorelength[ignore the data length in RIFF wav headers]' \ + '--raw-bits[set bits per sample for raw input]:bits per sample [16]:(8 16 24)' \ + '--raw-chan[set number of channels for raw input]:number of channels (1-255) [2]' \ + '--raw-endianness[set endianness for raw input]:endianness:(("0"\:"big endian" "1"\:"little endian"))' \ + '--raw-rate[set sampling rate for raw input]:sample rate (Hz) (100-768000) [48000]' \ + '--raw[interpret input as raw PCM data without headers]' \ + '--serial[force use of a specific stream serial number]:stream serial number' \ + '--save-range[save check values for every frame to a file]:output for check values:_files' \ + '--set-ctl-int[pass encoder control]:encoder control' + ;; + opusdec) + _arguments -S \ + '1:input file:_files -g "*.(#i)opus(-.)"' \ + '2::output file:_files -g "*.(#i)wav(-.)"' \ + '(- 1 *)'{-h,--help}'[show usage information]' \ + '(- 1 *)'{-V,--version}'[show version information]' \ + '(- 1 *)--help-picture[show help on attaching album art]' \ + '--quiet[enable quiet mode]' \ + '--rate[force decoding at given sample rate]:sample rate (Hz) (8000-192000)' \ + '--force-stereo[force decoding to stereo]' \ + '--gain[adjust output volume]:gain (dB) (negative is quieter)' \ + '--no-dither[do not dither 16-bit output]' \ + '--float[output 32-bit floating-point samples]' \ + '--force-wav[force RIFF wav header on output]' \ + '--packet-loss[simulate random packet loss]:packet loss probability (%%) (0-100)' \ + '--save-range[save check values for every frame to a file]:output for check values:_files' + ;; + opusinfo) + _arguments -s -S \ + '(- 1 *)-h[show usage information]' \ + '(- 1 *)-V[show version information]' \ + '*-q[make the output quieter]' \ + '*-v[make the output more verbose]' \ + '*:opus file:_files -g "*.(#i)opus(-.)"' + ;; +esac diff --git a/Completion/Unix/Command/_pandoc b/Completion/Unix/Command/_pandoc index 29d3724e0..b0fff80d6 100644 --- a/Completion/Unix/Command/_pandoc +++ b/Completion/Unix/Command/_pandoc @@ -1,130 +1,40 @@ #compdef pandoc -# {{{ helper: cache policy for available formats and other variables -(( $+functions[__pandoc_cache_policy] )) || -__pandoc_cache_policy(){ - local cache_file="$1" - if [[ -f "${commands[pandoc]}" && -f "${cache_file}" ]]; then - # if the manifest file is newer then the cache: - if [[ "${commands[pandoc]}" -nt "${cache_file}" ]]; then - return 0 - else - return 1 - fi +# input or output formats with optional extensions +# required option: -T (input|output) +(( $+functions[_pandoc_format] )) || +_pandoc_format() { + local -a inout expl + zparseopts -D -E - T:=inout + local format=${PREFIX%%(+|-)*} + if compset -P '*(+|-)'; then + local pm=${IPREFIX[-1]} # '+' or '-' + local -a extensions=(${${$(pandoc --list-extensions=$format):#$pm*}#(+|-)}) + _wanted extensions expl 'extension' compadd -S '+' -r '-+ ' -a extensions else - return 0 + local -a formats=( $(pandoc --list-$inout[2]-formats) ) + _wanted formats expl 'format' compadd -S '+' -r '-+ ' -a formats fi } -# }}} -# {{{ choose a format among supported output format -(( $+functions[_pandoc_output_format] )) || -_pandoc_output_format(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - if _cache_invalid pandoc_output_formats_simple; then - output_formats_simple=($(pandoc --list-output-formats)) - _store_cache pandoc_output_formats_simple output_formats_simple - else - _retrieve_cache pandoc_output_formats_simple - fi - if _cache_invalid pandoc_output_formats_plus_extensible || _cache_invalid pandoc_output_formats_minus_extensible; then - for f in ${output_formats_simple[*]}; do - for e in $(pandoc --list-extensions=${f}); do - if [[ "${e}" =~ '^\+' ]]; then - output_formats_plus_extensible+=("${f}${e}") - elif [[ "${e}" =~ '^\-' ]]; then - output_formats_minus_extensible+=("${f}${e}") - fi - done - done - _store_cache pandoc_output_formats_minus_extensible output_formats_minus_extensible - _store_cache pandoc_output_formats_plus_extensible output_formats_plus_extensible - else - _retrieve_cache pandoc_output_formats_minus_extensible - _retrieve_cache pandoc_output_formats_plus_extensible - fi - _alternative \ - 'formats_plus:format:{_multi_parts "+" output_formats_plus_extensible}' \ - 'formats_minus:format:{_multi_parts -- "-" output_formats_minus_extensible}' -} -# }}} -# {{{ choose a format among supported input format -(( $+functions[_pandoc_input_format] )) || -_pandoc_input_format(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - if _cache_invalid pandoc_input_formats_simple; then - input_formats_simple=($(pandoc --list-input-formats)) - _store_cache pandoc_input_formats_simple input_formats_simple - else - _retrieve_cache pandoc_input_formats_simple - fi - if _cache_invalid pandoc_input_formats_plus_extensible || _cache_invalid pandoc_input_formats_minus_extensible; then - for f in ${input_formats_simple[*]}; do - for e in $(pandoc --list-extensions=${f}); do - if [[ "${e}" =~ '^\+' ]]; then - input_formats_plus_extensible+=("${f}${e}") - elif [[ "${e}" =~ '^\-' ]]; then - input_formats_minus_extensible+=("${f}${e}") - fi - done - done - _store_cache pandoc_input_formats_minus_extensible input_formats_minus_extensible - _store_cache pandoc_input_formats_plus_extensible input_formats_plus_extensible - else - _retrieve_cache pandoc_input_formats_minus_extensible - _retrieve_cache pandoc_input_formats_plus_extensible - fi - _alternative \ - 'formats_plus:format:{_multi_parts "+" input_formats_plus_extensible}' \ - 'formats_minus:format:{_multi_parts -- "-" input_formats_minus_extensible}' -} -# }}} -# {{{ choose a format among all supported formats + +# all supported formats (( $+functions[_pandoc_all_formats] )) || _pandoc_all_formats(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - if _cache_invalid pandoc_input_formats_simple; then - input_formats_simple=($(pandoc --list-input-formats)) - _store_cache pandoc_input_formats_simple input_formats_simple - else - _retrieve_cache pandoc_input_formats_simple - fi - if _cache_invalid pandoc_output_formats_simple; then - output_formats_simple=($(pandoc --list-output-formats)) - _store_cache pandoc_output_formats_simple output_formats_simple - else - _retrieve_cache pandoc_output_formats_simple - fi - if _cache_invalid pandoc_all_formats; then - all_formats=(${output_formats_simple} ${input_formats_simple}) - all_formats=($(sort -u <<<"${all_formats[*]}")) - _store_cache pandoc_all_formats all_formats - else - _retrieve_cache pandoc_all_formats - fi - _describe "format" all_formats + local -a expl + local -aU formats + formats=( $(pandoc --list-input-formats) $(pandoc --list-output-formats) ) + _wanted formats expl 'format' compadd -a formats } -# }}} -# {{{ pdf engine choice + +# pdf engine choice (( $+functions[_pandoc_pdf_engine] )) || _pandoc_pdf_engine(){ _alternative \ - 'engines:engine:{_values "engine" pdflatex lualatex xelatex wkhtmltopdf weasyprint prince context pdfroff}' \ - 'engine_files:engine:_files' + 'engines:engine:(pdflatex lualatex xelatex latexmk tectonic wkhtmltopdf weasyprint prince context pdfroff)' \ + 'engine-executables:engine executable:_files -g "*(#q*)"' } -# }}} -# {{{ options to pass to --pdf-engine command + +# options to pass to --pdf-engine command (( $+functions[_pandoc_pdf_engine_opts] )) || _pandoc_pdf_engine_opts(){ local pdf_engine=${opt_args[--pdf-engine]} @@ -133,123 +43,75 @@ _pandoc_pdf_engine_opts(){ _tex ;; *) - type _${pdf_engine} > /dev/null - if [[ $? == 1 ]]; then - _message "Options for ${pdf_engine}" - fi + _message "Options for ${pdf_engine}" ;; esac } -# }}} -# {{{ choose data-dir -(( $+functions[_pandoc_data_dir] )) || -_pandoc_data_dir(){ - _files -/ + +# data-dir specified by --data-dir option, or the default dir +_pandoc_default_dir() { + if (( $+opt_args[--data-dir] )); then + echo ${opt_args[--data-dir]:a} + else + # XXX Some versions of pandoc may output two user data directories: + # ~/.local/share/pandoc or ~/.pandoc + # Here we use only the first one. + pandoc --version | sed -ne 's/.*[Uu]ser data directory: \([^ ]*\).*/\1/p' + fi } -# }}} -# {{{ choose template from data-dir + +# template file in $PWD or data-dir/templates/, or URL (( $+functions[_pandoc_template] )) || _pandoc_template(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - if _cache_invalid pandoc_output_formats_simple; then - output_formats_simple=($(pandoc --list-output-formats)) - _store_cache pandoc_output_formats_simple output_formats_simple - else - _retrieve_cache pandoc_output_formats_simple - fi - local data_dir=${opt_args[--data-dir]} - if [[ -z $data_dir ]]; then - if _cache_invalid pandoc_default_data_dir; then - default_data_dir=$(pandoc --version | sed -ne 's/Default user data directory: \(.*\)/\1/p') - _store_cache pandoc_default_data_dir default_data_dir - else - _retrieve_cache pandoc_default_data_dir - fi - data_dir=${default_data_dir} - fi - _pandoc_template_find_args="-name '*.'${output_formats_simple[1]}" - for ((i = 2; i < ${#output_formats_simple[@]}; i++ )); do - _pandoc_template_find_args=$_pandoc_template_find_args" -or -name '*.'${output_formats_simple[$i]}" - done - templates=($(eval find -L ${data_dir}/templates ${_pandoc_template_find_args} 2>/dev/null | sed -e 's/.*\///' -e 's/\.[^.]*$//')) - if [[ -z "${templates}" ]]; then - templates=default - fi - _describe 'templates from default data-dir' templates + # find output format from '-t format' or '-o xxx.format' + local format=${${(v)opt_args[(i)(-t|--to|-w|--write)]}%%(+|-)*} + [[ -z $format ]] && format=${(v)opt_args[(i)(-o|--output)]:e} + local pat="'*'" # or '*.*' ? + [[ -n $format ]] && pat="'*.$format(-.)'" + local template_dir=$(_pandoc_default_dir)/templates + _alternative \ + "local-templates:local template:_files -g $pat" \ + "data-dir-templates:template in data-dir:_files -W $template_dir -g $pat" \ + 'urls: :_urls' } -# }}} -# {{{ choose highlight-style + +# choose highlight-style (( $+functions[_pandoc_highlight_style] )) || _pandoc_highlight_style(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - if _cache_invalid pandoc_highlighting_styles; then - highlighting_styles=($(pandoc --list-highlight-styles)) - _store_cache pandoc_highlighting_styles highlighting_styles - else - _retrieve_cache pandoc_highlighting_styles - fi _alternative \ - 'styles:style:{_values "syntax builting style" ${highlighting_styles[*]}}' \ - 'style_files_here:style:{_files -g "*.theme"}' + 'styles:style:( $(pandoc --list-highlight-styles) )' \ + 'style-files:style file:_files -g "*.theme(-.)"' } -# }}} -# {{{ choose filter from specified or default data-dir + +# filter file in $PWD, data-dir/filters/ or $PATH (( $+functions[_pandoc_filter] )) || _pandoc_filter(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - local data_dir=${opt_args[--data-dir]} - if [[ -z $data_dir ]]; then - if _cache_invalid pandoc_default_data_dir; then - default_data_dir=$(pandoc --version | sed -ne 's/Default user data directory: \(.*\)/\1/p') - _store_cache pandoc_default_data_dir default_data_dir - else - _retrieve_cache pandoc_default_data_dir - fi - data_dir=${default_data_dir} - fi - local filters_dir=$data_dir"/filters" + local filters_dir=$(_pandoc_default_dir)/filters _alternative \ - 'local_filter:filter:{_files -g "*.lua"}' \ - 'data_dir_filter:filter:{_files -W filters_dir -g "*.lua"}' + 'local-filters:local filter:_files' \ + 'data-dir-filters:filter in data-dir:_files -W filters_dir' \ + 'commands: : _command_names -e' } -# }}} -# {{{ choose lua filter from specified or default data-dir + +# lua filter in $PWD or data-dir/filters/ (( $+functions[_pandoc_lua_filter] )) || _pandoc_lua_filter(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - local data_dir=${opt_args[--data-dir]} - if [[ -z $data_dir ]]; then - if _cache_invalid pandoc_default_data_dir; then - default_data_dir=$(pandoc --version | sed -ne 's/Default user data directory: \(.*\)/\1/p') - _store_cache pandoc_default_data_dir default_data_dir - else - _retrieve_cache pandoc_default_data_dir - fi - data_dir=${default_data_dir} - fi - local filters_dir=$data_dir"/filters" + local filters_dir=$(_pandoc_default_dir)/filters _alternative \ - 'local_filter:filter:{_files -g "(#q*)(.)"}' \ - 'data_dir_filter:filter:{_files -W filters_dir -g "(#q*)(.)"}' - } -# }}} -# {{{ choose reference location + 'local-filters:local filter:_files -g "*.lua(-.)"' \ + 'data-dir-filters:filter in data-dir:_files -W filters_dir -g "*.lua(-.)"' +} + +# default file in $PWD or data-dir/defaults/ +(( $+functions[_pandoc_defaults_file] )) || +_pandoc_defaults_file() { + local defaults_dir=$(_pandoc_default_dir)/defaults + _alternative \ + 'local-defaults:default file:_files -g "*.yaml(-.)"' \ + 'data-dir-defaults:default in data-dir:_files -W defaults_dir -g "*.yaml(-.)"' +} + +# choose reference location (( $+functions[_pandoc_reference_location] )) || _pandoc_reference_location(){ local -a policies @@ -260,49 +122,38 @@ _pandoc_reference_location(){ ) _describe 'location' policies } -# }}} -# --base-header-level must be 1-5: https://github.com/jgm/pandoc/blob/34d8ffbcfc33b86766ff7229be4d8a0d1fbffb50/src/Text/Pandoc/App.hs#L867 -# {{{ choose top level division + +# choose top level division (( $+functions[_pandoc_top_level_division] )) || _pandoc_top_level_division(){ _values 'top level division' default section chapter part } -# }}} -# {{{ choose header levels -(( $+functions[_pandoc_header_levels] )) || -_pandoc_header_levels(){ - _values -s , "number" 1 2 3 4 5 6 -} -(( $+functions[_pandoc_header_level] )) || -_pandoc_header_level(){ - _values "number" 1 2 3 4 5 6 -} -# }}} -# {{{ choose email obfusication + +# choose email obfusication (( $+functions[_pandoc_email_obfusication] )) || _pandoc_email_obfusication(){ local -a policies policies=( - 'none:(default) leaves mailto: links as they are' + 'none:leave mailto: links as they are' 'javascript:obfuscates them using JavaScript' 'references:obfuscates them by printing their letters as decimal or hexadecimal character references' ) - _describe 'obfusication' policies + _describe 'obfuscation policy [none]' policies } -# }}} -# {{{ choose wrapping policy + +# choose wrapping policy (( $+functions[_pandoc_wrap] )) || _pandoc_wrap() { local -a policies policies=( - 'auto:(default) wrap lines to the column width specified by --columns (default 72)' + 'auto:wrap lines to the column width specified by --columns (default 72)' "none:don't wrap lines at all" 'preserve:attempt to preserve the wrapping from the source document' ) - _describe 'policy' policies + _describe 'policy [auto]' policies } -# }}} -# {{{ choose eol policy + +# choose eol policy (( $+functions[_pandoc_eol] )) || _pandoc_eol() { local -a policies @@ -313,105 +164,107 @@ _pandoc_eol() { ) _describe 'policy' policies } -# }}} -# {{{ choose changes tracking policy + +# choose changes tracking policy (( $+functions[_pandoc_track_changes] )) || _pandoc_track_changes() { local -a policies policies=( - 'accept:(default) inserts all insertions, and ignores all deletions' + 'accept:insert all insertions, and ignore all deletions' 'reject:inserts all deletions and ignores insertions' 'all:puts in insertions, deletions, and comments, wrapped in spans with insertion, deletion, comment-start, and comment-end classes, respectively' ) - _describe 'policy' policies + _describe 'policy [accept]' policies } -# }}} # The real thing -_arguments -C \ - {-f,-r,--from=,--read=}'[specify input format]:format:_pandoc_input_format' \ - {-t,-w,--to=,--write=}'[specify output format]:format:_pandoc_output_format' \ - {-o,--output=}'[write output to FILE instead of stdout]:file:_files' \ - '--data-dir=[specify the user data directory to search for pandoc data files]:dir:_pandoc_data_dir' \ - '--base-header-level=[specify the base level for headers (defaults to 1)]:number:_pandoc_header_level' \ - '--strip-empty-paragraphs[deprecated. Use the +empty_paragraphs extension instead]: :' \ - '--indented-code-classes=[classes to use for indented code blocks]:class:{_message "Classes separated with ,"}' \ - '*--filter=[specify an executable to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written]:file:_pandoc_filter' \ - '*--lua-filter=[transform the document in a similar fashion as JSON filters (see --filter), but use pandoc'"'"'s built-in lua filtering system]:file:_pandoc_lua_filter' \ - {-p,--preserve-tabs}'[preserve tabs instead of converting them to spaces]: :' \ - '--tab-stop=[specify the number of spaces per tab (default is 4)]:number:{_message -r "choose a number equals to or greater then 1"}' \ +_arguments -s \ + {-f+,-r+,--from=,--read=}'[specify input format]: :_pandoc_format -T input' \ + {-t+,-w+,--to=,--write=}'[specify output format]: :_pandoc_format -T output' \ + {-o+,--output=}'[write output to FILE instead of stdout]:file:_files' \ + '--data-dir=[specify the user data directory to search for pandoc data files]:data directory:_files -/' \ + {-d+,--defaults=}'[read default from YAML file]: :_pandoc_defaults_file' \ + '--shift-heading-level-by=[shift heading levels by specified number]:positive or negative integer: ' \ + '!--base-header-level=:number [1]:(1 2 3 4 5)' \ + '!--strip-empty-paragraphs[deprecated. Use the +empty_paragraphs extension instead]' \ + '--indented-code-classes=[classes to use for indented code blocks]:class list (comma-separated)' \ + '--default-image-extension=[specify a default extension to use when image paths/URLs have no extension]:extension: ' \ + '--file-scope[parse each file individually before combining for multifile documents]' \ + {\*-F+,\*--filter=}'[specify an executable to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written]: :_pandoc_filter' \ + {\*-L+,\*--lua-filter=}"[transform the document by using pandoc's built-in lua filtering system]: :_pandoc_lua_filter" \ + {\*-M+,\*--metadata=}'[set the metadata field KEY to the value VALUE]:key\:value: ' \ + '*--metadata-file=[read metadata from file]:YAML or JSON file:_files' \ + {-p,--preserve-tabs}'[preserve tabs instead of converting them to spaces]' \ + '--tab-stop=[specify the number of spaces per tab]:spaces [4]' \ '--track-changes=[specifies what to do with insertions, deletions, and comments produced by the MS Word "Track Changes" feature]: :_pandoc_track_changes' \ - '--file-scope[parse each file individually before combining for multifile documents]: :' \ - '--extract-media=[extract images and other media contained in or linked from the source document to the path DIR]:dir:{_dir_list}' \ - {-s,--standalone}'[produce output with an appropriate header and footer]: :' \ + '--extract-media=[extract media in source document to specified directory]:directory:_files -/' \ + '--abbreviations=[specifies a custom abbreviations file]:file:_files ' \ + {-s,--standalone}'[produce output with an appropriate header and footer]' \ '--template=[use FILE as a custom template for the generated document. Implies --standalone]: :_pandoc_template' \ - {\*-M,\*--metadata=}'[set the metadata field KEY to the value VALUE]:key\:value: ' \ - {\*-V,\*--variable=}'[set the variable KEY to the value VALUE]:key\:value: ' \ - '(- :)'{-D,--print-default-template=}'[print the system default template for an output]:format:_pandoc_output_format' \ + {\*-V+,\*--variable=}'[set the variable KEY to the value VALUE]:key\:value: ' \ + '(- :)'{-D+,--print-default-template=}'[print the system default template for an output]:format:( $(pandoc --list-output-formats) )' \ '(- :)--print-default-data-file=[print a system default data file]:file: ' \ - '(- :)--print-highlight-style=[prints a JSON version of a highlighting style]:style|file: ' \ - '--dpi=[specify the dpi (dots per inch) value for conversion from pixels to inch/centimeters and vice versa]:number: ' \ '--eol=[manually specify line endings (crlf|lf|native)]: :_pandoc_eol' \ + '--dpi=[specify the dpi (dots per inch) value for conversion from pixels to inch/centimeters and vice versa]:number: ' \ '--wrap=[determine how text is wrapped in the output (the source code, not the rendered version)]: :_pandoc_wrap ' \ - '--columns=[specify length of lines in characters (default 72)]:number: ' \ - '--strip-comments[strip out HTML comments in the Markdown or Textile source]: : ' \ - {--toc,--table-of-contents}'[include an automatically generated table of contents]: : ' \ - '--toc-depth=[specify the number of section levels to include in the table of contents]:number:{_message -r "choose a number equals to or greater then 1"}' \ - '--no-highlight[disables syntax highlighting for code blocks and inlines]: : ' \ + '--columns=[specify length of lines in characters]:length [72]' \ + {--toc,--table-of-contents}'[include an automatically generated table of contents]' \ + '--toc-depth=[specify the number of section levels to include in the table of contents]:number' \ + '--strip-comments[strip out HTML comments in the Markdown or Textile source]' \ + '--no-highlight[disables syntax highlighting for code blocks and inlines]' \ '--highlight-style=[specifies the coloring style to be used in highlighted source code]:style|file:_pandoc_highlight_style' \ - '--syntax-definition=[load a KDE XML syntax definition file]:file:{_files -g "*.xml"}' \ - {\*-H,\*--include-in-header=}'[include contents of FILE, verbatim, at the end of the header, implies --standalone]:file:_files' \ - {\*-B,\*--include-before-body=}'[include contents of FILE, verbatim, at the beginning of the document body, implies --standalone]:file:_files' \ - {\*-A,\*--include-end-body=}'[include contents of FILE, verbatim, at the end of the document body, implies --standalone]:file:_files' \ + '(- :)--print-highlight-style=[prints a JSON version of a highlighting style]: :_pandoc_highlight_style' \ + '--syntax-definition=[load a KDE XML syntax definition file]:file:_files -g "*.xml(-.)"' \ + {\*-H+,\*--include-in-header=}'[include contents of FILE, verbatim, at the end of the header, implies --standalone]:file:_files' \ + {\*-B+,\*--include-before-body=}'[include contents of FILE, verbatim, at the beginning of the document body, implies --standalone]:file:_files' \ + {\*-A+,\*--include-end-body=}'[include contents of FILE, verbatim, at the end of the document body, implies --standalone]:file:_files' \ '--resource-path=[list of paths to search for images and other resources]:searchpath:_dir_list' \ '--request-header=[set the request header NAME to the value VAL when making HTTP requests]:name\:val: ' \ - '--self-contained[produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. Implies --standalone]: : ' \ - '--html-q-tags[use <q> tags for quotes in HTML]: : ' \ - '--ascii[use only ASCII characters in output, supported only for HTML and DocBook output]: : ' \ - '--reference-links[use reference-style links, rather than inline links]: : ' \ + '--no-check-certificate[disable the certificate verification]' \ + '--self-contained[produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. Implies --standalone]' \ + '--html-q-tags[use <q> tags for quotes in HTML]' \ + '--ascii[use only ASCII characters in output, supported only for HTML and DocBook output]' \ + '--reference-links[use reference-style links, rather than inline links]' \ '--reference-location=[specify where footnotes (and references, if reference-links is set) are placed (block|section|document)]: :_pandoc_reference_location' \ - '--atx-headers[use ATX-style headers in Markdown and AsciiDoc output]: : ' \ + '--markdown-headings[specify style for level1 and 2 headings in markdown output]:style [atx]:(setext atx)' \ + '!--atx-headers[use ATX-style headers in Markdown and AsciiDoc output]' \ '--top-level-division=[treat top-level headers as the given division type in LaTeX, ConTeXt, DocBook, and TEI output]: :_pandoc_top_level_division' \ - {-N,--number-sections}'[number section headings in LaTeX, ConTeXt, HTML, or EPUB output]: : ' \ - '--number-offset=[offset for section headings in HTML output (ignored in other output formats)]: :_pandoc_header_levels' \ - '--listings[use the listings package for LaTeX code blocks]: : ' \ - {-i,--incremental}'[make list items in slide shows display incrementally (one by one)]: : ' \ - '--slide-level=[specifies that headers with the specified level create slides (for beamer, s5, slidy, slideous, dzslides)]: :_pandoc_header_levels' \ - '--section-divs[wrap sections in <section> tags (or <div> tags for html4)Use the section-divs package for LaTeX code blocks]: : ' \ + {-N,--number-sections}'[number section headings in LaTeX, ConTeXt, HTML, or EPUB output]' \ + '--number-offset=[offset for section headings in HTML output (ignored in other output formats)]:number[number,...] [0]' \ + '--listings[use the listings package for LaTeX code blocks]' \ + {-i,--incremental}'[make list items in slide shows display incrementally (one by one)]' \ + '--slide-level=[specifies that headers with the specified level create slides (for beamer, s5, slidy, slideous, dzslides)]:slide level:(1 2 3 4 5 6)' \ + '--section-divs[wrap sections in <section> tags (or <div> tags for html4)Use the section-divs package for LaTeX code blocks]' \ '--email-obfusication=[treat top-level headers as the given division type in LaTeX, ConTeXt, DocBook, and TEI output (none|javascript|references)]: :_pandoc_email_obfusication' \ - '--default-image-extension=[specify a default extension to use when image paths/URLs have no extension]:extension: ' \ '--id-prefix=[specify a prefix to be added to all identifiers and internal links in HTML and DocBook output]:string: ' \ - {-T,--title-prefix=}'[specify STRING as a prefix at the beginning of the title that appears in the HTML header]:string: ' \ - {\*-c,\*--css=}'[link to a CSS style sheet]:url: ' \ + {-T+,--title-prefix=}'[specify STRING as a prefix at the beginning of the title that appears in the HTML header]:string: ' \ + {\*-c+,\*--css=}'[link to a CSS style sheet]: :_urls' \ '--reference-doc=[use the specified file as a style reference in producing a docx or ODT file]:file: ' \ - '--epub-subdirectory=[specify the subdirectory in the OCF container that is to hold the EPUB-specific contents]:dir:{_files -/}' \ + '--epub-subdirectory=[specify the subdirectory in the OCF container that is to hold the EPUB-specific contents]:directory:_files -/' \ '--epub-cover-image=[use the specified image as the EPUB cover]:file:_files' \ - '--epub-metadata=[look in the specified XML file for metadata for the EPUB]:file:{_files -g "*.xml"}' \ + '--epub-metadata=[look in the specified XML file for metadata for the EPUB]:file:_files -g "*.xml(-.)"' \ '*--epub-embed-font=[embed the specified font in the EPUB]:file:_files ' \ - '--epub-chapter-level=[specify the header level at which to split the EPUB into separate "chapter" files]:number:_pandoc_header_level' \ + '--epub-chapter-level=[specify the header level at which to split the EPUB into separate "chapter" files]:number:(1 2 3 4 5 6)' \ + '--ipynb-output=[specify how to tread ipynb output cells]:method:(all none best)' \ '--pdf-engine=[use the specified engine when producing PDF output]:program:_pandoc_pdf_engine' \ '*--pdf-engine-opt=[use the given string as a command-line argument to the pdf-engine]:string:_pandoc_pdf_engine_opts' \ - '*--bibliography=[set the bibliography field in the document'"'"'s metadata to FILE]:file:{_files -g "*.{bib,bibtex,copac,json,yaml,enl,xml,wos,medline,mods,ris}"}' \ - '--csl=[set the csl field in the document'"'"'s metadata to FILE]:file:{_files -g "*.csl"}' \ + "*--bibliography=[set the bibliography field in the document's metadata to specified file]:file:_files -g '*.(bib|bibtex|copac|json|yaml|enl|xml|wos|medline|mods|ris)(-.)'" \ + "--csl=[set the csl field in the document's metadata to specified file]:file:_files -g '*.csl(-.)'" \ '--citation-abbreviations=[set the citation-abbreviations field in the document'"'"'s metadata to FILE]:file:_files' \ '--natbib[use natbib for citations in LaTeX output]' \ '--biblatex[use biblatex for citations in LaTeX output]' \ '--mathml[convert TeX math to MathML (in epub3, docbook4, docbook5, jats, html4 and html5)]' \ - '--webtex=[convert TeX formulas to <img> tags that link to an external script that converts formulas to images]::url: ' \ - '--mathjax=[use MathJax to display embedded TeX math in HTML output]::url: ' \ - '--katex=[use KaTeX to display embedded TeX math in HTML output]::url: ' \ - {-m,--latexmathml=,--asciimathml=}'[deprecated. Use the LaTeXMathML script to display embedded TeX math in HTML output]::url: ' \ - '--mimetex=[deprecated. Render TeX math using the mimeTeX CGI script, which generates an image for each TeX formula]::url: ' \ - '--jsmath=[deprecated. Use jsMath (the predecessor of MathJax) to display embedded TeX math in HTML output]::url: ' \ - '--gladtex[deprecated. Enclose TeX math in <eq> tags in HTML output]: : ' \ - '--abbreviations=[specifies a custom abbreviations file]:file:_files ' \ + '--webtex=[convert TeX formulas to <img> tags that link to an external script that converts formulas to images]:: :_urls' \ + '--mathjax=[use MathJax to display embedded TeX math in HTML output]:: :_urls' \ + '--katex=[use KaTeX to display embedded TeX math in HTML output]:: :_urls' \ + '--gladtex[Enclose TeX math in <eq> tags in HTML output]' \ '--trace[enable tracing]' \ '--dump-args[print information about command-line arguments to stdout, then exit]' \ '--ignore-args[ignore command-line arguments (for use in wrapper scripts)]' \ '--verbose[give verbose debugging output]' \ '--quiet[suppress warning messages]' \ '--fail-if-warnings[exit with error status if there are any warnings]' \ - '--log=[write log messages in machine-readable JSON format to FILE]:file:_file' \ + '--log=[write log messages in machine-readable JSON format to FILE]:file:_files' \ '(- :)--bash-completion[generate a bash completion script]' \ '(- :)--list-input-formats[list supported input formats, one per line]' \ '(- :)--list-output-formats[list supported output formats, one per line]' \ diff --git a/Completion/Unix/Command/_patchutils b/Completion/Unix/Command/_patchutils index 50ea3e4c4..a5f6441b1 100644 --- a/Completion/Unix/Command/_patchutils +++ b/Completion/Unix/Command/_patchutils @@ -85,6 +85,7 @@ case $service in '(-H --with-filename -h --no-filename)'{-h,--no-filename}"[don't print the name of the patch file containing each patch]" '(-f --file)'{-f+,--file=}'[read regular expressions from file]:file:_files' '--output-matching=[display the matching hunk- or file-level diffs]:level:(hunk file)' + '--only-match=[restrict regex to matching removals, additions or modifications]:limit:(rem removals add additions mod modifications all)' ) ;; splitdiff) diff --git a/Completion/Unix/Command/_pbm b/Completion/Unix/Command/_pbm index 62004f79e..8b5576c5f 100644 --- a/Completion/Unix/Command/_pbm +++ b/Completion/Unix/Command/_pbm @@ -740,7 +740,7 @@ ppmtomitsu) _arguments \ '-sharpness:sharpness:(1 2 3 4)' \ '-enlarge:enlargement factor:(1 2 3)' \ - '-media:output media (default\: 1184x1350):((A\:1216x1350 A4\:1184x1452 AS\:1216x1650 A4S\:1184x1754))' \ + '-media:output media [1184x1350]:((A\:1216x1350 A4\:1184x1452 AS\:1216x1650 A4S\:1184x1754))' \ '-copy:number of copies:(1 2 3 4 5 6 7 8 9)' \ -{dpi300,tiny} ':file:_pbm' ;; diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce index 0d007e3bc..a52ac1d06 100644 --- a/Completion/Unix/Command/_perforce +++ b/Completion/Unix/Command/_perforce @@ -1354,7 +1354,7 @@ _perforce_fstat_fields() { ${${${${(M)${(f)"$(_perforce_call_p4 help-fstat help fstat)"}:#[[:blank:]]#[a-zA-Z]##(|\#)[[:blank:]]##--*}##[[:blank:]]#}:#fstat *}//[[:blank:]]##--[[:blank:]]##/:} ) compset -P '*[,[:blank:]]' - _describe -t fstat-fields 'Perforce fstat fields' values -S, -q + _describe -t fstat-fields 'Perforce fstat field' values -S, -q } @@ -2551,7 +2551,7 @@ _perforce_cmd_logstat() { (( $+functions[_perforce_cmd_logtail] )) || _perforce_cmd_logtail() { _arguments -s : \ - '-b[specify block size, default 8192]:block size: ' \ + '-b[specify block size]:block size [8192]' \ '-s[specify start offset]:offset: ' \ '-m[specify max blocks]:max blocks: ' } @@ -2668,12 +2668,12 @@ _perforce_cmd_passwd() { _perforce_cmd_ping() { _arguments -s : \ '-c[specify count of messages]:count of messages: ' \ - '-t[specify total time of test]:time in seconds: ' \ + '-t[specify total time of test]:time (seconds)' \ '-i[specify iterations for test]:number of iterations: ' \ '-f[transmit continuously without waiting for responses]' \ - '-p[specify pause between tests]:pause in seconds: ' \ - '-s[specify send size]:send size in octets: ' \ - '-r[specify receive size]:receive size in octets: ' + '-p[specify pause between tests]:pause (seconds)' \ + '-s[specify send size]:send size (octets)' \ + '-r[specify receive size]:receive size (octets)' } @@ -2942,7 +2942,7 @@ _perforce_cmd_status() { _perforce_cmd_sizes() { _arguments -s : \ '-a[list all revisions in range]' \ - '-b[specify blocksize]:blocksize in bytes: ' \ + '-b[specify blocksize]:blocksize (bytes)' \ '(-H)-h[print sizes in human-readable form (GiB)]' \ '(-h)-H[print sizes in human-readable form (GB)]' \ '-m[limit max files]:max files: ' \ diff --git a/Completion/Unix/Command/_perl b/Completion/Unix/Command/_perl index 0914264fe..d7e8f1b51 100644 --- a/Completion/Unix/Command/_perl +++ b/Completion/Unix/Command/_perl @@ -1,14 +1,10 @@ #compdef perl -# -# zsh completion code for the Perl interpreter -# Adam Spiers <adam@spiers.net> -# -# Completions currently based on Perl 5.14.1. + typeset -A opt_args _perl () { _arguments -s \ - '-0-[input record separator ($/)]:$/ in octal or hex (\0, if no argument)' \ + '-0-[input record separator ($/)]:: :_perl_input_seps' \ '-a[autosplit mode with -n or -p (splits $_ into @F)]' \ '-C-[control some unicode features]: :_perl_unicode_flags' \ "-c[check syntax only (runs BEGIN and END blocks)]" \ @@ -24,7 +20,7 @@ _perl () { '-h[list help summary]' \ '-i-[edit <> files in place (make backup if extension supplied)]:backup file extension: ' \ '*-I-[specify @INC/#include directory (may be used more than once)]:include path:_files -/' \ - '-l-[enable line ending processing, specifies line terminator]:output record separator in octal: ' \ + '-l-[enable line ending processing, specifies line terminator]:: :_perl_output_seps' \ \*{-m,-M}"-[module.. executes \`use/no module...' before executing your script]:module:_perl_m_opt" \ "-n[assume 'while (<>) { ... }' loop around your script]" \ "-p[assume loop like -n but print line also like sed]" \ @@ -35,7 +31,7 @@ _perl () { "-u[dump core after parsing script]" \ "-U[allow unsafe operations]" \ "-v[print version, patchlevel and license]" \ - "-V-[print perl configuration information]:configuration keys:_perl_config_vars" \ + "-V-[print perl configuration information]:configuration key:_perl_config_vars" \ '( -W -X)-w[turn warnings on for compilation of your script (recommended)]' \ "(-w -X)-W[enable all warnings (ignores 'no warnings')]" \ "(-w -W )-X[disable all warnings (ignores 'use warnings')]" \ @@ -63,6 +59,27 @@ _perl_m_opt () { fi } +_perl_input_seps() { + if [[ $#PREFIX -eq 1 && $PREFIX != [0-9a-zA-Z] ]]; then + # convert a non-octal or potential option character into octal representation + compadd -i "$IPREFIX" -U $(( [##8] ##$PREFIX )) + else + _describe -x -t separators "input record separator, $/ in octal or hex (\0, if no argument) [\n]" '( + 0:paragraph\ mode + 777:slurp\ whole\ input\ files + )' || _comp_mesg=yes + fi +} + +_perl_output_seps() { + if [[ $#PREFIX -eq 1 && $PREFIX != [0-9a-zA-Z] ]]; then + # convert a non-octal or potential option character into octal representation + compadd -i "$IPREFIX" -U $(( [##8] ##$PREFIX )) + else + _message -e separators "output record separator, $\\ in octal or hex [$/]" + fi +} + _perl_config_vars () { if (( ! $+_perl_config_vars )); then _perl_config_vars=( $(perl -MConfig -e 'print join("\n", keys %Config);') ) @@ -79,45 +96,49 @@ _perl_config_vars () { } _perl_unicode_flags () { - _values -s '' 'unicode bitmask or flags' \ - 'I[ 1 STDIN is assumed to be in UTF-8]' \ - 'O[ 2 STDOUT will be in UTF-8]' \ - 'E[ 4 STDERR will be in UTF-8]' \ - 'S[ 7 I + O + E]' \ - 'i[ 8 UTF-8 is the default PerlIO layer for input streams]' \ - 'o[ 16 UTF-8 is the default PerlIO layer for output streams]' \ - 'D[ 24 i + o]' \ + _values -s '' 'unicode bitmask or flag' \ + '(S)I[ 1 STDIN is assumed to be in UTF-8]' \ + '(S)O[ 2 STDOUT will be in UTF-8]' \ + '(S)E[ 4 STDERR will be in UTF-8]' \ + '(I O E)S[ 7 I + O + E]' \ + '(D)i[ 8 UTF-8 is the default PerlIO layer for input streams]' \ + '(D)o[ 16 UTF-8 is the default PerlIO layer for output streams]' \ + '(i o)D[ 24 i + o]' \ 'A[ 32 the @ARGV elements are expected to be strings encoded in UTF-8]' \ 'L[ 64 make "IOEioA" conditional on the locale environment variables]' \ 'a[256 set ${^UTF8CACHE} to -1, used for debugging]' \ } _perl_debugging_flags () { - _values -s '' 'debugging bitmask or flags' \ - 'p[ 1 Tokenizing and parsing (with v, displays parse stack)]' \ - 's[ 2 Stack snapshots (with v, displays all stacks)]' \ - 'l[ 4 Context (loop) stack processing]' \ - 't[ 8 Trace execution]' \ - 'o[ 16 Method and overloading resolution]' \ - 'c[ 32 String/numeric conversions]' \ - 'P[ 64 Print profiling info, preprocessor command for -P, source file input state]' \ - 'm[ 128 Memory and SV allocation]' \ - 'f[ 256 Format processing]' \ - 'r[ 512 Regular expression parsing and execution]' \ - 'x[ 1024 Syntax tree dump]' \ - 'u[ 2048 Tainting checks]' \ - 'U[ 4096 Unofficial, User hacking (reserved for private, unreleased use)]' \ - 'H[ 8192 Hash dump -- usurps values()]' \ - 'X[ 16384 Scratchpad allocation]' \ - 'D[ 32768 Cleaning up]' \ - 'S[ 66536 Thread synchronization]' \ - 'T[ 131072 Tokenising]' \ - 'R[ 262144 Include reference counts of dumped variables (eg when using -Ds)]' \ - 'J[ 524288 Do not s,t,P-debug (Jump over) opcodes within package DB]' \ - 'v[1048576 Verbose: use in conjunction with other flags]' \ - 'C[2097152 Copy On Write]' \ - 'A[4194304 Consistency checks on internal structures]' \ - 'q[8388608 quiet - currently only suppresses the "EXECUTING" message]' \ + _values -s '' 'debug flag or bitmask' \ + 'p[ 1 tokenizing and parsing (with v, display parse stack)]' \ + 's[ 2 stack snapshots (with v, display all stacks)]' \ + 'l[ 4 context (loop) stack processing]' \ + 't[ 8 trace execution]' \ + 'o[ 16 method and overload resolution]' \ + 'c[ 32 string/numeric conversions]' \ + 'P[ 64 print profiling info, source file input state]' \ + 'm[ 128 memory and SV allocation]' \ + 'f[ 256 format processing]' \ + 'r[ 512 regular expression parsing and execution]' \ + 'x[ 1024 syntax tree dump]' \ + 'u[ 2048 tainting checks]' \ + 'U[ 4096 unofficial, user hacking (reserved for private, unreleased use)]' \ + 'X[ 16384 scratchpad allocation]' \ + 'D[ 32768 cleaning up]' \ + 'S[ 66536 Op slab allocation]' \ + 'T[ 131072 tokenising]' \ + 'R[ 262144 include reference counts of dumped variables (e.g. when using -Ds)]' \ + "J[ 524288 show s,t,P-debug (don't jump over) on opcodes within package DB]" \ + 'v[ 1048576 verbose: use in conjunction with other flags]' \ + 'C[ 2097152 copy-on-write]' \ + 'A[ 4194304 consistency checks on internal structures]' \ + 'q[ 8388608 quiet - currently only suppresses the "EXECUTING" message]' \ + 'M[ 16777216 trace smart match resolution]' \ + 'B[ 33554432 dump subroutine definitions, including special blocks like BEGIN]' \ + 'L[ 67108864 trace locale-related info]' \ + 'i[134217728 trace PerlIO layer processing]' \ + 'y[268435456 trace y///, tr/// compilation and execution]' } _perl "$@" diff --git a/Completion/Unix/Command/_perldoc b/Completion/Unix/Command/_perldoc index 3e58d5a50..b724d74ee 100644 --- a/Completion/Unix/Command/_perldoc +++ b/Completion/Unix/Command/_perldoc @@ -3,7 +3,7 @@ local curcontext="$curcontext" state line expl args ret=1 typeset -A opt_args -args=( '*:Perl pod pages:->perl-pods' ) +args=( '*:Perl pod page:->perl-pods' ) if [[ $service = *PERLDOC* ]]; then compset -q @@ -46,7 +46,7 @@ case $state in perl-pods) if (( $+opt_args[-F] )); then - _wanted files expl 'Perl modules and .pods' \ + _wanted files expl 'Perl module or .pod' \ _files -g "*.(pod|pm)(-.)" && ret=0 else _alternative \ diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep index 3b4d082a7..9c3ddf039 100644 --- a/Completion/Unix/Command/_pgrep +++ b/Completion/Unix/Command/_pgrep @@ -5,8 +5,6 @@ # (which changed the behaviour of -f and added -a) # - We don't really need to keep pgopts and pkopts separate, but it seems like # it should make things a bit easier to follow -# - @todo We could complete log-in classes given to -c -# - @todo We could complete routing tables given to -T local curcontext="$curcontext" state line ret=1 expl pgopts pkopts no typeset -A opt_args @@ -18,7 +16,7 @@ typeset -a arguments sig_arguments aopts # overridden below arguments=( '-a[include process ancestors in match list]' - '-c+[match only on specified login class]:login class' + '-c+[match only on specified login class]:login class:_login_classes' '(-F --pidfile)'{-F+,--pidfile=}'[match only processes in specified PID file]:PID file:_files' '(-f --full)'{-f,--full}'[match against full command line]' '(-G --group)'{-G+,--group=}'[match only on specified real group IDs]: :_sequence _groups' @@ -32,13 +30,15 @@ arguments=( '(-M)-N+[extract name list from specified system]:system file:_files' '(-o -n --oldest --newest)'{-n,--newest}'[match newest process]' '(-o -n --oldest --newest)'{-o,--oldest}'[match oldest process]' + '(-O --older)'{-O+,--older=}'[select where older than specified age]:age (seconds)' '(-P --parent)'{-P+,--parent=}'[match only on specified parent process IDs]: :->ppid' '(-l)-q[suppress normal output]' + '(-r --runstates)'{-r+,--runstates}'[match runstates]:run state:compadd -S "" D I R S T t W X Z' '-S[search also in system processes (kernel threads)]' '(-s --session)'{-s+,--session=}'[match only on specified process session IDs]: :->sid' # _signals is OK here - we do it differently below '(ss)--signal=[specify signal to send to process]: :_signals -s' - '-T+[match only on specified routing table]:routing table' + '-T+[match only on specified routing table]:routing table:_routing_tables' '(-t --terminal)'{-t+,--terminal=}'[match only on specified controlling terminals]: :_sequence _ttys -do' '(-U --uid)'{-U+,--uid=}'[match only on specified real user IDs]: :_sequence _users' '(-u --euid)'{-u+,--euid=}'[match only on specified effective user IDs]: :_sequence _users' @@ -62,8 +62,8 @@ arguments=( case $OSTYPE in linux*) # Note: We deliberately exclude -v but not --inverse from pkill - pgopts=acdFfGghLlnoPstUuVvwx- - pkopts=ceFfGghLnoPstUuVx- + pgopts=acdFfGghLlnoOPrstUuVvwx- + pkopts=ceFfGghLnoOPstUuVx- arguments=( ${arguments:#((#s)|*\))(\*|)-[acl]*} '(-c --count)'{-c,--count}'[display count of matching processes]' @@ -125,6 +125,10 @@ else fi fi +if [[ $OSTYPE = dragonfly* ]]; then + arguments+=( '(-t)-T[match only processes associated with the current terminal]' ) +fi + arguments+=( $sig_arguments + o '*: :->pname' ) [[ $OSTYPE == linux* ]] || aopts+=( -A '*-' ) @@ -149,7 +153,7 @@ case $state in _pgrep_sequence ppids 'parent process ID' ppid ;; (pgid) - _pgrep_sequence pgids 'process group ID' pgid + _sequence _pgids ;; (projid) _pgrep_sequence project-ids 'project ID' project @@ -163,11 +167,21 @@ case $state in (pname) local ispat="pattern matching " if (( ${+opt_args[-x]} )); then - ispat="" + ispat+="full " fi if (( ${+opt_args[-f]} )); then - _wanted process-args expl $ispat'process command line' \ - compadd ${${(f)"$(_call_program process-args ps -A -o args=)"}% *} + local -a opts=( -lf ) + [[ $OSTYPE == linux* ]] && opts=( -a ) + local -a matches=( ${(f)"$( + _call_program process-args pgrep ${(@q)opts} -- \ + ${(q)${${:-$PREFIX$SUFFIX}:-.\*}} + )"} ) + local -a displ=( "${${matches[@]//:/\:}[@]/ /:}" ) + matches=( "${matches[@]##<-> }" ) + + local desc=$ispat'process command line' + _description process-args expl "$desc" + _describe -t process-args "$desc" displ matches "$@" -U "$expl[@]" else _wanted processes-names expl $ispat'process name' _process_names -a -t fi diff --git a/Completion/Unix/Command/_php b/Completion/Unix/Command/_php index c4c4ab3e2..9a8f519b1 100644 --- a/Completion/Unix/Command/_php +++ b/Completion/Unix/Command/_php @@ -93,7 +93,7 @@ _php() { + '(hv)' # Help/version options; kept separate by convention '(- 1 *)'{-h,--help}'[display help information]' '(- 1 *)'{-v,--version}'[display version information]' - '!(- 1 *)'{-\?,-\\\?,--usage} + '!(- 1 *)'{-\?,--usage} + '(im)' # Info/module options (exclusive with everything but -c/-n) '(fi mc pb pf rf rn sc sv *)'{-i,--info}'[display configuration information (phpinfo())]' diff --git a/Completion/Unix/Command/_ping b/Completion/Unix/Command/_ping index 274204264..d36a0f3a9 100644 --- a/Completion/Unix/Command/_ping +++ b/Completion/Unix/Command/_ping @@ -11,7 +11,6 @@ case ${variant}:${${service#ping}:-4} in args+=( '-d[set SO_DEBUG on the socket]' '-n[show network addresses as numbers]' - '-M+[define mtu discovery]:mtu discovery:(do dont want)' '-v[verbose output]' ) ;| @@ -35,7 +34,7 @@ case ${variant}:${${service#ping}:-4} in iputils:*|solaris:*|((free|net)bsd|darwin|dragonfly)*:4) args+=( '-r[bypass normal routing tables]' ) ;| - iputils:*|((free|net)bsd|darwin|dragonfly)*:4) + (iputils|freebsd<13->.*):*|(freebsd<-12>.|netbsd|darwin|dragonfly)*:4) args+=( '-a[audible bell for each packet]' ) ;| iputils:*|netbsd*:4|openbsd*) @@ -49,6 +48,9 @@ case ${variant}:${${service#ping}:-4} in (*bsd|darwin|dragonfly)*) args+=( '-I+[specify source interface for multicast packets]:interface:_net_interfaces' ) ;| + freebsd<13->.*|openbsd*) + args+=( '-H[try reverse-lookups of addresses]' ) + ;| freebsd*|darwin*|dragonfly*|netbsd*:6) args+=( '-S+[specify source address]:source address' ) ;| @@ -58,10 +60,13 @@ case ${variant}:${${service#ping}:-4} in (*bsd|darwin|dragonfly)*:4) args+=( "-D[set the don't fragment bit]" ) ;| + (freebsd|openbsd|darwin)*:6) + args+=( '-D[disable IPv6 fragmentation]' ) + ;| ((free|net)bsd|darwin|dragonfly)*:4) args+=( '-Q[somewhat quiet]') ;| - freebsd*:6|darwin*:6|solaris*|netbsd*) + freebsd<-12>.*:6|darwin*:6|solaris*|netbsd*) args+=( '*-g+[specify gateway to use as the next hop to the destination]:gateway:_hosts' ) @@ -71,10 +76,14 @@ case ${variant}:${${service#ping}:-4} in ;| ((free|net)bsd|darwin|dragonfly)*:6) args+=( - '-a+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)' '-b+[set socket buffer size]:buffer size' - '-H[try reverse-lookups of IPv6 addresses]' '-N[probe node information multicast group address]' + ) + ;| + (freebsd<-12>.|netbsd|darwin|dragonfly)*:6) + args+=( + '-a+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)' + '-H[try reverse-lookups of IPv6 addresses]' '(-s)-t[generate ICMPv6 Node Information supported query types query]' '(-s)-w[generate ICMPv6 Node Information DNS Name query]' '!(-s)-W' ) @@ -91,30 +100,54 @@ case ${variant}:${${service#ping}:-4} in '-N+[specify a next-hop router that the probe packet should go through]:router:_hosts' ) ;| - (freebsd|darwin|dragonfly)*:4) + freebsd<13->.*:6|(freebsd|darwin|dragonfly)*:4) args+=( '-A[audible bell for no packet]' + '-t+[specify timeout after which ping exits]:deadline (seconds)' + '-W+[specify time to wait for a response]:wait time (ms)' + ) + ;| + (freebsd|darwin|dragonfly)*:4) + args+=( '-G+[specify maximum size for ICMP payload for sweeping pings]:size' '-g+[specify minimum size for ICMP payload for sweeping pings]:size [0]' '-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|openbsd|darwin)*:6) - args+=( '-D[disable IPv6 fragmentation]' ) - ;| - (freebsd|darwin)*:6) + (freebsd<-12>.*|darwin*):6) args+=( '-R[audible bell for no packet]' '-r[audible bell for each packet]' ) ;| - freebsd*:6) + (iputils|freebsd<13->.*):4) + args+=( + '(-F -N)-4[use IPv4 only]' + '-6[use IPv6 only]' + ) + ;| + freebsd<13->.*:4) + args+=( + '-C+[add an 802.1p Ethernet Priority Code Point when sending a packet]:pcp:(-1 0 1 2 3 4 5 6 7)' + ) + ;| + freebsd<13->.*:6) + args+=( + '*-e+[specify gateway to use as the next hop to the destination]:gateway:_hosts' + '-k+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)' + '(-s)-O[generate ICMPv6 Node Information supported query types query]' + '*-u[suppress fragmentation to minimum MTU]' + '(-s)-Y[generate ICMPv6 Node Information DNS Name query with old packet format]' + '(-s)-y[generate ICMPv6 Node Information DNS Name query]' + '-E[enable transport-mode IPsec encapsulated security payload]' + '-Z[enables transport-mode IPsec authentication header]' + ) + ;| + freebsd<-12>.*:6) args+=( '-x+[specify time to wait for a response]:wait time (ms)' '-X+[specify timeout after which ping exits]:deadline (seconds)' @@ -154,19 +187,13 @@ case ${variant}:${${service#ping}:-4} in ;; openbsd*) args+=( - '-H[try reverse-lookups of addresses]' '-E[audible bell for no packet]' '-e[audible bell for each packet]' + '-g[provide a visual display of packets received and lost]' '-T+[change TOS value]:TOS value:(critical inetcontrol lowdelay netcontrol throughput reliability ef af cs)' - '-V+[specify routing table to be used]:routing table' + '-V+[specify routing table to be used]:routing table:_routing_tables' ) ;; - iputils:4) - args+=( - '(-F -N)-4[use IPv4 only]' - '-6[use IPv6 only]' - ) - ;| iputils:*) args+=( '-A[adaptive]' diff --git a/Completion/Unix/Command/_pip b/Completion/Unix/Command/_pip new file mode 100644 index 000000000..bafc7f9e9 --- /dev/null +++ b/Completion/Unix/Command/_pip @@ -0,0 +1,213 @@ +#compdef -P pip[0-9.]# + +# To get completion of installable packages, do: +# pip install pip-cache +# and then run: +# pip-cache update + +local curcontext="$curcontext" ret=1 +local -a state state_descr line +local -A opt_args +local python pip +local -a args subcommands packages + +pip=${words[1]} +python=${${pip}/pip/python} +[[ $python == $pip ]] && python=python + +args=( + '(* : -)'{-h,--help}'[display usage information]' + '--isolated[ignore environment variables and user configuration]' + \*{-v,--verbose}'[give more output]' + \*{-q,--quiet}"[give less output]" + '--log=[specify log file where a complete record will be kept]:file:_files' + '--proxy=[specify a proxy]:proxy ([user\:passwd@]proxy.server\:port)' + '--retries=[specify maximum number of retries each connection should attempt]:retries [5]' + '--timeout=[set the socket timeout]:timeout (seconds) [15]' + '--exists-action=[specify action when a path already exists]:action:((s\:switch i\:ignore w\:wipe b\:backup a\:abort))' + '--cert=[specify path to alternate CA bundle]:path:_files' + '--client-cert=[specify path to SSL client certificate]:certificate file:_files' + '(--no-cache-dir)--cache-dir=[specify location to store the cache data]: :_directories' + '(--cache-dir)--no-cache-dir[disable the cache]' + "--disable-pip-version-check[don't check whether a new version of pip is available]" +) + +subcommands=( + 'install:install packages' + 'download:download packages' + 'uninstall:uninstall packages' + 'freeze:output installed packages in requirements format' + 'list:list installed packages' + 'show:show information about installed packages' + 'check:verify installed packages have compatible dependencies' + 'search:search PyPI for packages' + 'wheel:build wheels from your requirements' + 'hash:compute hashes of package archives' + 'help:show available commands' +) + +_arguments -C $args \ + '(* : -)'{-V,--version}'[display version information]' \ + ':subcommand:->subcommand' \ + '*::options:->options' && ret=0 + +case $state in + subcommand) + _describe -t subcommands 'pip subcommand' subcommands && ret=0 + ;; + + options) + curcontext="${curcontext%:*}-$words[2]:" + + case $words[1] in + download|install|list|wheel) + args+=( + '--pre[include pre-release and development versions]' + '(-i --index-url)'{-i+,--index-url=}'[base URL of Python Package Index]:url:_urls' + '--extra-index-url=[extra URLs of package indexes to use in addition to --index-url]:url:_urls' + '--no-index[ignore package index (only looking at --find-links URLs instead)]' + '(-f --find-links)'{-f+,--find-links=}'[parse specified URL or HTML file for links to packages]:URL or file:_files -g "*.htm(|l)(-.)"' + '--process-dependency-links[enable the processing of dependency links]' + ) + ;| + download|(un|)install|freeze|wheel) + args+=( + '(-r --requirement)'{-r+,--requirement=}'[all the packages listed in the given requirements file]:requirements file:_files -g "(requirement*|*.txt)(-.)"' + ) + ;| + download|install|wheel) + args+=( + '!--use-wheel' '!--no-use-wheel' + "*--no-binary=[don't use binary packages]: :->package_list" + "*--only-binary=[don't use source packages]: :->package_list" + \*{-c+,--constraint=}'[constrain versions using the given constraints file]:constraints file:_files' + '(-e --editable)'{-e+,--editable=}'[install a package directly from a checkout]:directory or VCS+REPOS_URL[@REV]#egg=PACKAGE:_files -/' + '--src=[check out --editable packages into given directory]: :_directories' + '--ignore-requires-python[ignore the Requires-Python information]' + "--no-deps[don't install package dependencies]" + '(-b --build)'{-https://cloud.kiddleb+,--build=}'[specify directory to unpack packages into]: :_directories' + '--global-option=[extra global options to be supplied to the setup.py call before the install command]:options' + "--no-clean[don't clean up build directories]" + '--require-hashes[require a hash to check each requirement against]' + ) + ;| + + download) + args+=( + '(-d --dest)'{-d+,--dest=}'[download packages into given directory]: :_directories' + '--platform=[only download wheels compatible with platform]::platform' + '--python-version=[only download wheels compatible with specified Python interpreter version]:version' + '--implementation=[only download wheels compatible with specified Python implementation]:implementation:(pp jy cp ip py)' + ) + ;; + + install) + args+=( + '(-t --target)'{-t+,--target=}'[specify directory to install packages into]: :_directories' + '(-d --download)'{-d+,--download=}'[download packages into directory instead of installing them]: :_directories' + '(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' + '--upgrade-strategy=[determine how dependency upgrading should be handled]:strategy:(eager only-if-needed)' + '--force-reinstall[when upgrading, reinstall all packages even if they are already up-to-date]' + '(-I --ignore-installed)'{-I,--ignore-installed}'[ignore installed packages]' + "--no-install[download and unpack all packages, but don't actually install them]" + "--no-download[don't download any packages, just install the ones already downloaded]" + '--install-option=[extra arguments to be supplied to the setup.py install command]:options' + '--user[install to the user install directory, typically ~/.local]' + '--egg[install as self contained egg file, like easy_install does]' + '--root=[install everything relative to this alternate root directory]: :_directories' + '--strip-file-prefix=[strip given prefix from script paths in wheel RECORD]:prefix' + '--prefix=[specify installation prefix where lib, bin and other top-level folders are placed]: :_directories' + '(--no-compile)--compile[compile py files to pyc]' + "(--compile)--no-compile[don't compile py files to pyc]" + '*:package name:->packages_or_dirs' + ) + ;; + + uninstall) + args+=( + '(-y --yes)'{-y,--yes}"[don't ask for confirmation of uninstall deletions]" + ':installed package:->installed_packages' + ) + ;; + + freeze) + args+=( + '(-f --find-links)'{-f+,--find-links=}'[specify URL to look for packages at]:url:_urls' + '(-l --local)'{-l,--local}"[if in a virtualenv that has global access, don't list globally-installed packages]" + '--user[only output packages installed in user-site]' + '--all[include pip, setuptools, distribute and wheel in output]' + ) + ;; + + hash) + args+=( + '(-a --algorithm)'{-a+,--algorithm=}'[specify hash algorithm]:algorithm:(sha256 sha384 sha512)' + '*: :_files' + ) + ;; + + list) + args+=( + '(-o --outdated -u --uptodate)'{-o,--outdated}'[list outdated packages (excluding editables)]' + '(-u --uptodate -o --outdated)'{-u,--uptodate}'[list uptodated packages (excluding editables)]' + '(-e --editable)'{-e,--editable}'[list editable projects]' + '(-l --local)'{-l,--local}"[if in a virtualenv that has global access, don't list globally-installed packages]" + '--user[only output packages installed in user-site]' + '--format=[select the output format]:format [legacy]:(legacy columns freeze json)' + '--not-required[list packages that are not dependencies of installed packages]' + ) + ;; + + show) + args+=( + '(-f --files)'{-f,--files}'[show the full list of installed files for each package]' + ':installed package:->installed_packages' + ) + ;; + + search) + args+=( + '(-i --index)'{-i+,--index=}'[specify base URL of Python Package Index]:URL:_urls' + ) + ;; + + wheel) + args+=( + '(-w --wheel-dir)'{-w+,--wheel-dir=}"[build wheels into given directory]: :_directories" + "--build-option=[extra arguments to be supplied to 'setup.py bdist_wheel']:options" + ) + ;; + + help) + _describe -t subcommands 'pip subcommand' subcommands + return + ;; + + *) args+=( '*: :_default' ) ;; + esac + + _arguments -s -S $args && ret=0 + + case $state in + package_list) + packages=( ${(f)"$(_call_program packages pip-cache pkgnames)"} ) + _sequence _wanted packages expl package compadd - -a packages && ret=0 + ;; + + packages_or_dirs) + [[ -prefix - ]] || packages=( ${(f)"$(_call_program packages pip-cache pkgnames)"} ) + _alternative \ + 'all-packages:package:compadd -a packages' \ + 'directories:directory with setup.py:_directories' && ret=0 + ;; + + installed_packages) + packages=( $(_call_program fetch-installed \ + "env COMP_WORDS='pip uninstall' COMP_CWORD=2 PIP_AUTO_COMPLETE=1 $pip") ) + _wanted installed-packages expl 'installed package' compadd -a packages && ret=0 + ;; + esac + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_pkginfo b/Completion/Unix/Command/_pkginfo index 6c71082ef..eca9e057e 100644 --- a/Completion/Unix/Command/_pkginfo +++ b/Completion/Unix/Command/_pkginfo @@ -1,22 +1,18 @@ #compdef pkginfo -_pkginfo() { - _arguments -s \ - '(-q -r -x)-l[long listing]' \ - '(-l -r -x)-q[quiet mode]' \ - '(-l -q -x)-r[relocation base]' \ - '(-l -q -r)-x[extracted listing]' \ - '-c[category]:category: ' \ - '-a[architecture]:architecture: ' \ - '-v[version]:version: ' \ - - set1 \ - '(-p)-i[select completely installed packages]' \ - '(-i)-p[select partially installed packages]' \ - '-R[root path]:root path:_files -/' \ - '*:package instance:_pkg_instance --_opts installed:set1--R' \ - - set2 \ - '-d[device]:device file:_files' \ - '*:package instance:_pkg_instance --_opts uninstalled:set2--d' -} - -_pkginfo "$@" +_arguments -s \ + '(-q -r -x)-l[long listing]' \ + '(-l -r -x)-q[quiet mode]' \ + '(-l -q -x)-r[relocation base]' \ + '(-l -q -r)-x[extracted listing]' \ + '-c[category]:category' \ + '-a[architecture]:architecture' \ + '-v[version]:version' \ + - set1 \ + '(-p)-i[select completely installed packages]' \ + '(-i)-p[select partially installed packages]' \ + '-R[root path]:root path:_files -/' \ + '*:package instance:_pkg_instance --_opts installed:set1--R' \ + - set2 \ + '-d[device]:device file:_files' \ + '*:package instance:_pkg_instance --_opts uninstalled:set2--d' diff --git a/Completion/Unix/Command/_pkgrm b/Completion/Unix/Command/_pkgrm index 25a950221..1191a2d1f 100644 --- a/Completion/Unix/Command/_pkgrm +++ b/Completion/Unix/Command/_pkgrm @@ -1,20 +1,16 @@ #compdef pkgrm -_pkgrm() { - _arguments -s \ - '-Y[select packages by category]:category: ' \ - - set1 \ - '-n[non-interactive mode]' \ - '-v[trace all scripts]' \ - '-a[admin file]:admin file:_files' \ - "-A[force removal of all files]" \ - "-M[don't use vfstab file]" \ - '-R[root path]:root path:_files -/' \ - '-V[alternate vfstab file]:vfstab file:_files' \ - '*:package instance:_pkg_instance --_opts installed:set1--R' \ - - set2 \ - '-s[spool package]:spool directory:_files -/' \ - '*:package instance:_pkg_instance --_opts spooled:set2--s' -} - -_pkgrm "$@" +_arguments -s \ + '-Y[select packages by category]:category' \ + - set1 \ + '-n[non-interactive mode]' \ + '-v[trace all scripts]' \ + '-a[admin file]:admin file:_files' \ + "-A[force removal of all files]" \ + "-M[don't use vfstab file]" \ + '-R[root path]:root path:_files -/' \ + '-V[alternate vfstab file]:vfstab file:_files' \ + '*:package instance:_pkg_instance --_opts installed:set1--R' \ + - set2 \ + '-s[spool package]:spool directory:_files -/' \ + '*:package instance:_pkg_instance --_opts spooled:set2--s' diff --git a/Completion/Unix/Command/_pr b/Completion/Unix/Command/_pr new file mode 100644 index 000000000..2aeeb13b3 --- /dev/null +++ b/Completion/Unix/Command/_pr @@ -0,0 +1,103 @@ +#compdef pr + +local curcontext=$curcontext variant msg ret=1 +local -a state state_descr line specs optA +typeset -A opt_args + +# take care of '+FIRST_PAGE[:LAST_PAGE]' (GNU) or '+FIRST_PAGE' (POSIX) +if _pick_variant -r variant gnu=GNU $OSTYPE --version; then + msg='FIRST_PAGE[:LAST_PAGE]' +else + msg='first page' +fi + +if [[ $words[CURRENT] = +* ]]; then + _message "$msg" && return +fi + +if (( ! ${words[(I)+[0-9]*]} )); then + # if +number is not on the command line + specs=( '(hv)--pages=[specify first and last page numbers]: : _message $msg' ) +fi + +# common specs +specs+=( + '(hv -a --across)'{-a,--across}'[with multi-column output, print columns across rather than down]' + '(hv -d --double-space)'{-d,--double-space}'[double space the output]' + '(hv -e --expand-tabs)'{-e-,--expand-tabs=-}'[expand tab (or specified char) with specified number of spaces]::number of spaces [8]:->char_number' + '(hv -h --header -t --omit-header)'{-h+,--header=}'[specify text used in header]:header: ' + '(hv -i --output-tabs)'{-i-,--output-tabs=-}'[replace specified number of spaces with tab (or specified char)]::number of spaces [8]:->char_number' + '(hv -l --length)'{-l+,--length=}'[specify the page length]:number of lines [66]: ' + '(hv -m --merge)'{-m,--merge}'[print all files in parallel, one in each column]' + '(hv -n --number-lines)'{-n-,--number-lines=-}'[number lines with specified separator and width]::number of digits [5]:->char_number' + '(hv -o --indent)'{-o+,--indent=}'[specify left margin]:margin [0]: ' + '(hv -r -no-file-warnings)'{-r,--no-file-warnings}'[omit warning when a file cannot be opened]' + '(hv -s --separator)'{-s-,--separator=-}'[specify column separator character]:character [tab]: ' + '(hv -t --omit-header -h --header)'{-t,--omit-header}'[omit page headers and trailers]' + '(hv -w --width)'{-w+,--width=}'[specify page width for multi-column output]:number of characters [72]: ' + '(hv)*: :_files' +) +# XXX: pr accepts -2 -3 -4 ... for specifying the number of columns. +# Here we offer only -2 and -3, and do so only if there is no +# -2 -3 -4 ... or --columns on the command line. +if (( ! ${words[(I)-([0-9]##*|-columns*)]} )); then + specs+=( {-2,-3}'[specify number of columns]' ) +fi + +if [[ $variant = gnu ]]; then + # GNU coreutils 8.32 + specs+=( + '(hv -c --show-control-chars)'{-c,--show-control-chars}'[use hat (^G) and octal backslash notation]' + '(hv -D --date-format)'{-D+,--date-format=}'[specify format for the header date]: :_date_formats' + '(hv -f -F --form-feed)'{-f,-F,--form-feed}'[use form feeds instead of newlines to separate pages]' + '(hv -J --join-lines)'{-J,--join-lines}'[merge full lines in multi-column output]' + '(hv -N --first-line-number)'{-N+,--first-line-number=}'[specify the line number of the 1st line]:number: ' + '(hv -S --sep-string)'{-S-,--sep-string=-}'[specify column separator string]:string: ' + '(hv -T --omit-pagination)'{-T,--omit-pagination}'[omit page headers and trailers, eliminate any pagination]' + '(hv -v --show-nonprinting)'{-v,--show-nonprinting}'[use octal backslash notation]' + '(hv -W --page-width)'{-W+,--page-width=}'[specify page width always]:number of characters [72]: ' + ) + if (( ! ${words[(I)-[0-9]##*]} )); then + # if -2 -3 -4 ... are not on the command line + specs+=( + '(hv)--columns=[specify number of columns]:number of columns: ' + + hv + '(- *)--help[display help and exit]' + '(- *)--version[output version information and exit]' + ) + fi +else + specs=( ${specs:#(|*\))--*} ) # remove long options + case $variant in + freebsd*|dragonfly*|darwin*|netbsd*) + specs+=( + '(-f)-F[use form feeds instead of newlines to separate pages]' + '(-F)-f[same as -F but pause before the 1st page if stdout is terminal]' + '-p[pause before each page if stdout is terminal]' + ) + ;| + freebsd*|dragonfly*|darwin*) + specs+=( '-L+[specify locale to use]: :_locales' ) + ;; + openbsd*) + specs+=( '(-f -F)'{-f,-F}'[use form feeds instead of newlines to separate pages]' ) + ;; + esac + optA=( -A '[-+]?*' ) # a single '-' is a valid file name (stdin) +fi + +_arguments -C -s -S $optA : $specs && ret=0 + +case $state in + char_number) + # argument for option -e (and -i, -n) can be -e. -e10 or -e.10 + # where . is any non-digit character + if compset -p 1; then + _message "$state_descr" && ret=0 + else + _message "a character [tab] (optional), and $state_descr" && ret=0 + fi + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_ps b/Completion/Unix/Command/_ps index 98dcd1cd0..9b54cbcc6 100644 --- a/Completion/Unix/Command/_ps +++ b/Completion/Unix/Command/_ps @@ -236,8 +236,8 @@ else [[ -z "$state" ]] && return ret fi -_values -s '' -S ' ' 'options' $bsd && ret=0 -_values -S ' ' 'options' $bsdarg && ret=0 +_values -s '' -S ' ' 'option' $bsd && ret=0 +_values -S ' ' 'option' $bsdarg && ret=0 if [[ -z $pids ]]; then _pids && ret=0 fi diff --git a/Completion/Unix/Command/_ptx b/Completion/Unix/Command/_ptx new file mode 100644 index 000000000..12f1d2c9a --- /dev/null +++ b/Completion/Unix/Command/_ptx @@ -0,0 +1,54 @@ +#compdef ptx + +local -a specs optA + +# common specs +specs=( + '(hv -b --break-file)'{-b+,--break-file=}'[use characters in specified file as word separators]:break file:_files' + '(hv -f --ignore-case)'{-f,--ignore-case}'[fold lower case to upper case for sorting]' + '(hv -g --gap-size)'{-g+,--gap-size=}'[specify gap size between output fields]:number of chars [3]: ' + '(hv -i --ignore-file)'{-i+,--ignore-file=}'[ignore keywords listed in specified file]:ignore file:_files' + '(hv -o --only-file)'{-o+,--only-file=}'[use only the keywords listed in specified file]:only file:_files' + '(hv -r --references)'{-r,--references}'[first field of each line is a reference]' + '(hv -w --width)'{-w+,--width=}'[specify page width, reference excluded]:number of characters [72]: ' +) + +if _pick_variant gnu=GNU unix --version; then + # GNU coreutils 8.32 + specs+=( + '(hv -A --auto-reference)'{-A,--auto-reference}'[output automatically generated references]' + '(hv -G --traditional)'{-G,--traditional}"[behave more like System V 'ptx']" + '(hv -F --flag-truncation)'{-F+,--flag-truncation=}'[specify string for flagging line truncations]:string [/]: ' + '(hv -M --macro-name)'{-M+,--macro-name=}"[specify macro name to use instead of 'xx']:macro name: " + '(hv)-O[generate output as roff directives]' + '(hv -R --right-side-refs)'{-R,--right-side-refs}'[put references at right, not counted in -w]' + '(hv -S --sentence-regexp)'{-S+,--sentence-regexp=}'[specify regexp for end of lines/sentences]:regexp: ' + '(hv)-T[generate output as TeX directives]' + '(hv -W --word-regexp -b --break-file)'{-W+,--word-regexp=}'[specify regexp to match each keyword]:regexp: ' + '(hv)--format=[specify the output format]:format:(roff tex)' + !{-t,--typeset-mode}'[not implemented]' + + hv + '(: * -)--help[display help and exit]' + '(: * -)--version[output version information and exit]' + ) + if (( $words[(I)(-G|--traditional)] )); then + specs+=( + arg '1:input file:_files' '2:output file:_files' ) + else + specs+=( + arg '(-G --traditional)*:input file:_files' ) + fi +else + # The only non-GNU implementation I can find is the one in + # heirloom-doctools. FreeBSD has a package for this. + specs=( ${specs:#(|*\))--*} ) # remove long options + # remove '+' from -b+ -g+ -i+ -o+ -w+ + local MATCH MBEGIN MEND + specs=( ${specs/(#m)-[bgiow]+/$MATCH[1,-2]} ) + specs+=( + '-t[prepare output for typesetter]' + '1:input file:_files' + '2:output file:_files' + ) + optA=( -A '-?*' ) # a single '-' is a valid file name (stdin) +fi + +_arguments -s -S $optA : $specs diff --git a/Completion/Unix/Command/_pv b/Completion/Unix/Command/_pv index 68f8e8586..d02d3a35d 100644 --- a/Completion/Unix/Command/_pv +++ b/Completion/Unix/Command/_pv @@ -25,7 +25,7 @@ _arguments -s -S $args \ '(-q --quiet)'{-q,--quiet}"[don't output any transfer information at all, useful with -L]" \ '(-W --wait)'{-W,--wait}'[display nothing until first byte transferred]' \ '(-D --delay-start -R --remote)'{-D+,--delay-start=}'[display nothing until delay has passed]:delay (seconds)' \ - '(-s --size)'{-s+,--size=}'[set estimated data size]:size (bytes):->size-unit' \ + '(-s --size)'{-s+,--size=}'[set estimated data size]: :_numbers -u bytes size K M G T' \ '(-l --line-mode -R --remote)'{-l,--line-mode}'[count lines instead of bytes]' \ '(-0 --null -l --line-mode)'{-0,--null}'[lines are null-terminated]' \ '(-i --interval)'{-i+,--interval=}'[update every after specified interval]:interval (seconds) [1]' \ @@ -34,8 +34,8 @@ _arguments -s -S $args \ '(-N --name)'{-N+,--name=}'[prefix visual information with given name]:name' \ '(-f --force -R --remote)'{-f,--force}'[output even if standard error is not a terminal]' \ '(-c --cursor -R --remote)'{-c,--cursor}'[use cursor positioning escape sequences]' \ - '(-L --rate-limit)'{-L+,--rate-limit=}'[limit transfer rate]:rate (bytes per second):->size-unit' \ - '(-B --buffer-size)'{-B+,--buffer-size=}'[use a buffer size of given size]:size (bytes):->size-unit' \ + '(-L --rate-limit)'{-L+,--rate-limit=}'[limit transfer rate]: :_numbers -u "bytes per second" rate K M G T' \ + '(-B --buffer-size)'{-B+,--buffer-size=}'[use a buffer size of given size]: :_numbers -u bytes size K M G T' \ '(-C --no-splice)'{-C,--no-splice}'[never use splice(), always use read/write]' \ '(-R --remote)*'{-E,--skip-errors}"[skip read errors in input${Edesc}]" \ '(-S --stop-at-size -R --remote)'{-S,--stop-at-size}'[stop after --size bytes have been transferred]' \ @@ -70,18 +70,6 @@ case $state in _pids $suf && ret=0 fi ;; - size-unit) - if compset -P '<->'; then - _tags values units - else - _tags values - fi - while _tags; do - _requested values && _message -e values "$state_descr" && ret=0 - _requested units expl unit compadd -o nosort - K M G T && ret=0 - (( ret )) || break - done - ;; esac return ret diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python index f10106f9b..e5bac18bb 100644 --- a/Completion/Unix/Command/_python +++ b/Completion/Unix/Command/_python @@ -1,7 +1,7 @@ #compdef -P python[0-9.]# # Python 2.7 -# Python 3.4 +# Python 3.9 local curcontext="$curcontext" state state_descr line typeset -A opt_args @@ -11,7 +11,9 @@ if _pick_variant python3=Python\ 3 python2 --version; then args=( '(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' '(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' + '--check-hash-based-pycs[configure how Python evaluates up-to-dateness of hash-based .pyc files]:mode:(always default never)' "-I[isolate Python from the user's environment]" + '-q[do not print version and copyright messages]' '-X[set implementation-specific option]:option' ) else @@ -37,7 +39,8 @@ _arguments -C -s -S "$args[@]" \ "-s[don't add user site directory to sys.path]" \ "-S[don't imply 'import site' on initialization]" \ '-u[unbuffered binary stdout and stderr]' \ - '-v[verbose (trace import statements)]' \ + '(-vv)-v[trace module initialization and cleanup]' \ + '(-v)-vv[in addition to -v, trace all files checked when searching for a module]' \ '(1 * -)-V[display version information]' \ '-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \ '-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \ diff --git a/Completion/Unix/Command/_qemu b/Completion/Unix/Command/_qemu index 3c21c3e74..7bc02c30c 100644 --- a/Completion/Unix/Command/_qemu +++ b/Completion/Unix/Command/_qemu @@ -6,7 +6,7 @@ _qemu_log_items () { [[ $hline[1] = Log ]] && continue opts=($opts "${hline[1]}[${hline[2,-1]}]") done - _values -s , 'log items' $opts + _values -s , 'log item' $opts } local _qemu_machines @@ -19,8 +19,8 @@ _arguments \ '-boot[specify which image to boot from]:boot device:((a\:floppy\ image\ a c\:hard\ disk d\:cdrom))' \ '-snapshot[write to temporary files instead of disk image files]' \ '-no-fd-bootchk[disable boot sig checking for floppies in Bochs BIOS]' \ - '-m[virtual RAM size (default=128)]:megs:' \ - '-smp[set the number of CPUs (default=1)]:number of CPUs:' \ + '-m[specify virtual RAM size]:size (MB) [128]' \ + '-smp[set the number of CPUs]:number of CPUs [1]' \ '-nographic[disable graphical output]' \ '-vnc[listen on VNC display]:display:' \ '-k[use keyboard layout]:keyboard layout language:(ar de-ch es fo fr-ca hu ja mk no pt-br sv da en-gb et fr fr-ch is lt nl pl ru th de en-us fi fr-be hr it lv nl-be pt sl tr)' \ @@ -45,7 +45,7 @@ _arguments \ '-s[wait gdb connection to port 1234]' \ '-p[change gdb connection port]:port:_ports' \ '-S[do not start CPU at startup]' \ - '-d[output log in /tmp/qemu.log]:log items:_qemu_log_items' \ + '-d[output log in /tmp/qemu.log]:log item:_qemu_log_items' \ '-hdachs[force hard disk 0 geometry (usually qemu can guess it)]:hd0 geometry c,h,s:' \ '-vga[select video card type]:card type:(std cirrus vmware qxl xenfb none)' \ '-no-acpi[disable ACPI]' \ diff --git a/Completion/Unix/Command/_quilt b/Completion/Unix/Command/_quilt index 76dda222f..01f8cfb83 100644 --- a/Completion/Unix/Command/_quilt +++ b/Completion/Unix/Command/_quilt @@ -6,6 +6,8 @@ local verbose='(-h)-v[verbose, more user friendly output]' local color='(-h)--color=[use syntax coloring]:color:(always auto never)' local pstyle='(-h)-p+[select patch style]:patch style:((0\:exclude\ top-level\ directory 1\:use\ .orig\ on\ top-level\ directory ab\:use\ a\ or\ b\ as\ top-level\ directory))' local -a pform rcfile +local k + pform=( '(-U -c -C -h)-u[create a unified diff]' '(-u -c -C -h)-U+[create a unified diff with num lines of context]:lines' @@ -34,25 +36,92 @@ _quilt_unapplied() { _arguments $help \ '--trace[run the command in bash trace mode]' \ - '--quiltrc=[use the specified configuration file]:files:_files' \ + '--quiltrc=[use the specified configuration file]:file:_files' \ '--version[print the version number and exit]' \ - ':quilt command:(add annotate applied delete diff edit files fold fork graph - grep header import mail new next patches pop previous push refresh remove - rename revert series setup snapshot top unapplied upgrade)' \ + ':quilt command:->cmd' \ '*:: :->subcmd' && return -[[ -z $state ]] && return 1 +case $state in + ('') + return 1 + ;; + + (cmd) + # Divide the subcommands to categories. The categorization is our own; + # it's not based on any preexisting categorization in the quilt docs. + local -a manip=( + add:'add files to a patch' + delete:'remove a patch from the series' + edit:'add files to the topmost patch and open them in $EDITOR' + fold:'integrate an external patch into the topmost patch' + fork:'replace the topmost patch with a copy' + import:'add external patches to the series' + new:'add an empty patch to the series' + refresh:'update a patch with in-tree edits' + remove:'remove files from a given patch' + rename:"change a patch's name" + ) + local -a tree=( + pop:'unapply a patch to the tree' + push:'apply a patch to the tree' + revert:'discard in-tree changes to files in a given patch' + ) + local -a other=( + grep:'print file lines matching pattern' + header:"print or change a patch's prologue" + mail:'send patches by email' + setup:'initialize a source tree' + snapshot:'save a snapshot of the tree to diff against' + upgrade:'upgrade quilt metadata' + ) + local -a interrogate=( + annotate:'show which patches modify which lines' + applied:'print the list of patches up to a given patch' + diff:'print differences between files' + files:'print the list of files that a given patch changes' + graph:'generate a patches dependency graph' + next:'print the name of the patch that follows a given patch' + patches:'print the list of patches that touch a given file' + previous:'print the name of the patch that precedes a given patch' + series:'print the list of all patches' + top:'print the name of the last applied patch' + unapplied:'print the list of patches following a given patch' + ) + local -A cmdtypes=( + [manip]='series manipulator commands' + [tree]='tree manipulator commands' + [other]='other commands' + [interrogate]='series interrogator commands' + ) + local ret=1 + _tags ${cmdtypes// /-} + while _tags; do + for k in ${(ok)cmdtypes}; do + if _requested ${cmdtypes[$k]// /-} + then + _describe -t ${cmdtypes[$k]// /-} ${cmdtypes[$k]} $k && + ret=0 + fi + done + done + return ret + ;; + + (subcmd) + ;; +esac + rcfile=( ${opt_args[--quiltrc]:+--quiltrc=${opt_args[--quiltrc]}} ) case $words[1] in add) _arguments -S $help \ '-P+[specify patch to add files to]:patch:_quilt_applied' \ - '*:files:_files' && return + '*:file:_files' && return ;; annotate) _arguments $help \ '-P[stop checking for changes at the specified rather than the topmost patch]:patch:_quilt_series' \ - ':files:_files' && return + ':file:_files' && return ;; applied) _arguments $help ':quilt series:_quilt_series' && return ;; delete) @@ -73,9 +142,9 @@ case $words[1] in '(-P -z)--snapshot[diff against snapshot]' \ '--diff=[use the specified utility for generating the diff]:diff utility:_command_names -e' \ '--sort[sort files by name]' \ - '*:files:_files' && return + '*:file:_files' && return ;; - edit) _arguments $help '*:files:_files' && return ;; + edit) _arguments $help '*:file:_files' && return ;; files) _arguments -s $help $verbose \ '-a[list all files in all applied patches]' \ @@ -118,14 +187,14 @@ case $words[1] in '-P+[patch filename to use inside quilt]:quilt select patch filename: ' \ '-f[overwrite/update existing patches]' \ '-d+[header resolution when overwriting in existing patch]:resolution:((a\:all\ headers n\:new\ headers o\:old\ headers))' \ - '*:files:_files' && return + '*:file:_files' && return ;; mail) _arguments $help \ '(-h -M)-m[introduction text to use]:introduction text' \ '(-h -m)-M[read introduction text from file]:file:_files' \ '--prefix=[use an alternate prefix in the bracketed part of the subjects generated]:quilt select prefix: ' \ - '--mbox=[store all messages in the specified file in mbox format]:files:_files' \ + '--mbox=[store all messages in the specified file in mbox format]:file:_files' \ '--send[send the messages directly]' \ '--sender=[specify envelope sender address to use]:sender:_email_addresses -c' \ '--from=[from header]:address:_email_addresses' \ @@ -133,13 +202,13 @@ case $words[1] in '*--to=[append a recipient to the To header]:recipient:_email_addresses' \ '*--cc=[append a recipient to the Cc header]:recipient:_email_addresses' \ '*--bcc=[append a recipient to the Bcc header]:recipient:_email_addresses' \ - '--signature=[append specified signature file to messages]:files:_files' \ + '--signature=[append specified signature file to messages]:file:_files' \ '--reply-to=[add reply address to message]:address:_email_addresses' \ '*:patch:_quilt_series' && return ;; new) _arguments $help $pstyle ':patch name' && return ;; next) _arguments $help ':patch:_quilt_series' && return ;; - patches) _arguments -S $help $verbose $color '*:files:_files' && return ;; + patches) _arguments -S $help $verbose $color '*:file:_files' && return ;; pop) _arguments -s $help $verbose \ '-a[remove all applied patches]' \ @@ -184,7 +253,7 @@ case $words[1] in revert) _arguments $help \ '-P[revert changes in the named patch]:patch:_quilt_series' \ - '*:files:_files' && return + '*:file:_files' && return ;; series) _arguments $help $verbose $color && return ;; setup) @@ -192,7 +261,9 @@ case $words[1] in '-d[specify path prefix for resulting source tree]:prefix:_files -W / -P /' \ '--sourcedir[specify location of package sources]:directory:_directories' \ '--fuzz=[set the maximum fuzz factor]:factor' \ - ':files:_files' && return + '(--fast)--slow[use the original, slow method to process the spec file]' \ + '(--slow)--fast[use an alternative, faster method to process the spec file]' \ + ':file:_files' && return ;; snapshot) _arguments $help '-d[only remove current snapshot]' && return ;; unapplied) _arguments $help ':patch:_quilt_series' && return ;; diff --git a/Completion/Unix/Command/_rake b/Completion/Unix/Command/_rake index 8814edaa5..10d621991 100644 --- a/Completion/Unix/Command/_rake +++ b/Completion/Unix/Command/_rake @@ -37,7 +37,9 @@ case "$state" in ;; target) local -a targets - targets=( ${${(f)"$(_call_program targets $words[1] -sT $opt_args[(I)(-N|--nosearch)] ${(kv)opt_args[(I)(-f|--rakefile)]} 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/${${match[1]}//:/\\:}:${match[2]:l}} ) + local all + zstyle -t ":completion:${curcontext}:targets" extended && all=-A + targets=( ${${(f)"$(_call_program targets $words[1] $all -sT $opt_args[(I)(-N|--nosearch)] ${(kv)opt_args[(I)(-f|--rakefile)]} 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/${${match[1]}//:/\\:}:${match[2]:l}} ) if (( ! ${targets[(I)rake aborted!]} )) then _describe -t targets 'rake target' targets && ret=0 else diff --git a/Completion/Unix/Command/_rar b/Completion/Unix/Command/_rar index 68982be60..d1d381974 100644 --- a/Completion/Unix/Command/_rar +++ b/Completion/Unix/Command/_rar @@ -4,6 +4,8 @@ local common expl common=( '-ad[append archive name to destination path]' + '-ad1[create a separate folder for files unpacked from each archive]' + "-ad2[like -ad1 but use archives' own folders]" '-ap[set path inside archive]' '-av\-[disable authenticity verification check]' '-c\-[disable comments show]' @@ -13,6 +15,7 @@ common=( '-dh[open shared files]' '-ep[exclude paths from name]' '-f[freshen files]' + '-idn[hide archived names]' '-idp[disable percentage display]' '-ierr[send all messages to stderr]' '-inul[disable all messages]' @@ -27,6 +30,7 @@ common=( '-tb+[process files modified before a date]:date (YYYYMMDDHHMMSS)' '-tn+[process files newer than a specified time]:time' '-to+[process files older than a specified time]:time' + '-ts-[save or restore time]:time:((m\:modification c\:change a\:access p\:preserve))' '-u[update files]' '-v[create volumes with size autodetection or list all volumes]' '-ver[file version control]' diff --git a/Completion/Unix/Command/_rclone b/Completion/Unix/Command/_rclone index 40f06e0ba..a2e3429f5 100644 --- a/Completion/Unix/Command/_rclone +++ b/Completion/Unix/Command/_rclone @@ -62,7 +62,7 @@ _arguments -C \ '--backup-dir[make backups into hierarchy based at specified directory]:directory:_directories' \ '--bind[specify socal address to bind to for outgoing connections]:IPv4, IPv6 or name' \ '--buffer-size[specify in memory buffer size when reading files for each --transfer]:size [16M]' \ - '--bwlimit[specify bandwidth limit]:BwTimetable (kBytes/s or b|k|M|G suffix)' \ + '--bwlimit[specify bandwidth limit]: :_numbers -u kBytes/s limit b k M G' \ '--cache-dir[specify directory rclone will use for caching]:directory [~/.cache/rclone]:_directories' \ '--checkers[specify number of checkers to run in parallel]:number [8]': \ '(-c --checksum)'{-c,--checksum}'[skip based on checksum & size, not mod-time & size]' \ @@ -79,7 +79,7 @@ _arguments -C \ '--dump-bodies[dump HTTP headers and bodies - may contain sensitive info]' \ '--dump-headers[dump HTTP headers - may contain sensitive info]' \ '--exclude[exclude files matching pattern]:stringArray' \ - '--exclude-from[read exclude patterns from file]:files:_files' \ + '--exclude-from[read exclude patterns from file]:file:_files' \ '--exclude-if-present[exclude directories if filename is present]:string' \ '--fast-list[use recursive list if available]' \ '--files-from[read list of source-file names from file]:file:_files' \ @@ -99,15 +99,15 @@ _arguments -C \ '--log-format[specify comma separated list of log format options]:string ["date,time"]' \ '--log-level[specify log level]:string [NOTICE]:(DEBUG INFO NOTICE ERROR)' \ '--low-level-retries[number of low level retries to do]:int [10]' \ - '--max-age[only transfer files younger than this in s or suffix ms|s|m|h|d|w|M|y]:duration [default off]' \ + '--max-age[only transfer files younger than specified age]: :_numbers -u seconds age ms\:milliseconds \:s\:seconds m\:minutes h\:hours d\:days w\:weeks M\:months y\:years' \ '--max-backlog[maximum number of objects in sync or check backlog]:int [10000]' \ '--max-delete[when synchronizing, limit the number of deletes]:delete limit [-1]' \ '--max-depth[limit the recursion depth]:depth [-1]' \ - '--max-size[only transfer files smaller than this in k or suffix b|k|M|G]:int [default off]' \ + '--max-size[only transfer files smaller than specified size]: :_numbers -u kBytes size \:k M G' \ '--max-transfer[maximum size of data to transfer]:int [default off]' \ '--memprofile[write memory profile to file]:file:_files' \ - '--min-age[only transfer files older than this in s or suffix ms|s|m|h|d|w|M|y]:duration [default off]' \ - '--min-size[only transfer files bigger than this in k or suffix b|k|M|G]:int [default off]' \ + '--min-age[only transfer files older than specified age]: :_numbers -u seconds age ms\:milliseconds \:s\:seconds m\:minutes h\:hours d\:days w\:weeks M\:months y\:years' \ + '--min-size[only transfer files bigger than specified size]: :_numbers -u kBytes size \:k M G' \ '--modify-window[specify max time delta to be considered the same]:duration [1ns]' \ '--multi-thread-cutoff[use multi-threaded downloads for files above specified size]:size (250M)' \ '--multi-thread-streams[specify max number of streams to use for multi-threaded downloads]:number (4)' \ @@ -339,8 +339,8 @@ _arguments -C \ if [[ $state == 'files_or_remotes' ]]; then remotes=( $(_call_program rclone-remotes rclone listremotes) ) _alternative \ - "remote:rclone-remotes:compadd -a remotes" \ - "file:files:_files" && ret=0 + "rclone-remotes:remote:compadd -a remotes" \ + "files:file:_files" && ret=0 fi return ret diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf index 42094742e..fc0fb7ce1 100644 --- a/Completion/Unix/Command/_readelf +++ b/Completion/Unix/Command/_readelf @@ -18,7 +18,7 @@ args=( '(-c --archive-index)'{-c,--archive-index}'[show symbol/file index in an archive]' \*{-x,--hex-dump=}"[dump contents of specified section as bytes]:section:($sections)" \*{-p,--string-dump=}"[dump contents of specified section as strings]:section:($sections)" - '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o R t U u T g A c k K)' + '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o O R t U u T g A c k K)' '--debug-dump=[show the contents of DWARF2 debug sections]::section:(rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges addr cu_index links follow-links)' '(-I --histogram)'{-I,--histogram}'[show histogram of bucket list lengths]' '(-W --wide)'{-W,--wide}'[allow output width to exceed 80 characters]' @@ -43,8 +43,19 @@ case $variant in '--dyn-syms[show dynamic symbol table]' ) ;| + elfutils|elftoolchain) + args+=( + '(-z --decompress)'{-z,--decompress}'[show compression information; decompress before dumping data]' + ) + ;| binutils) args+=( + '!(-C --demangle)--no-demangle' + '(--demangle)-C[decode symbol names]' + '(-C)--demangle=-[decode symbol names]::style [auto]:(auto gnu lucid arm hp edg gnu-v3 java gnat)' + '!(--no-recurse-limit)--recurse-limit' + '--no-recurse-limit[disable demangling recursion limit]' + '(-L --lint --enable-checks)'{-L,--lint,--enable-checks}'[display warning messages for possible problems]' \*{-R,--relocated-dump=}"[dump contents of specified section as relocated bytes]:section:($sections)" "--dwarf-depth=[don't show DIEs at greater than specified depth]:depth" '--dwarf-start=[show DIEs starting at specified depth or deeper]:depth' @@ -52,6 +63,7 @@ case $variant in '--ctf-parent=[use specified section as the CTF parent]:section' '--ctf-symbols=[use specified section as the CTF external symbol table]:section' '--ctf-strings=[use specified section as the CTF external string table]:section' + '(-T --silent-truncation)'{-T,--silent-truncation}"[if a symbol name is truncated, don't add ... suffix]" ) ;; elfutils) @@ -60,7 +72,6 @@ case $variant in '--elf-section[used specified section as ELF input data]::section' '(-e --exception)'{-e,--exception}'[show sections for exception handling]' '(-N --numeric-addresses)'{-N,--numeric-addresses}"[don't find symbol names for addresses in DWARF data]" - '(-z --decompress)'{-z,--decompress}'[show compression information; decompress before dumping data]' '(--symbols)-s[show symbol table]' '(-s)--symbols=-[show symbol table]::section:(.dynsym .symtab)' '(--notes)-n[show core notes (if present)]' diff --git a/Completion/Unix/Command/_renice b/Completion/Unix/Command/_renice index cbdac8cae..3b0457348 100644 --- a/Completion/Unix/Command/_renice +++ b/Completion/Unix/Command/_renice @@ -12,7 +12,7 @@ else _describe -o option opts && ret=0 case ${(v)words[(I)-?]} in - -g) _message -e pgids 'process group ID' && ret=0 ;; + -g) _pgids && ret=0 ;; -u) _users && ret=0 ;; *) _pids && ret=0;; esac diff --git a/Completion/Unix/Command/_ri b/Completion/Unix/Command/_ri index 070f46ac2..4d5a72985 100644 --- a/Completion/Unix/Command/_ri +++ b/Completion/Unix/Command/_ri @@ -6,26 +6,29 @@ typeset -A opt_args _arguments -C \ '(- *)'{-h,--help}'[print help information and exit]' \ '(- *)'{-v,--version}'[display the version of ri]' \ - '*'{-d,--doc-dir}'[directory to search for documentation]:ri doc directory:_files -/' \ - '(-f --fmt --format)'{-f,--fmt,--format}'[format to use when displaying output]:output format:(ansi bs html plain simple)' \ + '*'{-d+,--doc-dir=}'[directory to search for documentation]:ri doc directory:_directories' \ + '(-f --format)'{-f+,--format=}'[format to use when displaying output]:output format [bs]:(ansi bs markdown rdoc)' \ '(-T --no-pager)'{-T,--no-pager}'[send output directly to stdout]' \ - '(-i, --interactive)'{-i,--interactive}'[interactive mode]' \ + '(-i --interactive)'{-i,--interactive}'[interactive mode]' \ + '(-a --all)'{-a,--all}'[show all documentation for a class or module]' \ + '(-l --list)'{-l,--list}'[list classes ri knows about]' \ '--list-doc-dirs[list the directories from which ri will source documentation]' \ - '(-w --width)'{-w,--width}'[set the width of the output]:output width:' \ - '--no-standard-docs[do not include documentation from the Ruby standard library, site_lib, installed gems, or ~/.rdoc]' \ - '(--no-use-cache --use-cache)--'{no-,}'use-cache[whether or not to use ri'\''s cache]' \ - '(--no-system --system)--'{no-,}'system[include documentation from Ruby'\''s standard library]' \ + '(-w --width)'{-w+,--width=}'[set the width of the output]:output width [72]' \ + '(-l --list)--server=-[run RDoc server on the given port]::port [8214]:_ports' \ + "--no-standard-docs[don't include documentation from the Ruby standard library, site_lib, installed gems, or ~/.rdoc]" \ + '(--no-use-cache --use-cache)--'{no-,}"use-cache[whether or not to use ri's cache]" \ + '(--no-system --system)--'{no-,}"system[include documentation from Ruby's standard library]" \ '(--no-site --site)--'{no-,}'site[include documentation from libraries installed in site_lib]' \ '(--no-gems --gems)--'{no-,}'gems[include documentation from RubyGems]' \ '(--no-home --home)--'{no-,}'home[include documentation stored in ~/.rdoc]' \ - '*:ri name:->ri-name' && ret=0 + '--profile[run with the Ruby profiler]' \ + '--dump=[dump data from an ri cache or data file]:cache:_files' \ + '*:ri name:->ri-name' && return if [[ "$state" = ri-name ]]; then local -a ri_dirs ri_ext ri_names ri_wants ri_names local class_dir esc_name dir curtag tag descr expl - ret=1 - if "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e 1 >/dev/null 2>&1; then # Old-style Ruby 1.8.x RI ri_dirs=( ${(f)"$(_call_program ri-names "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e '"o = RI::Options.instance; o.parse(ARGV); o.path.each { |p| puts p }"' -- ${(kv)opt_args[(I)-d|--doc-dir|--(system|site|gems|home)]})"} ) diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm index ea9190de2..e66b77fa4 100644 --- a/Completion/Unix/Command/_rm +++ b/Completion/Unix/Command/_rm @@ -69,7 +69,7 @@ _arguments -C -s -S $opts \ case $state in (file) - line[CURRENT]=() + (( CURRENT > 0 )) && line[CURRENT]=() line=( ${line//(#m)[\[\]()\\*?#<>~\^\|]/\\$MATCH} ) _files -F line && ret=0 ;; diff --git a/Completion/Unix/Command/_route b/Completion/Unix/Command/_route index 06cca8d99..95df6d936 100644 --- a/Completion/Unix/Command/_route +++ b/Completion/Unix/Command/_route @@ -135,7 +135,7 @@ case $OSTYPE in openbsd*) subcmds+=( exec 'execute a command with alternate routing table' ) args+=( - '-T+[select specified alternate routing table]:table id' + '-T+[select specified alternate routing table]:routing table:_routing_tables' ) modifiers+=( -sa diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync index 56efd7b13..eb906e974 100644 --- a/Completion/Unix/Command/_rsync +++ b/Completion/Unix/Command/_rsync @@ -71,31 +71,41 @@ _rsync_info() { local opts opts=( ${${(M)${(f)"$(_call_program values $words[1] --info=help)"}:#*Mention*}/ ##Me/[me} ) (( $#opts )) && opts=( '(ALL NONE HELP)'${^opts}\] ) - _values -s , 'info options' $opts ALL NONE HELP + _values -s , 'info option' $opts ALL NONE HELP } _rsync_debug() { local opts opts=( ${${(M)${(f)"$(_call_program values $words[1] --debug=help)"}:#*Debug*}/ ##De/[de} ) (( $#opts )) && opts=( '(ALL NONE HELP)'${^opts}\] ) - _values -s , 'debug options' $opts ALL NONE HELP + _values -s , 'debug option' $opts ALL NONE HELP } _rsync_files() { _alternative "files:file:_files" "remote-files:remote file:_rsync_remote_files" } +_rsync_users_groups() { + local -a suf + if compset -P '*:'; then + _groups + else + compset -S ':*' || suf=( -qS ':' ) + _users $suf + fi +} + _rsync() { _arguments -s \ '*'{-v,--verbose}'[increase verbosity]' \ {--no-v,--no-verbose}'[turn off --verbose]' \ - '--bwlimit=[limit I/O bandwidth]:limit (KiB per second)' \ + '--bwlimit=[limit I/O bandwidth]: :_numbers -f -u "KiB per second" -d 1g limit B K M G T P' \ '--outbuf=[set output buffering]:buffering:(none line block)' \ '--port=[specify alternate port number]:port:(873)' \ '--address=[bind to the specified address]:bind address:_bind_addresses' \ '--log-file-format=[log updates using specified format]:format' \ '--log-file=[log what rsync is doing to the specified file]:file:_files' \ - '(-T --temp-dir)'{-T,--temp-dir=}'[create temporary files in specified directory]:directory:_directories' \ + '(-T --temp-dir)'{-T+,--temp-dir=}'[create temporary files in specified directory]:directory:_directories' \ '--sockopts=[specify custom TCP options]' \ '(-4 -6 --ipv4 --ipv6)'{-4,--ipv4}'[prefer IPv4]' \ '(-4 -6 --ipv4 --ipv6)'{-6,--ipv6}'[prefer IPv6]' \ @@ -104,11 +114,12 @@ _rsync() { '--config=[specify alternate rsyncd.conf file]:file:_files' \ '--daemon[run as an rsync daemon]' \ '--detach[detach from the parent]' \ - '(-M --dparam)'{-M,--dparam=}'[override global daemon config parameter]:config parameter' \ + '(-M --dparam)'{-M+,--dparam=}'[override global daemon config parameter]:config parameter' \ '--no-detach[do not detach from the parent]' \ - client \ '(-)--help[display help information]' \ '*: :_rsync_files' \ + '--stderr=[change stderr output mode]:output mode [errors]:(errors all client)' \ '(-q --quiet)'{-q,--quiet}'[suppress non-error messages]' \ '--no-motd[suppress the daemon message-of-the-day output]' \ '(-c --checksum)'{-c,--checksum}'[skip based on checksums, not mod-time & size]' \ @@ -121,7 +132,7 @@ _rsync() { {--no-implied-dirs,--no-i-d}'[do not send implied dirs with --relative]' \ '(-b --backup)'{-b,--backup}'[make backups into hierarchy at indicated directory]' \ '--backup-dir=[make backups into specified directory]:backup directory:_directories' \ - '--suffix=[set backup suffix]:suffix:(\~)' \ + '--suffix=[set backup suffix]:suffix [~]' \ '(-u --update)'{-u,--update}'[skip files that are newer on the receiving side]' \ '--inplace[update destination files in-place]' \ '(--append-verify)--append[append data onto shorter files]' \ @@ -131,6 +142,7 @@ _rsync() { '--fake-super[use xattrs to save all file attributes]' \ '(-d --dirs)'{-d,--dirs}'[transfer directories without recursing]' \ {--no-d,--no-dirs}'[turn off --dirs]' \ + "--mkpath[create the destination's path component]" \ '(-l --links)'{-l,--links}'[copy symlinks as symlinks]' \ {--no-l,--no-links}'[turn off --links]' \ '(-L --copy-links)'{-L,--copy-links}'[transform symlinks into referent file/dir]' \ @@ -142,6 +154,7 @@ _rsync() { '(-K --keep-dirlinks)'{-K,--keep-dirlinks}'[treat symlinked dir on receiver as dir]' \ '(-p --perms -E --executability)'{-p,--perms}'[preserve permissions]' \ {--no-p,--no-perms}'[turn off --perms]' \ + '--fileflags[preserve file-flags (aka chflags)]' \ '(-E --executability)'{-E,--executability}'[preserve executability]' \ '(-o --owner)'{-o,--owner}'[preserve owner]' \ {--no-o,--no-owner}'[turn off --owner]' \ @@ -150,22 +163,25 @@ _rsync() { '(--devices --specials)-D[same as --devices --specials]' \ '(-D)--devices[preserve devices]' \ '--no-devices[turn off --devices]' \ - '--copy-devices[copy device contents as regular file]' \ '(-D)--specials[preserve special files]' \ '--no-specials[turn off --specials]' \ '--no-D[turn off --devices and --specials]' \ - '(-t --times)'{-t,--times}'[preserve times]' \ + '(-t --times)'{-t,--times}'[preserve modification times]' \ {--no-t,--no-times}'[turn off --times]' \ + \*{-U,--atimes}'[preserve access (use) times]' \ + '--open-noatime[avoid changing the atime on opened files]' \ + '(--crtimes -N)'{--crtimes,-N}'[preserve create times (newness)]' \ '(-O --omit-dir-times)'{-O,--omit-dir-times}'[omit directories when preserving times]' \ '(-J --omit-link-times)'{-J,--omit-link-times}'[omit symlinks when preserving times]' \ - '--chmod[change destination permissions]:mods' \ + '--chmod=[change destination permissions]:permissions' \ '(-S --sparse)'{-S,--sparse}'[handle sparse files efficiently]' \ + '--write-devices[write to devices as files (implies --inplace)]' \ '(-n --dry-run)'{-n,--dry-run}'[show what would have been transferred]' \ '(-W --whole-file)'{-W,--whole-file}'[copy files whole (without delta-transfer algorithm)]' \ {--no-W,--no-whole-file}'[turn off --whole-file]' \ - '--checksum-choice=[choose the checksum algorithms]:algorithm:_sequence -n 2 compadd - auto md4 md5 none' \ + '(--cc --checksum-choice)'{--cc,--checksum-choice}'=[choose the checksum algorithms]:algorithm:_sequence -n 2 compadd - auto md4 md5 none' \ '(-x --one-file-system)'{-x,--one-file-system}"[don't cross filesystem boundaries]" \ - '(-B --block-size)'{-B,--block-size=}'[force a fixed checksum block-size]:block size' \ + '(-B --block-size)'{-B+,--block-size=}'[force a fixed checksum block-size]: :_numbers -f -u bytes -d 1g "block size" B K M G T P' \ '(-e --rsh)'{-e+,--rsh=}'[specify the remote shell to use]:remote-shell command:(rsh ssh)' \ '--rsync-path=[specify path to rsync on the remote machine]:remote command' \ '--ignore-existing[ignore files that already exist on receiving side]' \ @@ -179,10 +195,14 @@ _rsync() { '(--del --delete-before --delete-during --delete-after)--delete-delay[receiver deletes after transfer]' \ '--delete-excluded[also delete excluded files on the receiving side]' \ '--ignore-errors[delete even if there are I/O errors]' \ - '--force[force deletion of directories even if not empty]' \ - '--max-delete=[do not delete more than NUM files]:number' \ - '--max-size=[do not transfer any file larger than specified size]:number' \ + --force{,-delete}'[force deletion of directories even if not empty]' \ + '--force-change[affect user-/system-immutable files/dirs]' \ + '--force-uchange[affect user-immutable files/dirs]' \ + '--force-schange[affect system-immutable files/dirs]' \ + "--max-delete=[don't delete more than NUM files]: :_numbers -f -u bytes size B K M G T P" \ + "--max-size=[don't transfer any file larger than specified size]: :_numbers -f -u bytes size B K M G T P" \ '--min-size=[do not transfer any file smaller than specified size]:number' \ + '--max-alloc=[set limit to individual memory allocation]: :_numbers -f -u bytes -d 1g size B K M G T P' \ '(-P)--partial[keep partially transferred files]' \ '--no-partial[turn off --partial]' \ '--partial-dir=[put a partially transferred file into specified directory]:directory:_directories' \ @@ -201,10 +221,11 @@ _rsync() { '(--compare-dest --link-dest)*--copy-dest=[like --compare-dest, but also includes copies of unchanged files]:directory:_directories' \ '(--compare-dest --copy-dest)*--link-dest=[hardlink to files in specified directory hierarchy when unchanged]:directory:_directories' \ '(-z --compress)'{-z,--compress}'[compress file data during the transfer]' \ - '--compress-level=[explicitly set compression level]:number' \ + '(--zc --compress-choice)'{--zc,--compress-choice}'=[override the automatic negotiation of the compression algorithm]:algorithm:(zstd lz4 zlibx zlib none)' \ + '(--zl --compress-level)'{--zl,--compress-level}'=[explicitly set compression level]:number' \ '--skip-compress=[skip compressing files with a listed suffix]:suffixes' \ '(-C --cvs-exclude)'{-C,--cvs-exclude}'[auto-ignore files the same way CVS does]' \ - '*'{-f=,--filter=}'[add a file-filtering rule]:rule' \ + '*'{-f+,--filter=}'[add a file-filtering rule]:rule' \ '*-F[same as --filter="dir-merge /.rsync-filter", repeated: --filter="- .rsync-filter"]' \ '--exclude-from=[read exclude patterns from specified file]:file:_files' \ '*--exclude=[exclude files matching pattern]:pattern' \ @@ -213,6 +234,7 @@ _rsync() { '--files-from=[read list of source-file names from specified file]:file:_files' \ '(-0 --from0)'{-0,--from0}'[all *-from file lists are delimited by nulls]' \ '(-s --protect-args)'{-s,--protect-args}'[no space-splitting; only wildcard special-chars]' \ + '--copy-as=[specify user & optional group for the copy]:user:_rsync_users_groups' \ '--version[print version number]' \ '*'{-h,--human-readable}'[output numbers in a human-readable format]' \ '--blocking-io[use blocking I/O for the remote shell]' \ @@ -227,23 +249,24 @@ _rsync() { '--out-format=[output updates using specified format]:format' \ '--password-file=[read daemon-access password from file]:file:_files' \ '--list-only[list the files instead of copying them]' \ + '--stop-after=[stop copying after specified time has elapsed]:time (minutes)' \ + '--stop-at=[stop copying when specified point in time is reached]:date/time (YYYY-MM-DDTHH\:MM):_dates -F -S "T"' \ '(--only-write-batch)--write-batch=[write a batched update to the specified file]:file:_files' \ '(--write-batch)--only-write-batch=[like --write-batch but w/o updating destination]:file:_files' \ '--protocol=[force an older protocol version to be used]:number' \ '--info=[fine-grained informational verbosity]:info option:_rsync_info' \ '--debug=[fine-grained debug verbosity]:debug option:_rsync_debug' \ - '--msgs2stderr[special output handling for debugging]' \ + '!(--stderr)--msgs2stderr' \ '--munge-links[munge symlinks to make them safer, but unusable]' \ '--ignore-missing-args[ignore missing source args without error]' \ '--delete-missing-args[delete missing source args from destination]' \ '(--usermap --chown)--usermap=[custom username mapping]:comma-separated mappings' \ '(--groupmap --chown)--groupmap=[custom groupname mapping]:comma-separated mappings' \ - '(--usermap --groupmap --chown)--chown=[simple username/groupname mapping]:user and/or group' \ - '*'{-M=,--remote-option=}'[send option to the remote side only]:option string' \ + '(--usermap --groupmap --chown)--chown=[simple username/groupname mapping]:user and/or group:_rsync_users_groups' \ + '*'{-M+,--remote-option=}'[send option to the remote side only]:option string' \ '--preallocate[preallocate the full length of new files]' \ '--iconv=[request charset conversion of filenames]:number' \ '--checksum-seed=:number' \ - "--noatime[don't alter atime when opening source files]" \ '--read-batch=[read a batched update from the specified file]:file:_files' } diff --git a/Completion/Unix/Command/_ruby b/Completion/Unix/Command/_ruby index 3ed25a3f0..0e1f5dbc0 100644 --- a/Completion/Unix/Command/_ruby +++ b/Completion/Unix/Command/_ruby @@ -15,13 +15,13 @@ all=( common=( '*-I+[specify $LOAD_PATH directory (may be used more than once)]:library directory:_files -/' '-w[turn warnings on for your script]' - '-W-[set warning level]:warning level:((0\:silent 1\:medium 2\:verbose))' + '-W-[set warning level]:warning level:((0\:silent 1\:medium 2\:verbose \\\:deprecated \\\:experimental))' '(-)1:ruby script:_files -g "*.rb(-.)"' '*::script argument:= ->normal' ) opts=( - '-0-[specify record separator]:input record separator in octal [default \0]' + '-0-[specify record separator]:input record separator in octal [\0]' '-a[autosplit mode with -n or -p (splits $_ into $F)]' '-c[check syntax only]' '-C+[cd to directory before executing your script]:directory:_files -/' @@ -35,7 +35,7 @@ opts=( '(-n)-p[assume loop like -n but print line also like sed]' '-s[enable some switch parsing for switches after script name]' '-S[look for the script using PATH environment variable]' - '-T-[turn on tainting checks]::taint level [1]:((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))' + '!-T-[turn on tainting checks]::taint level [1]:((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))' '(--verbose)-v[print version number, then turn on verbose mode]' '(-v)--verbose[turn on verbose mode and disable script from stdin]' '-x-[strip off text before #!ruby line and perhaps cd to directory]:directory:_files -/' @@ -49,11 +49,11 @@ opts=( '--jit[enable jit with default options]' '--jit-warnings[enable printing JIT warnings]' '--jit-debug[enable JIT debugging (very slow)]' - '--jit-wait[wait until JIT compilation is finished every time (for testing)]' + '--jit-wait[wait until JIT compilation finishes every time (for testing)]' '--jit-save-temps[save JIT temporary files]' '--jit-verbose=-[print JIT logs of level num or less to stderr]:maximum log level [0]' - '--jit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:number [1000]' - '--jit-min-calls=-[specify number of calls to trigger JIT]:calls [5]' + '--jit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:number [100]' + '--jit-min-calls=-[specify number of calls to trigger JIT]:calls [10000]' ) irb=( diff --git a/Completion/Unix/Command/_runit b/Completion/Unix/Command/_runit index 81ba26a44..5c22cc54e 100644 --- a/Completion/Unix/Command/_runit +++ b/Completion/Unix/Command/_runit @@ -19,7 +19,7 @@ _sv_commands() { 'kill':'send SIGKILL if service is running' 'exit':'send SIGTERM and SIGCONT if service is running. Do not restart service.' ) - _describe -t commands "sv commands" sv_ary -V sv_commands + _describe -t commands "sv command" sv_ary -V sv_commands } _sv_lsb() { @@ -41,7 +41,7 @@ _sv_lsb() { } _sv_additional() { - _describe -t additional-commands "sv additional commands" '("check:check status of service")' -V sv_addl_comm + _describe -t additional-commands "sv additional command" '("check:check status of service")' -V sv_addl_comm } local curcontext="$curcontext" state line @@ -68,6 +68,6 @@ case $state in ) sv_services=( ${sv_services#$svdir/} ) - _describe -t services "sv services" sv_services + _describe -t services "sv service" sv_services ;; esac diff --git a/Completion/Unix/Command/_samba b/Completion/Unix/Command/_samba index 775543794..6c7a64e18 100644 --- a/Completion/Unix/Command/_samba +++ b/Completion/Unix/Command/_samba @@ -96,7 +96,7 @@ case $service in smbstatus) _arguments -s -S $args \ {-b,--brief}'[brief output]' \ - '(-v --verbose)'(-v,--verbose)'[be verbose]' \ + '(-v --verbose)'{-v,--verbose}'[be verbose]' \ '(-d --debuglevel)'{-d+,--debuglevel=}'[specify debug level]:debug level:(0 1 2 3 4 5 6 7 8 9 10)' \ '(-u --user)'{-u+,--user=}'[specify user to restrict information to]:user:_users' \ '(-B --byterange)'{-B,--byterange}'[include byte range locks]' \ diff --git a/Completion/Unix/Command/_scons b/Completion/Unix/Command/_scons index 2c620cc1a..77fe6dfb0 100644 --- a/Completion/Unix/Command/_scons +++ b/Completion/Unix/Command/_scons @@ -19,7 +19,7 @@ _arguments -s -S \ '(-)-'{h,-help}'[display defined usage information]' \ '(-)-'{H,-help-options}'[display usage information]' \ '(-i -ignore-errors)-'{i,-ignore-errors}'[ignore errors from build actions]' \ - \*{-I,--include-dir=}'[add directory to search Python modules]:directories:_directories' \ + \*{-I,--include-dir=}'[add directory to search Python modules]:directory:_directories' \ '(--implicit-deps-changed --implicit-deps-unchanged)--implicit-cache[cache scanned dependencies]' \ '(--implicit-cache --implicit-deps-changed)--implicit-deps-changed[rescan dependencies]' \ '(--implicit-cache --implicit-deps-unchanged)--implicit-deps-unchanged[ignore changes to scanned dependencies]' \ diff --git a/Completion/Unix/Command/_script b/Completion/Unix/Command/_script index ac3bf3973..7a3960be0 100644 --- a/Completion/Unix/Command/_script +++ b/Completion/Unix/Command/_script @@ -4,14 +4,19 @@ local args hlp="-h --help -V --version" if [[ $service = scriptreplay ]]; then _arguments -S -s \ - "(1 -t --timing $hlp)"{-t+,--timing=}'[specify file containing timing output]:timing file:_files' \ - "(2 -s --typescript $hlp)"{-s+,--typescript=}'[specify file containing terminal output]:typescript file:_files' \ + "(1 -t --timing -T --log-timing $hlp)"{-t+,-T+,--timing=,--log-timing=}'[specify file containing timing output]:timing file:_files' \ + "(-I --log-in -B --log-io $hlp)"{-I+,--log-in=}'[specify file containing terminal input]:file:_files' \ + "(2 -s --typescript -B --log-io $hlp)"{-s+,-O+,--typescript=,--log-out=}'[specify file containing terminal output]:typescript file:_files' \ + "(-B --log-io -I --log-in -s -O --typescript --log-out $hlp)"{-B,--log-io}'[specify file containing terminal input and output]' \ + "($hlp)--summary[display overview about recorded session and exit]" \ "(3 -d --divisor $hlp)"{-d+,--divisor=}'[speed up replay]:factor' \ "(-m --maxdelay $hlp)"{-m+,--maxdelay=}'[set maximum delay between updates]:delay (seconds)' \ + "(-x --stream $hlp)"{-x+,--stream=}'[specify stream type]:name:(out in signal or info)' \ + "(-c --cr-mode $hlp)"{-c+,--cr-mode=}'[specify CR char mode]:mode:(auto never always)' \ '(- *)'{-h,--help}'[display help information]' \ '(- *)'{-V,--version}'[display version information]' \ "(-t --timing $hlp):timing file:_files" \ - "(-s --typescript $hlp):typescript file:_files" \ + "(-s --typescript -O --log-out $hlp):typescript file:_files" \ "(-d --divisor $hlp): :_guard '[0-9.]#' 'timing divisor'" return fi @@ -19,12 +24,18 @@ fi case $OSTYPE in linux*) args=( -S - "(-a --append $hlp)"{-a,--append}'[append output]' + "(-I --log-in $hlp)"{-I,--log-in}'[log stdin to file]:file:_files' + "(-O --log-out $hlp)"{-O,--log-out}'[log stdout to file]:file:_files' + "(-B --log-io $hlp)"{-B,--log-io}'[log stdin and stdout to file]:file:_files' + "(-T --log-timing -t --timing $hlp)"{-T+,--log-timing=}'[log timing information to file]:file:_files' + "(-m --logging-format $hlp)"{-m+,--logging-format=}'[specify log file format]:format:(classic advanced)' + "(-a --append $hlp)"{-a,--append}'[append to the log file]' "(-c --command $hlp)"{-c,--command=}'[run specified command instead of a shell]:command:_cmdstring' "(-e --return $hlp)"{-e,--return}'[return exit status of the child process]' "(-f --flush $hlp)"{-f,--flush}'[flush output after each write]' + "(-E --echo $hlp)"{-E+,--echo=}'[echo input]:when:(auto always never)' "($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)' + "(-o --output-limit $hlp)"{-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]' diff --git a/Completion/Unix/Command/_sed b/Completion/Unix/Command/_sed index 73227901e..79a010c92 100644 --- a/Completion/Unix/Command/_sed +++ b/Completion/Unix/Command/_sed @@ -109,10 +109,10 @@ else ) ;| openbsd*|freebsd*|netbsd*|dragonfly*) args+=( '(-r -E)'-r$extended ) ;| - darwin*|freebsd*|netbsd*|openbsd*) args+=( '-i+'$inplace ) ;| - darwin*|freebsd*|netbsd*) args+=( '-l[make output line buffered]' ) ;| - freebsd*) args+=( '-u[disable data buffering]' ) ;| - freebsd*|netbsd*) + darwin*|freebsd*|netbsd*|openbsd*|dragonfly*) args+=( '-i+'$inplace ) ;| + darwin*|freebsd*|netbsd*|dragonfly*) args+=( '-l[make output line buffered]' ) ;| + freebsd*|dragonfly*) args+=( '-u[disable data buffering]' ) ;| + freebsd*|netbsd*|dragonfly*) args+=( '-I+[edit files in-place, treating all files as a single input stream]:: :_guard "^(*[@/; \\\]*|?(#c6,)|-*)" "suffix for backup"' ) diff --git a/Completion/Unix/Command/_setfacl b/Completion/Unix/Command/_setfacl index 5c573a581..14be49d95 100644 --- a/Completion/Unix/Command/_setfacl +++ b/Completion/Unix/Command/_setfacl @@ -3,11 +3,11 @@ if _pick_variant cygwin=cygwin unix --version; then # cygwin 1.5.25 _arguments -s -S \ - '(-d, --delete)'{-d,--delete}'[delete one or more specified ACL entries]:ACL entry:' \ - '(-f, --file)'{-f,--file}'[set ACL entries for FILE to ACL entries read from a ACL_FILE]:ACL file:_files' \ - '(-m, --modify)'{-m,--modify}'[modify one or more specified ACL entries]:ACL entry:' \ - '(-r, --replace)'{-r,--replace}'[replace mask entry with maximum permissions needed for the file group class]' \ - '(-s, --substitute)'{-s,--substitute}'[substitute specified ACL entries for the \[ACL of FILE\]]:ACL entry:' \ + '(-d --delete)'{-d,--delete}'[delete one or more specified ACL entries]:ACL entry' \ + '(-f --file)'{-f,--file}'[set ACL entries for FILE to ACL entries read from a ACL_FILE]:ACL file:_files' \ + '(-m --modify)'{-m,--modify}'[modify one or more specified ACL entries]:ACL entry' \ + '(-r --replace)'{-r,--replace}'[replace mask entry with maximum permissions needed for the file group class]' \ + '(-s --substitute)'{-s,--substitute}'[substitute specified ACL entries for the \[ACL of FILE\]]:ACL entry' \ '(- *)'{-h,--help}'[output usage information and exit]' \ '(- *)'{-v,--version}'[output version information and exit]' \ '*: :_files' diff --git a/Completion/Unix/Command/_sh b/Completion/Unix/Command/_sh index 39d299c58..f0f18d4bb 100644 --- a/Completion/Unix/Command/_sh +++ b/Completion/Unix/Command/_sh @@ -1,14 +1,36 @@ #compdef sh ash csh dash ksh ksh88 ksh93 mksh oksh pdksh rc tcsh yash -if (( CURRENT == ${words[(i)-c]} + 1 )); then - _cmdstring -else - local n=${words[(b:2:i)[^-]*]} - if (( n <= CURRENT )); then - compset -n $n - _alternative \ - 'files:file:_files' \ - 'commands:command:_normal' && return 0 - fi - _default -fi +local bourne argv0 +local -a args all_opts=( -{{0..9},{A..Z},{a..z}} ) + +[[ $service == (csh|?csh|fish|rc) ]] || bourne=1 + +# Bourne-style shells support +x variants +# @todo Uncomment when workers/45422 is fixed +# (( bourne )) && all_opts+=( ${all_opts/#-/+} ) +# Bourne-style shells take argv[0] as the second argument to -c +(( bourne )) && argv0=':argv[0]:' + +# All of the recognised shells support at least these arguments +args=( + "(1 -)-c[execute specified command string]: :_cmdstring$argv0" + '-e[exit immediately on non-zero return]' + '-i[act as interactive shell]' + '-l[act as login shell]' + '-x[print command trace]' + '1:script file:_files' + '*:: :_files' +) +# Bourne-style shells support -o/+o option. Not all of them support -ooption in +# the same argument, but we'll allow it here for those that do +(( bourne )) && args+=( + '-o+[set specified option]:option:' + '+o+[unset specified option]:option:' +) +# Since this is a generic function we don't know what other options these shells +# support, but we don't want them to break the ones listed above, so we'll just +# ignore any other single-alphanumeric option. Obviously this doesn't account +# for long options +args+=( '!'${^${all_opts:#(${(~j<|>)${(@M)${(@M)args#(*[\*\)]|)[+-]?}%[+-]?}})}} ) + +_arguments -s -S -A '-*' : $args diff --git a/Completion/Unix/Command/_sqlite b/Completion/Unix/Command/_sqlite index 0f03c61c1..7ef3c6daa 100644 --- a/Completion/Unix/Command/_sqlite +++ b/Completion/Unix/Command/_sqlite @@ -22,7 +22,7 @@ options+=( ) output_modes=( column HTML line list ) -(( $+sqlite3 )) && output_modes+=( ascii csv quote ) +(( $+sqlite3 )) && output_modes+=( ascii box csv json markdown quote table tabs ) exclusive=( $^dashes-${^output_modes:l} ) for display_opt in $output_modes ; do # finagle the description to match the way SQLite's -help formats them @@ -54,6 +54,7 @@ options+=( $^dashes'-memtrace[trace all memory allocations and deallocations]' $^dashes'-mmap[set default mmap size]:size' $^dashes'-newline[set output row separator]:separator [\n]' + $^dashes'-nofollow[refuse to open symbolic links to database files]' $^dashes'-pagecache[specify size and number of slots for page cache memory]:size (bytes): :slots' $^dashes'-readonly[open the database read-only]' $^dashes'-stats[print memory stats before each finalize]' diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 0775590e6..2385272f1 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -4,12 +4,13 @@ _ssh () { local curcontext="$curcontext" state line expl suf arg ret=1 - local args sigargs common common_transfer algopt tmp p1 file cmn cmds sdesc tdesc - typeset -A opt_args + local args sigargs common common_transfer options algopt tmp p1 file cmn cmds sdesc tdesc + typeset -A opt_args tsizes common=( '(-6)-4[force ssh to use IPv4 addresses only]' '(-4)-6[force ssh to use IPv6 addresses only]' + '-A[enable forwarding of the authentication agent connection]' '-C[compress data]' '-c+[select encryption cipher]:encryption cipher:->ciphers' '-F+[specify alternate config file]:config file:_files' @@ -32,7 +33,6 @@ _ssh () { ssh) (( $+words[(r)-[^-]#t*] )) && tdesc=' even if there is no controlling tty' _arguments -C -s \ - '(-a)-A[enable forwarding of the authentication agent connection]' \ '(-A)-a[disable forwarding of authentication agent connection]' \ '-B+[bind to specified interface before attempting to connect]:interface:_net_interfaces' \ '(-P)-b+[specify interface to transmit on]:bind address:_bind_addresses' \ @@ -81,9 +81,19 @@ _ssh () { '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0 ;; ssh-add) - [[ $OSTYPE == darwin* ]] && args=( - '-A[add identities from keychain]' - '-K[update keychain when adding/removing identities]' + if [[ $OSTYPE != darwin* || $APPLE_SSH_ADD_BEHAVIOR == openssh ]]; then + args=( + '-K[load resident keys from a FIDO authenticator]' + ) + else + [[ ${APPLE_SSH_ADD_BEHAVIOR:-macos} == macos ]] && args=( + '-A[add identities from keychain]' + '-K[update keychain when adding/removing identities]' + ) + fi + [[ $OSTYPE == darwin<20->.* ]] && args+=( + '--apple-load-keychain[add identities from keychain]' + '--apple-use-keychain[update keychain when adding/removing identities]' ) _arguments -s : $args \ '-c[identity is subject to confirmation via SSH_ASKPASS]' \ @@ -92,14 +102,16 @@ _ssh () { $algopt \ '-e+[remove keys provided by the PKCS#11 shared library]:library:_files -g "*.(so|dylib)(|.<->)(-.)"' \ '-k[load plain private keys only and skip certificates]' \ + '-K[load resident keys from a FIDO authenticator]' \ '-L[list public key parameters of all identities in the agent]'\ '-l[list all identities]' \ '-m+[specify minimum remaining signatures before maximum is changed]:number' \ '-M+[specify maximum number of signatures]:number' \ + '-S+[use specified library when adding FIDO authenticator-hosted keys]:library:_files' \ '-s+[add keys provided by the PKCS#11 shared library]:library:_files -g "*.(so|dylib)(|.<->)(-.)"' \ '-t+[set maximum lifetime for identity]:maximum lifetime (in seconds or time format):' \ "-T[test usability of identity files' private keys]:*:public key file:_files -g '*.pub(-.)'" \ - '-v[verbose mode]' \ + '*-v[verbose mode]' \ '-q[be quiet after a successful operation]' \ '-X[unlock the agent]' \ '-x[lock the agent with a password]' \ @@ -125,13 +137,42 @@ _ssh () { # options can be in any order but use ! to limit those shown for the first argument (( CURRENT == 2 )) && p1='!' args=( '!-z:number' ) + options=( + application + 'challenge\:path\:_files' + device + no-touch-required + resident + user + verify-required + 'write-attestation\:path\:_files' + ) sdesc='certify keys with CA key' - (( $+words[(r)-I] )) && args=( '-z[specify serial number]:serial number' ) + if (( $+words[(r)-[IhUDnV]*] )); then + args=( '-z[specify serial number]:serial number' ) + options=( + clear critical\:name extension\:name force-command\:command\:_cmdstring + no-agent-forwarding no-port-forwarding no-pty no-user-rc no-x11-forwarding + permit-agent-forwarding permit-port-forwarding permit-pty permit-user-rc + permit-x11-forwarding source-address\:source\ address + ) + fi (( $+words[(r)-[ku]] )) && args=( '-z[specify version number]:version number' ) && sdesc='specify CA public key file' file=key (( $+words[(r)-[FHR]] )) && file=known_hosts - (( $+words[(r)-T] )) && file=input + if (( $+words[(r)-M*] )); then + file=input + args+=( '*:output file:_files' ) + options=( + lines:number + 'start-line\:line number' + checkpoint\:file:_files + 'memory\:size (mbytes)' + 'start\:start point (hex-value)' + generator\:value + ) + fi (( $+words[(r)-A] )) && file='prefix for host key' if (( $+words[(r)-[kIQ]] )); then file=krl @@ -139,8 +180,9 @@ _ssh () { fi if (( arg = $words[(I)-Y*] )); then [[ $words[arg] = -Y?* ]] || (( arg++ )) - case $words[arg] in - check*|verify) + case ${words[arg]#-Y} in + ^find-*) sigargs+=( "$p1-n+[specify namespace]:namespace" ) ;| + check*|find*|verify) sigargs+=( "$p1-s+[specify signature file]:signature file:-files" ) ;| sign) sigargs+=( '*:file:_files' ) ;; @@ -153,51 +195,60 @@ _ssh () { ;; esac fi - cmds=( -p -i -e -y -c -l -B -D -F -H -R -r -G -T -s -L -A -k -Q -Y ) # basic commands - cmn=( -b -P -N -C -l -m -v ) # options common to many basic commands (except -f which is common to most) - cms=( -E -q -t -g -M -S -a -J -j -K -W -I -h -n -O -V -u -U ) # options specific to one basic command + cmds=( -p -i -e -y -c -l -B -D -F -H -K -R -r -M -s -L -A -k -Q -Y ) # basic commands + cmn=( -a -b -P -N -C -l -m -O -v -w -Z ) # options common to many basic commands (except -f which is common to most) + cms=( -E -q -t -g -M -I -h -n -V -u -U ) # options specific to one basic command + tsizes=( + dsa 1024 + ecdsa '256 384 521' # values appear in key names as listed with ssh -Q key - 521 really is correct + rsa '1024 2048 4096' + ) _arguments -s $args \ - "(${${(@)cmds:#-G}} -P ${${(@)cms:#-[MS]}})-b+[specify number of bits in key]:bits in key" \ + "${p1}(${${(@)cmds:#-[pcKAO]}} ${${(@)cms:#-[t]}} -O)-a+[specify number of rounds]:rounds [16]" \ + "(${${(@)cmds:#-M}} -P ${${(@)cms:#-[MS]}})-b+[specify number of bits in key]:bits in key [2048]:"'compadd ${expl\:/-X/-x} ${_comp_mesg\:=-} ${=tsizes[${opt_args[create--t]\:-rsa}]}' \ "$p1(${${(@)cmds:#-[pc]}} -b $cms)-P+[provide old passphrase]:old passphrase" \ "(${${(@)cmds:#-p}} -v ${${(@)cms:#-[qt]}})-N+[provide new passphrase]:new passphrase" \ "(${${(@)cmds:#-c}} -v $cms)-C+[provide new comment]:new comment" \ - "(-D -G -M -S -I -h -n -O -V -A)-f+[$file file]:$file file:_files" \ + "(-D -I -h -n -V -A)-f+[$file file]:$file file:_files" \ "$p1(${${(@)cmds:#-[FE]}} ${${(@)cmn:#-v}} ${${(@)cms:#-E}})-l[show fingerprint of key file]" \ "$p1(${${(@)cmds:#-[iep]}} $cms)-m+[specify conversion format]:format [RFC4716]:(PEM PKCS8 RFC4716)" \ + "$p1*-O+[specify a key/value option]: : _values 'option' $options" \ "(${${(@)cmds:#-[lGT]}} ${${(@)cmn:#-[bv]}} -f)*-v[verbose mode]" \ + "$p1(${${(@)cmds:#-K}} -P ${${(@)cms:#-[qt]}})-w+[specify library used when creating FISO authenticator-hosted keys]:library:_files -g '*.(so|dylib)(|.<->)(-.)'" \ + "$p1(${${(@)cmds:#-p}} -l ${${(@)cms:#-[qt]}})-Z+[specify encryption cipher to use when writing a private key file]:cipher:compadd - $(_call_program ciphers ssh -Q cipher)" \ - '(commands)' \ - "(-b -l -C -v)-p[change passphrase of private key file]" \ - '(-b -l -P -N -C -v)-i[import key to OpenSSH format]' \ - '(-b -l -P -N -C -v)-e[export key to SECSH file format]' \ + "(-b -l -C -O -v -w)-p[change passphrase of private key file]" \ + "(${${(@)cmn:#-m}})-i[import key to OpenSSH format]" \ + "(${${(@)cmn:#-m}})-e[export key to SECSH file format]" \ "($cmn)-y[get public key from private key]" \ - '(-b -l -N -m -v)-c[change comment in private and public key files]' \ + "(${${(@)cmn:#-[aCP]}})-c[change comment in private and public key files]" \ "($cmn)-B[show the bubblebabble digest of key]" \ "(-)-D+[download key stored in smartcard reader]:reader" \ "(${${(@)cmn:#-[lv]}})-F+[search for host in known_hosts file]:host:_ssh_hosts" \ "($cmn)-H[hash names in known_hosts file]" \ + "(${${(@)cmn:#-[aw]}} -f)-K[download resident keys from a FIDO authenticator]" \ "($cmn)-R+[remove host from known_hosts file]:host:_ssh_hosts" \ + "(${${(@)cmn:#-O}})-M+[moduli generation]:action:(( + generate\:generate\ candidates\ for\ DH-GEX\ moduli + screen\:screen\ candidates\ for\ DH-GEX\ moduli + ))" \ "($cmn)-L[print the contents of a certificate]" \ - "($cmn -l)-A[generate host keys for all key types]" \ + "(${${(@)cmn:#-a}})-A[generate host keys for all key types]" \ "($cmn)-Q[test whether keys have been revoked in a KRL]" \ + "($cmn)-Y+[signature action]:action:(( + find-principals\:find\ the\ principal\ associated\ with\ the\ public\ key\ of\ a\ signature + sign\:sign\ a\ file\ using\ SSH\ key + verify\:verify\ a\ signature\ generated\ using\ the\ sign\ option + check-novalidate\:check\ signature\ structure + ))" \ - finger \ "$p1($cmn)$algopt" \ - create \ '(-P -l)-q[silence ssh-keygen]' \ - "(-P -l)-t+[specify the type of the key to create]:key type:(rsa dsa ecdsa ed25519)" \ + "(-P -l)-t+[specify the type of the key to create]:key type:(rsa dsa ecdsa ed25519 ecdsa-sk ed25519-sk)" \ - dns \ "($cmn)-r[print DNS resource record]:hostname:_hosts" \ "$p1($cmn)-g[use generic DNS format]" \ - - primes \ - "(-P -N -C -l -m -f)-G+[generate candidates for DH-GEX moduli]:output file:_files" \ - "$p1(-P -N -C -l -m -f)-M+[specify amount of memory to use for generating DH-GEX moduli]:memory (MB)" \ - "$p1(-P -N -C -l -m -f)-S+[specify start point]:start point (hex)" \ - - screen \ - "(${${(@)cmn:#-v}})-T+[screen candidates for DH-GEX moduli]:output file:_files" \ - "${p1}(${${(@)cmn:#-v}})-a+[specify number of rounds]:rounds" \ - "${p1}(${${(@)cmn:#-v}})-J[exit after screening specified number of lines]" \ - "${p1}(${${(@)cmn:#-v}})-j+[start screening at the specified line number]:line number" \ - "${p1}(${${(@)cmn:#-v}})-K+[write the last line processed to file]:file:_files" \ - "${p1}(${${(@)cmn:#-v}})-W[specify desired generator]:generator" \ - certify \ "($cmn)-s[$sdesc]:CA key:_files" \ "$p1($cmn -f -k -u)-I+[specify key identifier to include in certificate]:key id" \ @@ -205,21 +256,10 @@ _ssh () { "$p1($cmn -f -k -u -D)-U[indicate that CA key is held by ssh-agent]" \ "$p1($cmn -f -k -u -U)-D+[indicate the CA key is stored in a PKCS#11 token]:PKCS11 shared library:_files -g '*.(so|dylib)(|.<->)(-.)'" \ "$p1($cmn -f -k -u)-n+[specify user/host principal names to include in certificate]:principals" \ - "$p1($cmn -f -k -u)*-O+[specify a certificate option]: : _values 'option' - clear critical\:name extension\:name force-command\:command\:_cmdstring - no-agent-forwarding no-port-forwarding no-pty no-user-rc no-x11-forwarding - permit-agent-forwarding permit-port-forwarding permit-pty permit-user-rc - permit-x11-forwarding source-address\:source\ address" \ "$p1($cmn -f -u)-V+[specify certificate validity interval]:interval" \ "($cmn -I -h -n -D -O -U -V)-k[generate a KRL file]" \ "$p1($cmn -I -h -n -D -O -U -V)-u[update a KRL]" \ - signature \ - "($cmn)-Y+[signature action]:action:(( - sign\:sign\ a\ file\ using\ SSH\ key - verify\:verify\ a\ signature\ generated\ using\ the\ sign\ option - check-novalidate\:check\ signature\ structure - ))" \ - "$p1-n+[specify namespace]:namespace" \ $sigargs return ;; @@ -244,6 +284,7 @@ _ssh () { '-b+[specify batch file to read]:batch file:_files' \ '-D+[connect directly to a local sftp server]:sftp server path' \ '-f[request that files be flushed immediately after transfer]' \ + '-N[disable implicit quiet mode set by -b]' \ '-R+[specify number of outstanding requests]:number of requests [64]' \ '-s+[specify SSH2 subsystem or path to sftp server on the remote host]:subsystem/path' \ '1:file:->rfile' '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0 @@ -269,8 +310,8 @@ _ssh () { if compset -P 1 '*='; then case "${IPREFIX#-o}" in (#i)(ciphers|macs|kexalgorithms|hostkeyalgorithms|pubkeyacceptedkeytypes|hostbasedkeytypes)=) - if ! compset -P +; then - _wanted append expl 'append to default' compadd + && ret=0 + if ! compset -P '[+-]'; then + _wanted prefix expl 'relative to default' compadd - + - && ret=0 fi ;; esac @@ -366,7 +407,7 @@ _ssh () { state=dynforward ;; (#i)kbdinteractivedevices=*) - _values -s , 'keyboard-interactive authentication methods' \ + _values -s , 'keyboard-interactive authentication method' \ 'bsdauth' 'pam' 'skey' && ret=0 ;; (#i)(kexalgorithms|gssapikexalgorithms)=*) @@ -475,7 +516,7 @@ _ssh () { else # old options are after the empty "\"-line _wanted values expl 'configure file option' \ - compadd -M 'm:{a-z}={A-Z}' -q -S '=' - \ + compadd -M 'm:{a-z}={A-Z} r:[^A-Z]||[A-Z]=* r:|=*' -q -S '=' - \ AddKeysToAgent \ AddressFamily \ BatchMode \ diff --git a/Completion/Unix/Command/_stat b/Completion/Unix/Command/_stat index 03b4552de..03abe88a3 100644 --- a/Completion/Unix/Command/_stat +++ b/Completion/Unix/Command/_stat @@ -29,7 +29,7 @@ case $variant in '(-n)-N[never show names of files]' '-o[print file modes in octal rather than decimal]' '-r[print raw data]' - '-s[print mode, UID, GID, and times as strings]' + '(-o)-s[print mode, UID, GID, and times as strings]' '(-T)-t[always show type names]' '(-t)-T[never show type names]' '*: :_files' diff --git a/Completion/Unix/Command/_stdbuf b/Completion/Unix/Command/_stdbuf index a18938ee1..4b7d98ba0 100644 --- a/Completion/Unix/Command/_stdbuf +++ b/Completion/Unix/Command/_stdbuf @@ -7,7 +7,9 @@ short=( -e -i -o ) long=( --error --input --output ) buf=( err in out ) -opt='[set initial buffering for std${buf[i]}]:mode or size:((0\:unbuffered L\:line\ buffered' +opt='[set initial buffering for std${buf[i]}]: : _alternative + "sizes\: \: _numbers -u bytes size k M G" + "modes\:mode\:((0\:unbuffered L\:line\ buffered' if _pick_variant gnu=GNU freebsd --version; then gnu=1 args=( @@ -17,7 +19,7 @@ if _pick_variant gnu=GNU freebsd --version; then else opt+=' B\:fully\ buffered' fi -opt+='))' +opt+='))"' for ((i=1;i<=3;i++)); do args+=( "(${long[i]})${short[i]}+${(e)opt}" ) diff --git a/Completion/Unix/Command/_strings b/Completion/Unix/Command/_strings index af95af52f..685daa286 100644 --- a/Completion/Unix/Command/_strings +++ b/Completion/Unix/Command/_strings @@ -45,7 +45,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu elfutils) args+=( '(- *)--usage[display a short usage message]' - '(- *)-\\?[display help information]' + '(- *)-?[display help information]' ) ;; esac diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip index e7f3418d7..3e1a6b698 100644 --- a/Completion/Unix/Command/_strip +++ b/Completion/Unix/Command/_strip @@ -32,6 +32,7 @@ if _pick_variant gnu=GNU solaris --version; then "--no-merge-notes[don't attempt to remove redundant notes]" '*'{-K+,--keep-symbol=}'[keep given symbol]:symbol name' '*'{-N+,--strip-symbol=}'[strip given symbol]:symbol name' + "*--keep-section=[don't strip given section]:section" '(*)-o+[output file]:output file:_files' '(-p --preserve-dates)'{-p,--preserve-dates}'[preserve access and modification dates]' '(-w --wildcard)'{-w,--wildcard}'[permit wildcards in symbol names]' diff --git a/Completion/Unix/Command/_su b/Completion/Unix/Command/_su index 032f867f4..1af751a17 100644 --- a/Completion/Unix/Command/_su +++ b/Completion/Unix/Command/_su @@ -35,7 +35,7 @@ case $OSTYPE in ;| *bsd*|dragonfly*) args+=( - '-c+[use settings from specified login class]:class' + '-c+[use settings from specified login class]:class:_login_classes' ) ;| freebsd*) args+=( '-s[set the MAC label]' ) ;; @@ -63,6 +63,12 @@ if (( $words[(i)-] < CURRENT )); then norm=2 fi +# This is set so that _command_names will understand that we're completing for +# a privileged command, but _call_program won't actually prepend anything to +# commands if gain-privileges is enabled (which would be undesirable here since +# su always prompts for a password). We delay setting it until this point so it +# doesn't cause issues for the check above +local -a _comp_priv_prefix=( '' ) _arguments $args ${(e)first} "*:shell arguments:= ->rest" && return usr=${${(Q)line[norm]}/--/root} diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index a1e9109de..8fc46a292 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -1,4 +1,4 @@ -#compdef svn svnlite=svn svnadmin svnadmin-static=svnadmin +#compdef svn svnlite=svn svnadmin svnadmin-static=svnadmin svnliteadmin=svnadmin _svn () { local curcontext="$curcontext" state line expl ret=1 @@ -68,7 +68,6 @@ _svn () { ;; args) local cmd args usage idx - typeset -gHA _cache_svn_status _cache_svn_mtime cmd="${${(k)_svn_cmds[(R)*:$words[1]:*]}:-${(k)_svn_cmds[(i):$words[1]:]}}" if (( $#cmd )); then @@ -123,7 +122,7 @@ _svn () { case $cmd in; (add) args+=( - '*:file:_files -g "*(e:_svn_uncontrolled:)"' + '*:file: _svn_modified "addable"' ) ;; (auth) @@ -141,17 +140,17 @@ _svn () { (commit) args=( ${args/(#b)(*--file*):arg:/$match[1]:file:_files} - '*:file:_files -g "*(e:_svn_status:)"' + '*:file: _svn_modified "committable"' ) ;; (delete) args+=( - '*:file:_files -g ".svn(/e:_svn_deletedfiles:)"' + '*:file:_files -g "*(e:_svn_controlled:)"' ) ;; (diff) args+=( - '*: : _alternative "files:file:_files -g \*\(e:_svn_status:\)" "urls:URL:_svn_urls"' + '*: : _alternative "files:file: _svn_modified revertable" "urls:URL:_svn_urls"' ) ;; (help) @@ -201,7 +200,7 @@ _svn () { ;; (revert) args+=( - '*:file:_files -g "(.svn|*)(/e:_svn_deletedfiles:,e:_svn_status:)"' + '*:file: _svn_modified "revertable"' ) ;; (x-unshelve) @@ -351,50 +350,76 @@ _svn_controlled() { # because 1.6 has been deprecated for 8 years and EOL for 6 years, we opt to DTRT # for >=1.7. Therefore: - # TODO: Reimplement this function and _svn_uncontrolled for svn>=1.7. + # TODO: Reimplement this function for svn>=1.7. # (Use 'svn st' or 'svn info', not 'svn ls') return 0 } -(( $+functions[_svn_uncontrolled] )) || -_svn_uncontrolled() { - # TODO: See comments in _svn_controlled - return 0 -} - (( $+functions[_svn_conflicts] )) || _svn_conflicts() { - () { (( $# > 0 )) } $REPLY.(mine|r<->)(NY1) + # ### These strings are actually translatable + # + # The asterisks are to support an optional extension; see + # "preserved-conflict-file-exts" in ~/.subversion/config. + () { (( $# > 0 )) } $REPLY.(mine|r<->|working*|merge-left*|merge-right*)(NY1) } -(( $+functions[_svn_deletedfiles] )) || -_svn_deletedfiles() { - # Typical usage would be _files -g '.svn(/e:_svn_deletedfiles:)' - local cont controlled - reply=( ) - [[ $REPLY = (*/|).svn ]] || return - controlled=( $REPLY/text-base/*.svn-base(N:r:t) ) - for cont in ${controlled}; do - [[ -e $REPLY:h/$cont ]] || reply+=( ${REPLY%.svn}$cont ) - done -} +(( $+functions[_svn_modified] )) || +_svn_modified() { + setopt localoptions extendedglob + + local depth dir expl maybe_quiet partial_word space=' ' -(( $+functions[_svn_status] )) || -_svn_status() { - local dir=$REPLY:h - local pat="${1:-([ADMR~]|?M)}" + local svn_context=$1 - zmodload -F zsh/stat b:zstat 2>/dev/null - local key="$(zstat +device $dir):$(zstat +inode $dir)" - local mtime="$(zstat +mtime $dir/.svn/entries)" + local partial_word=${(Q)words[CURRENT]} + if [[ -z $partial_word ]]; then + dir="./" + elif [[ -d $partial_word ]]; then + dir=$partial_word + else + dir=${partial_word:h} + fi - if (( ! $+_cache_svn_status[$key] || _cache_svn_mtime[$key] != mtime )); then - _cache_svn_status[$key]="$(_call_program files svn status -N $dir)" - _cache_svn_mtime[$key]="$mtime" + if zstyle -T ":completion:${curcontext}:${curtag}" verbose; then + depth=infinity + else + depth=immediates fi - (( ${(M)#${(f)_cache_svn_status[$key]}:#(#s)${~pat}*$REPLY} )) + if [[ $svn_context = addable ]]; then + maybe_quiet="" + else + maybe_quiet="-q" + fi + + local -a status_lines + # Run 'status' + status_lines=( ${(f)"$(_call_program modified-files "svn status $maybe_quiet --depth=${(q)depth} -- ${(q)dir}")"} ) + # Filter to only the right set of statuses + case $svn_context in + (committable) + status_lines=( ${(M)status_lines:#(#s)([ADMR]?|?M)${space}???${space}${space}*} ) + ;; + (revertable) + status_lines=( ${(M)status_lines:#(#s)([ACDMR~!]?|?[CM])${space}????${space}*} ) + ;; + (addable) + # The 'D' is just in case there's an unversioned file of the same name as the deleted file + status_lines=( ${(M)status_lines:#(#s)[?ID]${space}${space}???${space}${space}*} ) + ;; + esac + # Strip the 7 status-letter columns and the column of spaces + status_lines=( ${status_lines#????????} ) + # Strip one leading space. This is in case `svn status` ever adds another + # column. If that hasn't happened and you're reading this comment because + # the following line broke your use of filenames that start with a literal + # space, well, nice to meet you! I didn't know you existed. + status_lines=( ${status_lines#${space}} ) + + _wanted svn-modified expl 'modified files in svn' \ + compadd - "${status_lines[@]}" } (( $+functions[_svn_remote_paths] )) || diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo index 41e32cbae..29e5e6d75 100644 --- a/Completion/Unix/Command/_sudo +++ b/Completion/Unix/Command/_sudo @@ -2,9 +2,9 @@ setopt localoptions extended_glob -local environ e cmd -local -a args -local -a _comp_priv_prefix +local environ e cmd cpp +local -a args _comp_priv_prefix +local -A opt_args zstyle -a ":completion:${curcontext}:" environ environ @@ -14,7 +14,9 @@ done args=( '(-A --askpass)'{-A,--askpass}'[use a helper program for password prompting]' + '(-B --bell)'{-B,--bell}'[ring bell when prompting]' '(-C --close-from)'{-C+,--close-from=}'[close file descriptors]:lowest fd to close' + '(-D --chdir)'{-D+,--chdir=}'[change the working directory before running command]:directory:_directories' '(-g --group)'{-g+,--group=}'[run command as the specified group name or ID]:group:_groups' '(-)'{-h,--help}'[display help message and exit]' '(-h --host)'{-h+,--host=}'[run command on host]:host:_hosts' @@ -23,6 +25,7 @@ args=( \*{-l,--list}"[list user's privileges or check a specific command]" '(-n --non-interactive)'{-n,--non-interactive}'[non-interactive mode, no prompts are used]' '(-p --prompt)'{-p+,--prompt=}'[use the specified password prompt]:prompt' + '(-R --chroot)'{-R+,--chroot=}'[change the root directory before running command]:directory:_directories' '(-r --role)'{-r+,--role=}'[create SELinux security context with specified role]: :_selinux_roles' '(-S --stdin)'{-S,--stdin}'[read password from standard input]' '(-t --type)'{-t+,--type=}'[create SELinux security context with specified type]: :_selinux_types' @@ -42,6 +45,10 @@ if [[ $service = sudoedit ]] || (( $words[(i)-e] < $words[(i)^(*sudo|-[^-]*)] )) args=( -A "-*" $args '!(-V --version -h --help)-e' '*:file:_files' ) else cmd="$words[1]" + cpp='_comp_priv_prefix=( + $cmd -n + ${(kv)opt_args[(I)(-[ugHEP]|--(user|group|set-home|preserve-env|preserve-groups))]} + )' args+=( '(-e --edit 1 *)'{-e,--edit}'[edit files instead of running a command]' \ '(-s --shell)'{-s,--shell}'[run shell as the target user; a command may also be specified]' \ @@ -51,8 +58,8 @@ else '(-E -i --login -s --shell -e --edit)--preserve-env=-[preserve user environment when running command]::environment variable:_sequence _parameters -g "*export*"' \ '(-H --set-home -i --login -s --shell -e --edit)'{-H,--set-home}"[set HOME variable to target user's home dir]" \ '(-P --preserve-groups -i -login -s --shell -e --edit)'{-P,--preserve-groups}"[preserve group vector instead of setting to target's]" \ - '(-)1:command: _command_names -e' - '*::arguments:{ _comp_priv_prefix=( $cmd -n ${(kv)opt_args[(I)(-[ugHEP]|--(user|group|set-home|preserve-env|preserve-groups))]} ) ; _normal }' + "(-)1: :{ $cpp; _command_names -e }" + "*:: :{ $cpp; _normal }" ) fi diff --git a/Completion/Unix/Command/_surfraw b/Completion/Unix/Command/_surfraw index f945f1ca9..d153cd493 100644 --- a/Completion/Unix/Command/_surfraw +++ b/Completion/Unix/Command/_surfraw @@ -20,11 +20,11 @@ case $state in subcmd) args=( '-help[display help information]' - '*:string:_guard "^-*" "search string"' + '*: :_guard "^-*" "search string"' ) case "$words[1]" in ask|cia|cnn|deblogs|excite|filesearching|foldoc|happypenguin|slashdot|slinuxdoc|sundocs|sunsolve|xxx) - _message -e string 'search string' + _message -e strings 'search string' ;; alioth) _arguments $args \ @@ -64,10 +64,10 @@ case $state in '*:search string' && ret=0 ;; ctan) - _arguments $args \ - '-name[search by filename]' \ - '-desc[search descriptions (default)]'\ - '-doc[search documentation]' + _arguments $args \ + '-name[search by filename]' \ + '-desc[search descriptions (default)]'\ + '-doc[search documentation]' ;; currency) _arguments \ @@ -164,8 +164,8 @@ case $state in '-doc[view PTS documentation]' && ret=0 ;; debsec) - _message -e string 'package name, bug number or CVE ID' - ;; + _message -e strings 'package name, bug number or CVE ID' + ;; deja) _arguments $args \ '-results=-:[number of results to return]' \ @@ -183,7 +183,7 @@ case $state in ;; ebay) _arguments $args \ - '-country=-:country:(com de uk fr)' \ + '-country=-:country:(com de uk fr)' \ '-results=-:[number of results to return]:number' && ret=0 ;; etym) @@ -220,7 +220,7 @@ case $state in _deb_packages avail && ret=0 ;; fsfdir) - _arguments $args + _arguments $args ;; google) _arguments $args \ @@ -229,19 +229,19 @@ case $state in '-search=-:topic:(bsd linux mac unclesam)' && ret=0 ;; gutenberg) - _arguments $args \ - '-title[search titles (default)]' - '-author[search authors]' - '-num[search etext numbers]' - ;; + _arguments $args \ + '-title[search titles (default)]' + '-author[search authors]' + '-num[search etext numbers]' + ;; imdb) _arguments $args \ '-category=-:category:(All Titles MyMovies People Characters Quotes Bios Plots)' && ret=0 ;; ixquick) - _arguments $args \ - '-search=-:search type:(web pics)' \ - '-lang=-:language:(english dansk deutsch espanol francais italiano nederlands norsk polski portugues suomi svenska turkce jiantizhongwen nihongo fantizhengwen hangul)' + _arguments $args \ + '-search=-:search type:(web pics)' \ + '-lang=-:language:(english dansk deutsch espanol francais italiano nederlands norsk polski portugues suomi svenska turkce jiantizhongwen nihongo fantizhengwen hangul)' ;; jake) _arguments $args \ @@ -261,9 +261,9 @@ case $state in '-head=:display headlines:(on off)' \ '-grid=:show results in grid:(on off)' \ '-spell=:spelling tolerance:(off standard force)' \ - '*:dictionary word:->dictword' && ret=0 + '*:dictionary word:->words' && ret=0 - [[ "$state" = dictword ]] && _wanted words expl 'dictionary word' \ + [[ "$state" = words ]] && _wanted words expl 'dictionary word' \ compadd $(look "${PREFIX}") && ret=0 ;; netbsd|openbsd) @@ -386,20 +386,20 @@ case $state in :URL:_urls && ret=0 ;; wayback) - _arguments $args \ - '-syear=-[start search from this year]:year' \ - '-smonth=-:[start search from this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \ - '-sday=-[start search from this day]:number' \ - '-eyear=-[end search in this year]:year' \ - '-emonth=-[end search in this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \ - '-eday=-[end search in this day]:number' \ - '-list[list all pages that match search criteria]' \ - '-dups[show dups]' \ - '-compare[compare pages]' \ - '-pdf[show as PDF]' \ - '-alias=-[how to handle site aliases]:alias:(merge show hide)' \ - '-redir=-[how to handle redirections]:redir:(hide flag show)' \ - '-type=-[file type to search for]:type:(image audio video binary text pdf)' + _arguments $args \ + '-syear=-[start search from this year]:year' \ + '-smonth=-:[start search from this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \ + '-sday=-[start search from this day]:number' \ + '-eyear=-[end search in this year]:year' \ + '-emonth=-[end search in this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \ + '-eday=-[end search in this day]:number' \ + '-list[list all pages that match search criteria]' \ + '-dups[show dups]' \ + '-compare[compare pages]' \ + '-pdf[show as PDF]' \ + '-alias=-[how to handle site aliases]:alias:(merge show hide)' \ + '-redir=-[how to handle redirections]:redir:(hide flag show)' \ + '-type=-[file type to search for]:type:(image audio video binary text pdf)' ;; wetandwild) _arguments \ @@ -422,14 +422,32 @@ case $state in '-results=-[specify number of results to return]:number' && ret=0 ;; yubnub) - _message -e command 'Yubnub Command' + _message -e commands 'Yubnub Command' + ;; + *) + _message -e strings 'search string' ;; esac ;; elvi) - _wanted elvi expl elvi compadd \ - ${${${(f)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##--*}%:*} && ret=0 + local -UT XDG_CONFIG_DIRS xdg_config_dirs + local it + # list the applets + set -- ${${(f)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##-- *} + shift # the first line is a header: remove it + # then list the bookmarks + for it in \ + $^xdg_config_dirs/surfraw/bookmarks(Nr) \ + /etc/xdg/surfraw/bookmarks(Nr) \ + /etc/surfraw.bookmarks(Nr) \ + ${XDG_CONFIG_HOME-$HOME/.config}/surfraw/bookmarks(Nr) \ + $HOME/.surfraw.bookmarks(Nr) + do + read -d'\0' it < $it + set -- "$@" ${${(f)it}%%[[:space:]]*} + done + _wanted elvi expl elvi compadd "$@" && ret=0 ;; -esac +esac return ret diff --git a/Completion/Unix/Command/_tail b/Completion/Unix/Command/_tail index 3bfbe37ca..e54a0b06e 100644 --- a/Completion/Unix/Command/_tail +++ b/Completion/Unix/Command/_tail @@ -43,7 +43,7 @@ else '(-v)-q[never output headers giving file names]' ) ;| - (netbsd*) + (dragonfly*|netbsd*) args+=( '(-q)-v[always output headers giving file names]' ) ;; esac @@ -53,20 +53,14 @@ _arguments -C -s -S $opts : $args '*:file:_files' && return case $state in (number) - local mlt sign digit - mlt='multipliers:multiplier:((b\:512 K\:1024 KB\:1000 M\:1024\^2' - mlt+=' MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4))' - sign='signs:sign:((+\:"start at the specified byte/line"' - sign+=' -\:"output the last specified bytes/lines (default)"))' - digit='digits:digit:(0 1 2 3 4 5 6 7 8 9)' - if compset -P '(-|+|)[0-9]##'; then - _alternative $mlt $digit && ret=0 - elif [[ -z $PREFIX ]]; then - _alternative $sign $digit && ret=0 - elif compset -P '(+|-)'; then - _alternative $digit && ret=0 - fi - ;; + local alts + [[ -z $PREFIX ]] && alts=( + 'sign:sign:((-\:"print all but the last specified bytes/lines" +\:"print the first specified bytes/lines (default)"))' + ) + compset -P '+' + alts+=( 'numbers: :_numbers -N $state_descr b\:512 K\:1024 KB\:1000 M\:1024\^2 MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4' ) + _alternative $alts && ret=0 + ;; esac return ret diff --git a/Completion/Unix/Command/_tex b/Completion/Unix/Command/_tex index 9943fe10c..f1428c494 100644 --- a/Completion/Unix/Command/_tex +++ b/Completion/Unix/Command/_tex @@ -26,4 +26,4 @@ _arguments : \ '-8bit[make all characters printable by default]' \ '-help[display this help and exit]' \ '-version[output version information and exit]' \ - '*:TeX or LaTeX file:_files -g "*.(tex|TEX|texinfo|texi)(-.)"' + '*:TeX or LaTeX file:_files -g "*.(tex|TEX|texinfo|texi|dtx)(-.)"' diff --git a/Completion/Unix/Command/_texinfo b/Completion/Unix/Command/_texinfo index b356ddbe7..2f5d0f91f 100644 --- a/Completion/Unix/Command/_texinfo +++ b/Completion/Unix/Command/_texinfo @@ -36,14 +36,14 @@ local -A opt_args infodirs case $service in info) cmd=${words[1]} - _arguments -C -s \ + _arguments -C -s -S \ '(-a --all)'{-a,--all}'[use all matching manuals]' \ '(: -)'{-k+,--apropos=}'[look up string in indices]:search string: ' \ \*{-d+,--directory=}'[add directory to infopath]:info dir:_files -/' \ '--dribble=[record keystrokes]:file with keystrokes:_files' \ - '(-f --file 1)'{-f+,--file=}'[specify Info manual to visit]:info manual:->infofiles' \ + '(-f --file 1)'{-f+,--file=}'[specify Info manual to visit]:info manual:->infofiles+' \ '(: - -h --help)'{-h,--help}'[display usage]' \ - '(-o --output -O)--index-search=[go directly to node if found]:search string: ' \ + '(-o --output -O)--index-search=[search for matching index entry]:search string:->index-entries' \ '(--index-search -o --output -O)'{-o+,--output=}'[dump selected nodes to filename]:filename:_files -g "*(-.)"' \ '--init-file=[specify initialisation file]:file:_files' \ '(-n --node)'{-n+,--node=}'[specify nodes in first visited Info file]:node:->nodes' \ @@ -289,7 +289,11 @@ if [[ -n $state ]]; then items=( ${${${(M)${(f)"$(_call_program menu-items info -o-)"}:#(#s)\* *: \(*}#??}%%\)*} ) files+=( ${items##*\(} ) tags=( info-files ) - if [[ $state != infofiles ]]; then + if [[ $state = infofiles+ && $PREFIX$SUFFX = */* ]]; then + # local files allowed + tags+=(files) + fi + if [[ $state != infofiles* ]]; then tags+=( menu-items ) items=( ${items%:*} ) fi @@ -301,6 +305,13 @@ if [[ -n $state ]]; then tags+=( info-nodes ) fi items=( ${${${(M)${(f)"$(_call_program menu-items info -o- $file)"}:#(#s)\* *::*}%%::*}#??} ) + elif [[ $state = index-entries ]]; then + if [[ -n $file ]]; then + tags=( index-entries ) + items=( ${${${(M)${(f)"$(_call_program index-entries info -o- --all --index-search= $file)"}:#(#s)\* *:*}%%:*}#??} ) + else + _message -e index-entries $state_descr + fi fi _tags $tags @@ -308,7 +319,9 @@ if [[ -n $state ]]; then while _tags; do _requested info-files expl 'info file' compadd $suf -M 'm:{a-zA-Z}={A-Za-z}' -a files && ret=0 _requested menu-items expl 'menu item' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a items && ret=0 + _requested -x index-entries expl 'index entry' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a items && ret=0 _requested info-nodes expl 'node' compadd -M 'm:{a-zA-Z}={A-Za-z}' ${nodes#*:} && ret=0 + _requested files expl 'file' && _files -g '*.info(|.gz|.bz2)' (( ret )) || break done diff --git a/Completion/Unix/Command/_tidy b/Completion/Unix/Command/_tidy index 3998ccdb3..35ceb7e51 100644 --- a/Completion/Unix/Command/_tidy +++ b/Completion/Unix/Command/_tidy @@ -12,7 +12,7 @@ opts=( ${(M)opts:#*:*} ) _arguments -s -A "-*" --$^opts \ '(-indent -i)'{-indent,-i}'[indent element content]' \ - '-wrap[wrap text at the specified <column> (default is 68)]:column:' \ + '-wrap[wrap text at the specified column]:column [68]' \ '(-upper -u)'{-upper,-u}'[force tags to upper case (default is lower case)]' \ '(-clean -c)'{-clean,-c}'[replace FONT, NOBR and CENTER tags by CSS]' \ '(-bare -b)'{-bare,-b}'[strip out smart quotes and em dashes, etc.]' \ diff --git a/Completion/Unix/Command/_tiff b/Completion/Unix/Command/_tiff index da55b541c..ef12777de 100644 --- a/Completion/Unix/Command/_tiff +++ b/Completion/Unix/Command/_tiff @@ -59,6 +59,7 @@ tiff2pdf) '-s+[set document subject, overrides image image description default]:subject' \ '-k+[set document keywords]:keywords' \ '-b[set PDF "Interpolate" user preference]' \ + '-m+[set memory allocation limit]:limit (MiB)' \ '(- :)-h[display usage information]' \ ':input file:_files -g "*.(#i)tif(|f)(-.)"' ;; @@ -83,6 +84,7 @@ tiff2ps) '-i+[enable/disable (Nz/0) pixel interpolation]:state [enabled]:((0\:disable 1\:enable))' \ '-l+[set the left margin]:margin (inches)' \ '-m[use "imagemask" operator instead of "image"]' \ + '-M+[set memory allocation limit]:limit (MiB)' \ '-o+[set initial TIFF directory (file offset)]:file offset (bytes)' \ '(-e)-p[generate non-Encapsulated PostScript]' \ '-O+[specify output file]:output file:_files -g "*.(#i)(|e)ps(-.)"' \ @@ -121,6 +123,7 @@ tiffcp) '-i[ignore read errors]' \ '-b+[specify bias (dark) monochrome image to be subtracted from all others]:file:_files' \ '-,=-[specify substitute character for image indices]:character [,]' \ + '-m+[set memory allocation limit]:limit (MiB)' \ '-r+[specify rows per strip]:rows per strip' \ '-w+[specify output tile width]:output tile width' \ '-l+[specify output tile length]:output tile length' \ diff --git a/Completion/Unix/Command/_timeout b/Completion/Unix/Command/_timeout index 5c27bee47..c041283ac 100644 --- a/Completion/Unix/Command/_timeout +++ b/Completion/Unix/Command/_timeout @@ -2,8 +2,8 @@ local args -if [[ $service = g* || $OSTYPE != *bsd* ]]; then - # GNU coreutils as opposed to Free/NetBSD implementation +if [[ $service = g* || $OSTYPE != *(freebsd|netbsd|openbsd)* ]]; then + # GNU coreutils or DFly as opposed to Free/Net/OpenBSD implementation args=( '(-v --verbose)'{-v,--verbose}'[indicate when signal is sent upon timeout]' '(- *)--help[display usage information]' @@ -15,6 +15,6 @@ _arguments -S -A "-" $args \ '--preserve-status[always exit with the same status as command even if it times out]' \ "--foreground[don't propagate timeout to the command children]" \ '(-s --signal)'{-s,--signal}'[specify the signal to send on timeout]:signal:_signals' \ - '(-k --kill-after)'{-k,--kill-after}'[followup first signal with SIGKILL if command persists after specified time]:time:time' \ - '1: :_guard "[0-9.]#([smhd]|)" duration' \ + '(-k --kill-after)'{-k,--kill-after}'[followup first signal with SIGKILL if command persists after specified time]:time' \ + '1: :_numbers -f -u seconds duration :s:seconds m:minutes h:hours d:days' \ '*:::command:_normal' diff --git a/Completion/Unix/Command/_tla b/Completion/Unix/Command/_tla index 1e4cdd8d9..ec7e76d44 100644 --- a/Completion/Unix/Command/_tla +++ b/Completion/Unix/Command/_tla @@ -45,8 +45,8 @@ _tla_revisions () { _arch_namespace tla 4 "$argv[@]" } (( $+functions[_tla_local_revisions] )) || _tla_local_revisions () { local expl1 expl2 tree_version=`$TLA tree-version` - _description -V applied-patches expl1 "patches from this version" - _description -V other-patches expl2 "patches from other versions" + _description -V applied-patches expl1 "patch from this version" + _description -V other-patches expl2 "patch from other versions" compadd "$expl1[@]" `$TLA logs` compadd "$expl2[@]" `$TLA logs --full $($TLA log-versions | grep -v $tree_version)` # This is incredibly slow. @@ -73,7 +73,7 @@ _tla_config () { if [[ -d "$root/configs" ]]; then configdir=("$root/configs") - _description files expl '%Bconfig file%b' + _description files expl 'config file' _files -W configdir "$expl[@]" && ret=0 else _message -e messages "No configs/ directory in tree whose root is $root" @@ -90,7 +90,7 @@ _tla_limit () { #presently only does push-mirror style limits if [ $archive ]; then if [[ $PREFIX != *--* ]]; then - _description -V categories expl "categories in $archive" + _description -V categories expl "category in $archive" compadd -q -S -- "$expl[@]" `$TLA categories -A $archive` else _tla_namespace_branches 3 @@ -107,7 +107,7 @@ _tla_tree_or_rev () { _tla_libraries () { local libraries expl libraries=($(_call_program tla $TLA my-revision-library)) - _description -V libraries expl "revision libraries" + _description -V libraries expl "revision library" compadd "$expl[@]" -a libraries } @@ -128,7 +128,7 @@ _tla_log_versions () { else logs=($(_call_program tla $TLA logs)) fi - _description -V versions expl "log versions" + _description -V versions expl "log version" compadd "$expl[@]" -a logs } @@ -278,12 +278,12 @@ methods=( cmd_tagging_method=($cmd_id_tagging_method) local cmd_add cmd_add_id cmd_add_tag -cmd_add=('*:files to add:_files') +cmd_add=('*:file to add:_files') cmd_add_id=($cmd_add) cmd_add_tag=($cmd_add) local cmd_delete cmd_delete_id cmd_delete_tag -cmd_delete=('*:files to delete:_files') +cmd_delete=('*:file to delete:_files') cmd_delete_id=($cmd_delete) cmd_delete_tag=($cmd_delete) @@ -312,7 +312,7 @@ cmd_changeset=( ':ORIG:_files -/' ':MOD:_files -/' ':DEST:_files -/' - '*:files:_files' + '*:file:_files' ) cmd_mkpatch=("$cmd_changeset[@]") @@ -328,7 +328,7 @@ local cmd_make_archive cmd_make_archive=('::name:' ':location:_files -/') local cmd_archive_setup -cmd_archive_setup=('*:versions:_tla_branches --trailing-dashes') +cmd_archive_setup=('*:version:_tla_branches --trailing-dashes') local cmd_make_category cmd_make_category=(':category:_tla_archives -S /') @@ -344,7 +344,7 @@ cmd_import=('::version:_tla_versions') cmd_imprev=($cmd_import) local cmd_commit cmd_cmtrev -cmd_commit=('::version:_tla_versions' ':separator:(--)' '*:files:_files') +cmd_commit=('::version:_tla_versions' ':separator:(--)' '*:file:_files') cmd_cmtrev=($cmd_commit) local cmd_get cmd_getrev @@ -619,7 +619,7 @@ _tla_main () { local -U cmds help=(${(f)"$($TLA help)"}) cmds=(${${${${(M)help:#* :*}/ #: #/:}%% ##}## #}) - arguments=(':commands:(($cmds))') + arguments=(':command:(($cmds))') fi _arguments -S -A '-*' \ {"${hide_short}(: -)-V",'(: -)--version'}'[display version]' \ diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux index b564c955d..844af58fc 100644 --- a/Completion/Unix/Command/_tmux +++ b/Completion/Unix/Command/_tmux @@ -125,7 +125,9 @@ _tmux_aliasmap=( # status line confirm confirm-before + menu display-menu display display-message + popup display-popup # buffers clearhist clear-history @@ -167,17 +169,19 @@ _tmux-attach-session() { _arguments -s \ '-c+[specify working directory for the session]:directory:_directories' \ '-d[detach other clients attached to target session]' \ + '-f+[set client flags]: :_tmux_client_flags' \ '-r[put the client into read-only mode]' \ '-t+[specify target session]:target session: __tmux-sessions-separately' \ - "-E[don't apply update-environment option]" + "-E[don't apply update-environment option]" \ + '-x[with -d, send SIGHUP to the parent of the attached client]' } _tmux-bind-key() { [[ -n ${tmux_describe} ]] && print "bind a key to a command" && return _arguments -s -A "-*" \ - '-c[bind to command mode instead of normal mode]' \ '-n[make the binding work without the need for the prefix key]' \ '-r[the key may repeat]' \ + '-N+[attach a note to the key]:note' \ '-T+[specify key table for the binding]:key table' \ '1:key' \ '*:::template:= _tmux' @@ -186,6 +190,8 @@ _tmux-bind-key() { _tmux-break-pane() { [[ -n ${tmux_describe} ]] && print "break a pane from an existing into a new window" && return _arguments -s \ + '(-b)-a[move window to next index after]' \ + '(-a)-b[move window to next index before]' \ "-d[don't make the new window become the active one]" \ '-F+[specify output format]:format:__tmux-formats' \ '-P[print information of new window after it has been created]' \ @@ -202,7 +208,8 @@ _tmux-capture-pane() { '-C[escape non-printable characters as octal \\ooo]' \ '-e[include escape sequences for attributes etc]' \ '-E[specify last line to capture]:line number (- means last line)' \ - '-J[join wrapped lines and preserve trailing space]' \ + '(-N)-J[join wrapped lines and preserve trailing space]' \ + '(-J)-N[preserve trailing space]' \ '-q[ignore errors when trying to access alternate screen]' \ '(-b)-p[print data to stdout]' \ '-P[only capture beginnings of as-yet incomplete escape sequences]' \ @@ -214,8 +221,11 @@ _tmux-choose-buffer() { [[ -n ${tmux_describe} ]] && print "put a pane into buffer choice mode" && return _arguments -s \ '-N[start without the preview]' \ + '-Z[zoom the pane]' \ + '-r[reverse sort order]' \ '-F+[specify format for each list item]:format:__tmux-formats' \ '-f+[filter items]:filter format:__tmux-formats' \ + '-K+[specify format for each shortcut key]:format:__tmux-formats' \ '-O+[initial sort order]:order:(time name size)' \ '-t+[specify target window]:session:__tmux-windows' \ '*:::template:= _tmux' @@ -225,8 +235,11 @@ _tmux-choose-client() { [[ -n ${tmux_describe} ]] && print "put a window into client choice mode" && return _arguments -s \ '-N[start without the preview]' \ + '-Z[zoom the pane]' \ + '-r[reverse sort order]' \ '-F+[specify format for each list item]:format:__tmux-formats' \ '-f+[filter items]:filter format:__tmux-formats' \ + '-K+[specify format for each shortcut key]:format:__tmux-formats' \ '-O+[initial sort order]:order:(time name size)' \ '-t+[specify target window]:session:__tmux-windows' \ '*:::template:= _tmux' @@ -237,8 +250,11 @@ _tmux-choose-tree() { _arguments -s \ '-G[include all sessions in any session groups in the tree rather than only the first]' \ '-N[start without the preview]' \ + '-Z[zoom the pane]' \ + '-r[reverse sort order]' \ '-F+[specify format for each list item]:format:__tmux-formats' \ '-f+[filter items]:filter format:__tmux-formats' \ + '-K+[specify format for each shortcut key]:format:__tmux-formats' \ '-O+[initial sort order]:order:(time name size)' \ '-s[choose among sessions]' \ '-t+[specify target window]:session:__tmux-windows' \ @@ -260,11 +276,14 @@ _tmux-command-prompt() { [[ -n ${tmux_describe} ]] && print "open the tmux command prompt in a client" && return _arguments -s \ '-1[only accept one key press]' \ - '-N' \ + '-k[only accept one key press and translate it to a key name]' \ + '-N[accept only numeric key presses]' \ '-i[execute the command every time the prompt input changes]' \ '-I+[specify list of initial inputs]:initial-text (comma-separated list)' \ '-p+[specify list of prompts]:prompts (comma-separated list)' \ '-t+[specify target client]:client:__tmux-clients' \ + '(-W)-T[prompt is for a target - tab complete as appropriate]' \ + '(-T)-W[prompt is for a window - tab complete as appropriate]' \ '*:::template:= _tmux' } @@ -279,11 +298,25 @@ _tmux-confirm-before() { _tmux-copy-mode() { [[ -n ${tmux_describe} ]] && print "enter copy mode" && return _arguments -s \ + '-s+[specify source pane]:pane:__tmux-panes' \ '-t+[specify target pane]:pane:__tmux-panes' \ + '-e[scrolling to the bottom should exit copy mode]' \ + '-H[hide the position indicator in the top right]' \ + '-q[cancel copy mode and any other modes]' \ '-u[scroll up one page]' \ '-M[begin a mouse drag]' } +_tmux-customize-mode() { + [[ -n ${tmux_describe} ]] && print "enter customize mode" && return + _arguments -s \ + '-F+[specify format for each item in the tree]:format:__tmux-formats' \ + '-f+[specify initial filter]:filter:__tmux-formats' \ + '-N[start without the option information]' \ + '-t+[specify target pane]:pane:__tmux-panes' \ + '-Z[zoom the pane]' +} + _tmux-delete-buffer() { [[ -n ${tmux_describe} ]] && print "delete a paste buffer" && return _arguments '-b+[specify target buffer name]:buffer:__tmux-buffers' @@ -299,16 +332,48 @@ _tmux-detach-client() { '-t+[specify target client]:client:__tmux-clients' } +_tmux-display-menu() { + [[ -n ${tmux_describe} ]] && print "display a menu" && return + local curcontext="$curcontext" ret=1 + local -a state line expl + _arguments -C -s -S -A "-*" \ + '-c+[specify target client]:client:__tmux-clients' \ + "-O[don't close menu if mouse is released without making a selection]" \ + '-t+[specify target pane]:pane:__tmux-panes' \ + '-T+[specify title]:title' \ + '-x+[specify horizontal position]: : _alternative "columns\: \:_guard \[0-9\]\# column" "positions\:position\:((R\:right P\:bottom M\:mouse W\:window))"' \ + '-y+[specify vertical position]: : _alternative "rows\: \:_guard \[0-9\]\# row" "positions\:position\:((P\:left M\:mouse S\:status\ line))"' \ + '*::: :->options' && ret=0 + + if [[ -n $state ]]; then + case $(( CURRENT % 3 )) in + 1) _message -e menu-options 'menu option' ;; + 2) _message -e keys 'shortcut key' ;; + 0) + compset -q + words=( menu "$words[@]" ) + (( CURRENT++ )) + _tmux && ret=0 + ;; + esac + fi + + return ret +} + _tmux-display-message() { [[ -n ${tmux_describe} ]] && print "display a message in the status line" && return _arguments -s -S -A "-*" \ '(-p -F :)-a[list the format variables and their values]' \ + '-I[forward any input read from stdin to the target pane]' \ + '-N[ignore key presses and only close after the delay]' \ '-c+[specify target client]:client:__tmux-clients' \ + '-d+[time to display message]:delay (milliseconds)' \ '(-a)-p[print message to stdout]' \ '-t+[specify target pane]:pane:__tmux-panes' \ '(-a)-F+[specify output format]:format:__tmux-formats' \ - '(-a)-v[prints verbose logging as the format is parsed]' \ - ':message' + '(-a)-v[print verbose logging as the format is parsed]' \ + ':message:__tmux-formats' } _tmux-display-panes() { @@ -320,9 +385,26 @@ _tmux-display-panes() { '*:::command:= _tmux' } +_tmux-display-popup() { + [[ -n ${tmux_describe} ]] && print "display a popup box over a pane" && return + _arguments -s \ + '-C[close any popup on the client]' \ + '-c+[specify target client]:client:__tmux-clients' \ + '-d+[specify working directory for the command]:directory:_directories' \ + '-E[close the popup when the command exits]' \ + '-w+[specify width]:width' \ + '-h+[specify height]:height' \ + '-t+[specify target pane]:pane:__tmux-panes' \ + '-x+[specify horizontal position]:position' \ + '-y+[specify vertical position]:position' \ + ':shell command:_cmdstring' +} + _tmux-find-window() { [[ -n ${tmux_describe} ]] && print "search for a pattern in windows" && return _arguments -s \ + '-i[ignore case]' \ + '-r[use regular expression matching]' \ '-C[match visible contents]' \ '-N[match window name]' \ '-T[match window title]' \ @@ -354,13 +436,15 @@ _tmux-if-shell() { _tmux-join-pane() { [[ -n ${tmux_describe} ]] && print "split a pane and move an existing one into the new space" && return + # -p removed from documentation but still works, or use -l and append % _arguments -s \ '-b[join source pane left of or above target pane]' \ "-d[don't make the new window become the active one]" \ + '(-l)-f[span the full size]' \ '-h[split horizontally]' \ '-v[split vertically]' \ - "-l+[define new pane's size]: :_guard '[0-9]#' 'numeric value'" \ - "-p+[define new pane's size in percent]: :_guard '[0-9]#' 'numeric value'" \ + "(-p)-l[define new pane's size]:size" \ + "!(-f -l)-p+:size (percentage)" \ '-s+[specify source pane]:pane:__tmux-panes' \ '-t+[specify target pane]:pane:__tmux-panes' } @@ -397,6 +481,7 @@ _tmux-last-pane() { _arguments -s \ '-d[disable input to the pane]' \ '-e[enable input to the pane]' \ + '-Z[keep window zoomed if it was zoomed]' \ '-t+[specify session]:session:__tmux-sessions' } @@ -408,6 +493,8 @@ _tmux-last-window() { _tmux-link-window() { [[ -n ${tmux_describe} ]] && print "link a window to another" && return _arguments -s \ + '(-b)-a[move window to next index after destination window]' \ + '(-a)-b[move window to next index before destination window]' \ "-d[don't make the new window become the active one]" \ '-k[kill the target window if it exists]' \ '-s+[specify source window]:window:__tmux-windows' \ @@ -416,7 +503,9 @@ _tmux-link-window() { _tmux-list-buffers() { [[ -n ${tmux_describe} ]] && print "list paste buffers of a session" && return - _arguments '-F+[specify output format]:format:__tmux-formats' + _arguments \ + '-F+[specify output format]:format:__tmux-formats' \ + '-f+[filter items]:filter format:__tmux-formats' } _tmux-list-clients() { @@ -428,12 +517,16 @@ _tmux-list-clients() { _tmux-list-commands() { [[ -n ${tmux_describe} ]] && print "list supported sub-commands" && return - _arguments '-F+[specify format]:format' + _arguments '-F+[specify format]:format:__tmux-formats' '1:sub-command:_tmux' } _tmux-list-keys() { [[ -n ${tmux_describe} ]] && print "list all key-bindings" && return _arguments -s \ + '-1[list only the first matching key]' \ + '-a[list the command for keys that do have a note]' \ + '-N[list only keys with attached notes]' \ + '-P+[specify a prefix to print before each key]:prefix' \ '-T+[specify key table]:key table' } @@ -448,12 +541,15 @@ _tmux-list-panes() { _arguments -s $args \ '-a[list all panes the server possesses]' \ '-F+[specify output format]:format:__tmux-formats' \ + '-f+[filter items]:filter format:__tmux-formats' \ '-s[if specified, -t chooses a session]' } _tmux-list-sessions() { [[ -n ${tmux_describe} ]] && print "list sessions managed by server" && return - _arguments '-F+[specify output format]:format:__tmux-formats' + _arguments \ + '-F+[specify output format]:format:__tmux-formats' \ + '-f+[filter items]:filter format:__tmux-formats' } _tmux-list-windows() { @@ -461,6 +557,7 @@ _tmux-list-windows() { _arguments -s \ '-a[list all windows the tmux server possesses]' \ '-F[specify output format]:format:__tmux-formats' \ + '-f+[filter items]:filter format:__tmux-formats' \ '-t+[specify session]:session:__tmux-sessions' } @@ -468,6 +565,8 @@ _tmux-load-buffer() { [[ -n ${tmux_describe} ]] && print "load a file into a paste buffer" && return _arguments -A "-*" -S \ '-b+[specify target buffer name]:buffer:__tmux-buffers' \ + '-t+[specify target client]:client:__tmux-clients' \ + '-w[also send the buffer to the clipboard using the xterm escape sequence]' \ '1:file:_files' } @@ -487,21 +586,14 @@ _tmux-lock-session() { } _tmux-move-pane() { - [[ -n ${tmux_describe} ]] && print "move a pane into a new space" && return - _arguments -s \ - '-b[join source pane left of or above target pane]' \ - "-d[don't make the new window become the active one]" \ - '-h[split horizontally]' \ - '-v[split vertically]' \ - "-l+[define new pane's size]:numeric value" \ - "-p+[define new pane's size in percent]:numeric value" \ - '-s+[specify source pane]:pane:__tmux-panes' \ - '-t+[specify target pane]:pane:__tmux-panes' + _tmux-join-pane "$@" } _tmux-move-window() { [[ -n ${tmux_describe} ]] && print "move a window to another" && return _arguments -s \ + '(-b)-a[move window to next index after destination window]' \ + '(-a)-b[move window to next index before destination window]' \ "-d[don't make the new window become the active one]" \ '-k[kill the target window if it exists]' \ '-s+[specify source window]:window:__tmux-windows' \ @@ -512,31 +604,37 @@ _tmux-move-window() { _tmux-new-session() { [[ -n ${tmux_describe} ]] && print "create a new session" && return _arguments -s -A "-*" -S \ - '-A[attach to existing session if it already exists]' \ '-c+[specify working directory for the session]:directory:_directories' \ + '-A[attach to existing session if it already exists]' \ "-d[don't attach new session to current terminal]" \ - "-D[in case of -A behave like attach-session's -d]" \ + "-D[with -A, detach other clients attached to session]" \ "-E[don't apply update-environment option]" \ + '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \ '-F+[specify output format]:format:__tmux-formats' \ + '-f+[specify client flags]: :_tmux_client_flags' \ '-n+[specify initial window name]:window name' \ '-P[print information about new session after it is created]' \ '-s+[name the session]:session name:__tmux-sessions' \ '-t+[specify target session]:session:__tmux-sessions' \ '-x[specify width]:width' \ '-y[specify height]:height' \ + '-X[with -D, send SIGHUP to the parent of the attached client]' \ '*:: :_cmdambivalent' } _tmux-new-window() { [[ -n ${tmux_describe} ]] && print "create a new window" && return _arguments -s -A "-*" -S \ - '-a[insert new window at next free index from -t]' \ + '(-b)-a[insert new window at next index after target]' \ + '(-a)-b[insert new window at next index before target]' \ '-c+[specify working directory for the session]:directory:_directories' \ - "-d[don't make the new window become the active one]" \ + '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \ + "(-S)-d[don't make the new window become the active one]" \ '-F+[specify output format]:format:__tmux-formats' \ '-k[destroy it if the specified window exists]' \ '-n+[specify a window name]:window name' \ '-P[print information about new window after it is created]' \ + '(-d)-S[select window if name already exists]' \ '-t+[specify target window]:window:__tmux-windows' \ '*:: :_cmdambivalent' } @@ -588,10 +686,13 @@ _tmux-previous-window() { _tmux-refresh-client() { [[ -n ${tmux_describe} ]] && print "refresh a client" && return - _arguments -s -S -A "-*" \ + _arguments -s -A "-*" -S \ + '-B+[set a subscription to a format for a control mode client]:subscription' \ + '-A+[allow a control mode client to trigger actions on a pane]:pane:__tmux-panes -P% -S\:' \ '-C+[set the width and height of a control client]:width,height' \ '-c[reset so that the position follows the cursor]' \ '-D[move visible portion of window down]' \ + '-f+[set client flags]:flag:_tmux_client_flags' \ '-L[move visible portion of window left]' \ '-l[request clipboard from the client and store it in a new paste buf using xterm(1) escape sequence]' \ "-S[only update the client's status bar]" \ @@ -624,6 +725,7 @@ _tmux-resize-pane() { '-R[resize to the right]' \ '-U[resize upward]' \ '-t+[specify target pane]:pane:__tmux-panes' \ + '-T[trim lines below the cursor position and moves lines out of the history to replace them]' \ '-x+[specify width]:width' \ '-y+[specify height]:height' \ '-Z[toggle zoom of pane]' \ @@ -649,6 +751,7 @@ _tmux-respawn-pane() { [[ -n ${tmux_describe} ]] && print "reuse a pane in which a command has exited" && return _arguments -s -A "-*" -S \ '-c+[specify a new working directory for the pane]:directory:_directories' \ + '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \ '-k[kill window if it is in use]' \ '-t+[specify target pane]:pane:__tmux-pane' \ ':command:_cmdambivalent' @@ -658,6 +761,7 @@ _tmux-respawn-window() { [[ -n ${tmux_describe} ]] && print "reuse a window in which a command has exited" && return _arguments -s -A "-*" -S \ '-c+[specify a new working directory for the window]:directory:_directories' \ + '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \ '-k[kill window if it is in use]' \ '-t+[specify target window]:window:__tmux-windows' \ ':command:_cmdambivalent' @@ -668,15 +772,28 @@ _tmux-rotate-window() { _arguments -s \ '-D[rotate downward]' \ '-U[rotate upward]' \ + '-Z[keep the window zoomed if it was zoomed]' \ '-t+[specify target window]:window:__tmux-windows' } _tmux-run-shell() { [[ -n ${tmux_describe} ]] && print "execute a command without creating a new window" && return - _arguments -s -A "-*" -S \ - '-b[run shell command in background]' \ + local curcontext="$curcontext" ret=1 + local -a state line expl + _arguments -C -s -A "-*" -S \ + '-b[run command in background]' \ + '(1)-C[run a tmux command]' \ + '-d+[specify delay before starting the command]:delay (seconds)' \ '-t+[specify target pane]:pane:__tmux-panes' \ - ':command:_cmdstring' + '(2)1:command:_cmdstring' \ + '2:tmux command:->tmux-commands' && ret=0 + + if [[ -n $state ]]; then + compset -q + words=( run "$words[@]" ) + (( CURRENT++ )) + _tmux && ret=0 + fi } _tmux-save-buffer() { @@ -699,6 +816,7 @@ _tmux-select-layout() { _tmux-select-pane() { [[ -n ${tmux_describe} ]] && print "make a pane the active one in the window" && return + # -P and -g have been removed from the documentation in tmux 3 but still work _arguments -s \ '-D[move to the pane below target]' \ '-d[disable input to the pane]' \ @@ -710,6 +828,7 @@ _tmux-select-pane() { '-m[set marked pane]' \ '-R[move to the pane right of target]' \ '-U[move to the pane above target]' \ + '-Z[keep the window zoomed if it was zoomed]' \ '-P+[set pane style]:style:__tmux-style' \ '-T+[set the pane title]:title' \ '-t+[specify target pane]:pane:__tmux-panes' @@ -728,7 +847,9 @@ _tmux-select-window() { _tmux-send-keys() { [[ -n ${tmux_describe} ]] && print "send key(s) to a window" && return _arguments -s -A "-*" -S \ - '-l[disable key name lookup and send data literally]' \ + '(-H)-l[disable key name lookup and send data literally]' \ + '-F[expand formats in arguments where appropriate]' \ + '(-l)-H[interpret key as hexadecimal number for an ASCII character]' \ '-R[reset terminal state]' \ '-M[pass through a mouse event]' \ '-X[send a command into copy mode]' \ @@ -755,6 +876,8 @@ _tmux-set-buffer() { '-a[append to rather than overwriting target buffer]' \ '-b+[specify target buffer index]:pane:__tmux-buffers' \ '-n+[specify new buffer name]:buffer-name' \ + '-t+[specify target client]:client:__tmux-clients' \ + '-w[also send the buffer to the clipboard using the xterm escape sequence]' \ ':data' } @@ -764,7 +887,9 @@ _tmux-set-environment() { local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments -C -s -A "-*" -S : \ + '-F[expand value as a format]' \ '(-t)-g[modify global environment]' \ + '-h[mark the variable as hidden]' \ '(-u)-r[remove variable before starting new processes]' \ '(-r)-u[unset a variable]' \ '(-g)-t[specify target session]:target session:__tmux-sessions' \ @@ -801,8 +926,10 @@ _tmux-set-option() { '-o[prevent setting of an option that is already set]' \ '-q[suppress errors about unknown or ambiguous options]' \ '-u[unset a non-global option]' \ - '-w[change window (not session) options]' \ - '-s[change server (not session) options]' \ + '-U[unset a pane option across all panes in the window]' \ + '(-w -s)-p[change pane (no session) options]' \ + '(-p -s)-w[change window (not session) options]' \ + '(-p -w)-s[change server (not session) options]' \ '-t+[specify target session]:target session:__tmux-sessions' \ '*:: :->name_or_value' && ret=0 @@ -835,8 +962,11 @@ _tmux-set-window-option() { _tmux-set-hook() { [[ -n ${tmux_describe} ]] && print "set a hook to a command" && return _arguments -s \ + '-a[append to hook]' \ '(-R)-g[add hook to global list]' \ '(-g -u)-R[run hook immediately]' \ + '(-w)-p[set pane hooks]' \ + '(-p)-w[set window hooks]' \ '(-R)-u[unset a hook]' \ '-t+[specify target session]:session:__tmux-sessions' \ ':hook name:_tmux_hooks' \ @@ -847,6 +977,8 @@ _tmux-show-hooks() { [[ -n ${tmux_describe} ]] && print "show the global list of hooks" && return _arguments -s -S -A "-*" \ '-g[show global list of hooks]' \ + '(-w)-p[show pane hooks]' \ + '(-p)-w[show window hooks]' \ '-t+[specify target session]:session:__tmux-sessions' \ } @@ -862,6 +994,7 @@ _tmux-show-environment() { typeset -A opt_args _arguments -C -A "-*" -s : \ '(-t)-g[show global environment]' \ + '-h[show hidden variables]' \ '-s[format output as Bourne shell commands]' \ '(-g)-t+[specify target session]:target session:__tmux-sessions' \ '1:: :->name' && ret=0 @@ -888,11 +1021,14 @@ _tmux-show-options() { local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments -C -s : \ + '-A[include options inherited from a parent set]' \ + '-H[include hooks]' \ '-g[show global options]' \ '-q[suppress errors about unknown or ambiguous options]' \ - '-s[show server options]' \ '-v[show only the option value, not the name]' \ - '-w[show window options]' \ + '(-s -w)-p[show pane (not session) options]' \ + '(-p -w)-s[show server (not session) options]' \ + '(-p -s)-w[show window (not session) options]' \ '-t+[specify target session]:target session:__tmux-sessions' \ '*:: :->name_or_value' && ret=0 @@ -921,22 +1057,29 @@ _tmux-show-window-options() { _tmux-source-file() { [[ -n ${tmux_describe} ]] && print "execute tmux commands from a file" && return _arguments \ + '-F[expand path as a format]' \ + '-n[file is parsed but no commands are executed]' \ "-q[don't report error if path doesn't exist]" \ + '-v[show parsed commands and line numbers if possible]' \ '*:path:_directories' } _tmux-split-window() { [[ -n ${tmux_describe} ]] && print "splits a pane into two" && return + # -p removed from documentation but still works, or use -l and append % _arguments -s \ '-b[create new pane left of or above target pane]' \ "-d[don't make the new window become the active one]" \ + '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \ '-F+[specify output format]:format:__tmux-formats' \ - '-f[create new pane spanning full window width or height]' \ + '(-l)-f[create new pane spanning full window width or height]' \ '-h[split horizontally]' \ '-v[split vertically]' \ - "-l[define new pane's size]:size" \ - "-p[define new pane's size in percent]:size (percentage)" \ + "(-p)-l[define new pane's size]:size" \ + "!(-f -l)-p+:size (percentage)" \ '-t+[specify target pane]:pane:__tmux-panes' \ + '-Z[zoom the pane]' \ + '(:)-I[create empty pane and forward stdin to it]' \ ':command:_cmdambivalent' # Yes, __tmux-panes is correct here. The behaviour was changed # in recent tmux versions and makes more sense. Except that @@ -959,6 +1102,7 @@ _tmux-swap-pane() { _arguments -s \ '-D[move pane down]' \ '-U[move pane up]' \ + '-Z[keep the window zoomed if it was zoomed]' \ "-d[don't change the active pane]" \ '-s+[specify source pane]:pane:__tmux-panes' \ '-t+[specify destination pane]:pane:__tmux-panes' @@ -981,6 +1125,7 @@ _tmux-switch-client() { '-n[move client to next session]' \ '-p[move client to previous session]' \ '-r[toggle read-only flag of client]' \ + '-Z[keep the window zoomed if it was zoomed]' \ '-t+[specify target window]:window:__tmux-windows' } @@ -993,6 +1138,7 @@ _tmux-unbind-key() { _arguments -C -s \ '-a[remove all key bindings]' \ '-n[remove a non-prefix binding]' \ + '-q[prevent errors being returned]' \ '-T[specify key table]:key table' \ '*:: :->boundkeys' @@ -1042,7 +1188,7 @@ function __tmux-buffers() { fi buffers=( ${${(f)"$(command tmux 2> /dev/null list-buffers "${bopts[@]}")"}/:[ $'\t']##/:} ) - _describe -t buffers 'buffers' buffers + _describe -t buffers 'buffer' buffers } function __tmux-bound-keys() { @@ -1050,14 +1196,14 @@ function __tmux-bound-keys() { local -a keys keys=( ${${${${(f)"$(command tmux 2> /dev/null list-keys "$@")"}/:[ $'\t']##/:}/(#s)[ $'\t']##/}/(#s):/\\:} ) - _describe -t keys 'keys' keys + _describe -t keys 'key' keys } function __tmux-clients() { local expl local -a clients clients=( ${${(f)"$(command tmux 2> /dev/null list-clients)"}/:[ $'\t']##/:} ) - _describe -t clients 'clients' clients + _describe -t clients 'client' clients } function __tmux-environment-variables() { @@ -1093,7 +1239,7 @@ function __tmux-environment-variables() { descriptions+=( "${k//:/\\:}:$v" ) done # TODO: this if/else is because '_describe ${hint:+"-x"}' prints the "No matches" error in addition to the message. - local msg="${dash_g[1]:+"global "}environment variables${hint}" + local msg="${dash_g[1]:+"global "}environment variable${hint}" if _describe -t parameters $msg descriptions; then : elif [[ -n $hint ]]; then @@ -1311,6 +1457,11 @@ _tmux_hooks() { 'post-hooks:command post-hook:compadd - after-${_tmux_aliasmap}' } +_tmux_client_flags() { + _values -s , flag active-pane ignore-size no-output \ + 'pause-after:time (seconds)' read-only wait-exit +} + function __tmux-get-optarg() { local opt="$1" local -i i @@ -1535,23 +1686,18 @@ function __tmux-options-complete() { } function __tmux-panes() { - local expl line + local expl line orig="$IPREFIX" local -i num local -a panes opts - compset -P '*.' - if [[ -n ${IPREFIX} ]]; then - opts=( -t "${IPREFIX%.}" ) - else - opts=( ) - fi + compset -P '*.' && opts=( -t "${${IPREFIX%.}#$orig}" ) num=0 command tmux 2> /dev/null list-panes "${opts[@]}" | while IFS= read -r line; do panes+=( $(( num++ )):${line//:/} ) done - _describe -t panes 'panes' panes "$@" + _describe -t panes 'pane' panes "$@" if [[ ${IPREFIX} != *. ]]; then - _wanted windows expl 'windows' __tmux-windows -S. + _wanted windows expl 'window' __tmux-windows -S. fi } @@ -1576,14 +1722,14 @@ function __tmux-server-options() { function __tmux-sessions() { local -a sessions sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} ) - _describe -t sessions 'sessions' sessions "$@" + _describe -t sessions 'session' sessions "$@" } function __tmux-sessions-attached() { local -a sessions sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} ) sessions=( ${(M)sessions:#*"(attached)"} ) - _describe -t sessions 'attached sessions' sessions "$@" + _describe -t sessions 'attached session' sessions "$@" } # Complete attached-sessions and detached-sessions as separate tags. @@ -1599,8 +1745,8 @@ function __tmux-sessions-separately() { _tags detached-sessions attached-sessions # Placing detached before attached means the default behaviour of this # function better suits its only current caller, _tmux-attach-session(). - _requested detached-sessions && _describe -t detached-sessions 'detached sessions' detached_sessions "$@" && ret=0 - _requested attached-sessions && _describe -t attached-sessions 'attached sessions' attached_sessions "$@" && ret=0 + _requested detached-sessions && _describe -t detached-sessions 'detached session' detached_sessions "$@" && ret=0 + _requested attached-sessions && _describe -t attached-sessions 'attached session' attached_sessions "$@" && ret=0 return ret } @@ -1672,9 +1818,9 @@ function __tmux-windows() { opts=( ) fi wins=( ${${(M)${(f)"$(command tmux 2> /dev/null list-windows "${opts[@]}")"}:#<->*}/:[ $'\t']##/:} ) - _describe -t windows 'windows' wins "$@" + _describe -t windows 'window' wins "$@" if [[ ${IPREFIX} != *: ]]; then - _wanted sessions expl 'sessions' __tmux-sessions -S: + _wanted sessions expl 'session' __tmux-sessions -S: fi } @@ -1689,10 +1835,13 @@ _tmux() { '-2[force using 256 colours]' \ '-c[execute a shell command]:command name:_command_names' \ '-C[start tmux in control mode. -CC disables echo]' \ + "-D[don't start the tmux server as a daemon]" \ '-f[specify configuration file]:tmux config file:_files -g "*(-.)"' \ '-l[behave like a login shell]' \ '-L[specify socket name]:socket name:__tmux-socket-name' \ + "-N[don't start the server even if the command would normally do so]" \ '-S[specify socket path]:server socket:_path_files -g "*(=,/)"' \ + '-T+[set terminal features for the client]: : _values -s , 256 clipboard ccolour cstyle extkeys focus margins mouse overline rectfill RGB strikethrough sync title usstyle' \ '-u[force using UTF-8]' \ '-v[request verbose logging]' \ '-V[report tmux version]' \ @@ -1703,11 +1852,11 @@ _tmux() { if (( CURRENT == 1 )); then zstyle -s ":completion:${curcontext}:subcommands" mode mode || mode='both' if [[ ${mode} == 'commands' ]]; then - _describe -t subcommands 'tmux commands' _tmux_commands && ret=0 + _describe -t subcommands 'tmux command' _tmux_commands && ret=0 elif [[ ${mode} == 'aliases' ]]; then - _describe -t subcommands 'tmux aliases' _tmux_aliases && ret=0 + _describe -t subcommands 'tmux alias' _tmux_aliases && ret=0 else - _describe -t subcommands 'tmux commands and aliases' _tmux_commands -- _tmux_aliases && ret=0 + _describe -t subcommands 'tmux command or alias' _tmux_commands -- _tmux_aliases && ret=0 fi else tmuxcommand="${words[1]}" diff --git a/Completion/Unix/Command/_todo.sh b/Completion/Unix/Command/_todo.sh index 287c9ff78..99b6bb695 100644 --- a/Completion/Unix/Command/_todo.sh +++ b/Completion/Unix/Command/_todo.sh @@ -55,21 +55,26 @@ case $state in "append:adds to item on line NUMBER the text TEXT." "archive:moves done items from todo.txt to done.txt." "command:run internal commands only" + "deduplicate:removes duplicate lines from todo.txt." "del:deletes the item on line NUMBER in todo.txt." "depri:remove prioritization from item" + "done:marks task(s) on line ITEM# as done in todo.txt" "do:marks item on line NUMBER as done in todo.txt." "help:display help" "list:displays all todo items containing TERM(s), sorted by priority." "listall:displays items including done ones containing TERM(s)" + "listaddons:lists all added and overridden actions in the actions directory." "listcon:list all contexts" "listfile:display all files in .todo directory" "listpri:displays all items prioritized at PRIORITY." + "listproj:lists all the projects in todo.txt." "move:move item between files" "prepend:adds to the beginning of the item on line NUMBER text TEXT." "pri:adds or replace in NUMBER the priority PRIORITY (upper case letter)." "replace:replace in NUMBER the TEXT." "remdup:remove exact duplicates from todo.txt." "report:adds the number of open and done items to report.txt." + "showhelp:list the one-line usage of all built-in and add-on actions." ) _describe -t todo-commands 'todo.sh command' cmdlist ;; @@ -98,7 +103,7 @@ case $state in fi ;; - (depri|do|dp) + (depri|do|dp|done) nextstate=item ;; diff --git a/Completion/Unix/Command/_top b/Completion/Unix/Command/_top index 652432166..692df790d 100644 --- a/Completion/Unix/Command/_top +++ b/Completion/Unix/Command/_top @@ -64,7 +64,6 @@ case $OSTYPE in '-I[do not display idle processes]' '-i[interactive mode]' '-n[non-interactive mode (identical to batch mode)]' - '-o+[sort process display by the specified field]:field:( $fields )' '-p+[filter by the specified pid]: :_pids' '-q[renice top to -20]' '-S[show system processes]' @@ -80,6 +79,7 @@ case $OSTYPE in '-j[display the jail ID]' '-t[do not display the top process]' '-m+[specify statistic type]:type:(( cpu\:default io ))' + '-o+[sort process display by the specified field]:field:( $fields )' '-P[per-cpu CPU usage statistics]' '(1 -)-v[write version number and exit]' '-w[display approximate swap usage]' @@ -89,10 +89,14 @@ case $OSTYPE in );; openbsd*) fields+=( command ) + order=( '-:reverse order' ) specs+=( '-1[combine CPU statistic into one line]' + '-t[show the routing table instead of the wait channel]' '-C[show command arguments as well as process name]' '-g+[filter processes by the specified string]:string' + '-o+[sort process display by the specified field]:field:->sortkey' + '-T+[filter processes by the specified routing table]:routing table:_routing_tables' '-U+[filter processes by the specified user]: :_users -M "L\:|-="' );; darwin*) diff --git a/Completion/Unix/Command/_tput b/Completion/Unix/Command/_tput index a3b4e949c..abba3e8c0 100644 --- a/Completion/Unix/Command/_tput +++ b/Completion/Unix/Command/_tput @@ -14,5 +14,5 @@ esac _arguments : \ $args - set3 \ '(-S -V)-T+[terminal type]:terminal type:_terminals' \ - '1:terminal capabilities:( init reset longname ${(k)terminfo} )' \ + '1:terminal capability:( init reset longname ${(k)terminfo} )' \ '*:capability parameters:{ [[ $words[1] != (init|reset|longname) ]] && _message parameter }' diff --git a/Completion/Unix/Command/_transmission b/Completion/Unix/Command/_transmission index 8a4bebec3..a640f3dd7 100644 --- a/Completion/Unix/Command/_transmission +++ b/Completion/Unix/Command/_transmission @@ -6,17 +6,17 @@ local exclusive_auth_options='(-n --auth -ne --authenv -N --netrc)' local general_options=( {-d,--debug}'[enable debugging mode]' - $exclusive_auth_options{-n-,--auth=}'[set the username and password for authentication]:username\:password: ' + $exclusive_auth_options{-n+,--auth=}'[set the username and password for authentication]:username\:password: ' $exclusive_auth_options{-ne,--authenv}'[set the authentication information from the TR_AUTH environment variable]' - $exclusive_auth_options{-N-,--netrc=}'[set the authentication information from a netrc file]:file:_files' + $exclusive_auth_options{-N+,--netrc=}'[set the authentication information from a netrc file]:file:_files' '--find[tell Transmission where to look for the current torrents'"'"' data]' ) # `general_actions`: *actions* that can be specified when a specific set of torrents is either specified or either not local general_actions=( - '(- :)'{-gsr,--global-seedratio}'[all torrents, unless overridden by a per-torrent setting, should seed until a specific ratio]:ratio:{_message "ratio in kB/sec"}' + '(- :)'{-gsr,--global-seedratio}'[all torrents, unless overridden by a per-torrent setting, should seed until a specific ratio]:ratio (kB/s)' '(- :)'{-GSR,--no-global-seedratio}'[all torrents, unless overridden by a per-torrent setting, should seed regardless of ratio]' '(- :)'{-pr,--peers}'[set the maximum number of peers]:number: ' - '(- :)'{-d-,--downlimit=}'[limit the maximum download speed to limit kB/s]:limit:{_message "limit in kB/sec"}' + '(- :)'{-d+,--downlimit=}'[limit the maximum download speed to limit kB/s]:limit (kB/s)' '(- :)'{-D,--no-downlimit}'[disable download speed limits]' ) # `global_only_actions`: *actions* that can be specified only when no specific torrent is specified @@ -27,12 +27,12 @@ local global_only_actions=( '(- :)'{-asu,--alt-speed-uplimit}'[limit the alternate upload speed to limit kilobytes per second]' '(- :)'{-asc,--alt-speed-scheduler}'[use the scheduled on/off times]' '(- :)'{-asc,--not-alt-speed-scheduler}'[don'"'"'t use the scheduled on/off times]' - '(- :)--alt-speed-time-begin[time to start using the alt speed limits]:hhmm:_transmission-remote_time' - '(- :)--alt-speed-time-end[time to stop using the alt speed limits]:hhmm:_transmission-remote_time' + '(- :)--alt-speed-time-begin[time to start using the alt speed limits]:time (HHMM)' + '(- :)--alt-speed-time-end[time to stop using the alt speed limits]:time (HHMM)' '(- :)--alt-speed-days[set the number of days on which to enable the speed scheduler]:days:_transmission-remote_days' '(- :)--torrent-done-script[specify a file to run each time a torrent finishes]:script:_files' '(- :)--no-torrent-done-script[don'"'"'t run any script when a torrent finishes]' - '(- :)'{-e-,--cache=}'[set the session'"'"'s maximum memory cache size in MiB]:size (MiB):' + '(- :)'{-e+,--cache=}'[set the session'"'"'s maximum memory cache size in MiB]:size (MiB):' '(- :)'{-er,--encryption-required}'[encrypt all peer connections]' '(- :)'{-ep,--encryption-preferred}'[prefer encrypted peer connections]' '(- :)'{-et,--encryption-tolerated}'[prefer unencrypted peer connections]' @@ -42,7 +42,7 @@ local global_only_actions=( {-t,--torrent=}'[set the current torrent(s) for use by subsequent options]:torrent:_transmission-remote_torrent' '(- :)'{-si,--session-info}'[list session information from the server]' '(- :)'{-st,--session-stats}'[list statistical information from the server]' - {-a-,--add=}'[add torrents to transmission]:filename\|url:_transmission-remote_add' + {-a+,--add=}'[add torrents to transmission]:filename\|url:_transmission-remote_add' '(- :)'{-l,--list}'[list all torrents]' '(- :)'{-p,--port}'[set the port for use when listening for incoming peer connections]:port:' '(- :)--start-paused[start added torrents paused]' @@ -51,7 +51,7 @@ local global_only_actions=( '(- :)'{-M,--no-portmap}'[disable portmapping]' '(- :)'{-o,--dht}'[enable distributed hash table]' '(- :)'{-O,--no-dht}'[disable distributed hash table]' - '(- :)'{-u,--uplimit}'[limit the maximum upload speed to limit kB/s]:limit:{_message "limit in kB/sec"}' + '(- :)'{-u,--uplimit}'[limit the maximum upload speed to limit kB/s]:limit (kB/s)' '(- :)'{-U,--no-uplimit}'[disable upload speed limits]' '(- :)--utp[enable uTP for peer connections]' '(- :)--no-utp[disable uTP for peer connections]' @@ -65,9 +65,9 @@ local global_only_actions=( ) # `torrent_add_options`: *options* that can be used only when *adding* a torrent local torrent_add_options=( - '(-C --no-incomplete-dir)'{-c-,--incomplete-dir=}'[when adding new torrents, store their contents in directory until the torrent is done]:dir:{_files -/}' + '(-C --no-incomplete-dir)'{-c+,--incomplete-dir=}'[when adding new torrents, store their contents in directory until the torrent is done]:directory:_directories' '(-c --incomplete-dir)'{-C,--no-incomplete-dir}'[don'"'"'t store incomplete torrents in a different directory]' - {-w-,--download-dir=}'[when used in conjunction with --add, set the new torrent'"'"'s download folder]:dir:{_files -/}' + {-w+,--download-dir=}"[when used in conjunction with --add, set the new torrent's download directory]:directory:_directories" ) # `torrent_action_only_actions`: *actions* that can be specified only when explicitly selecting a specific set of torrents local torrent_action_only_actions=( @@ -81,15 +81,15 @@ local torrent_action_only_actions=( {-it,--info-trackers}'[list the specified torrent'"'"'s trackers]' '--trash-torrent[delete torrents after adding]' '--no-trash-torrent[do not delete torrents after adding]' - {-td-,--tracker-add=}'[add a tracker to a torrent]:tracker:_urls' - {-tr-,--tracker-remove=}'[remove a tracker from a torrent]:tracker_id:_transmission-remote_torrent_tracker_id' + {-td+,--tracker-add=}'[add a tracker to a torrent]:tracker:_urls' + {-tr+,--tracker-remove=}'[remove a tracker from a torrent]:tracker_id:_transmission-remote_torrent_tracker_id' {-s,--start}'[start the current torrent(s)]' {-S,--stop}'[stop the current torrent(s) from downloading or seeding]' {-r,--remove}'[remove the current torrent(s) without deleting the downloaded data]' {-rad,--remove-and-delete}'[remove the current torrent(s) and delete the downloaded data]' '--reannounce[reannounce the current torrent(s)]' - '--move[move the current torrents'"'"' data from their current locations to the specified directory]:{_files -/}' - {-sr-,--seedratio=}'[let the current torrent(s) seed until a specific ratio]:ratio:{_message "ratio in kB/sec"}' + "--move[move the current torrents' data from their current locations to the specified directory]:directory:_directories" + {-sr+,--seedratio=}'[let the current torrent(s) seed until a specific ratio]:ratio' {-SR,--no-seedratio}'[let the current torrent(s) use the global seedratio settings]' {-hl,--honor-session}'[make the current torrent(s) honor the session limits]' {-HL,--no-honor-session}'[make the current torrent(s) not honor the session limits]' @@ -97,19 +97,13 @@ local torrent_action_only_actions=( {-Bn,--bandwidth-normal}'[give this torrent the bandwidth left over by high priority torrents]' {-Bl,--bandwidth-low}'[give this torrent the bandwidth left over by high and normal priority torrents]' {-ph,--priority-high}'[try to download the specified file(s) first]:torrent_file:_transmission-remote_torrent_priority_not_high' - {-pn,--priority-normal}'[try to download the specified files normally.]:torrent_file:_transmission-remote_torrent_priority_not_normal' + {-pn,--priority-normal}'[try to download the specified files normally]:torrent_file:_transmission-remote_torrent_priority_not_normal' {-pl,--priority-low}'[try to download the specified files last]:torrent_file:_transmission-remote_torrent_priority_not_low' {-v,--verify}'[verify the current torrent(s)]' ) # helper functions -# complete argument specified after global only action: `--alt-speed-time-begin` -# completes time in HHMM format -(( $+functions[_transmission-remote_time] )) || -_transmission-remote_time(){ - _message "time in format HHMS" -} # complete argument specified after global only action: `--alt-speed-days` # completes days in a list such as "2,4-6". (( $+functions[_transmission-remote_days] )) || @@ -120,7 +114,7 @@ _transmission-remote_days(){ (( $+functions[_transmission-remote_add] )) || _transmission-remote_add(){ _alternative \ - 'args:torrent:_files -g ".torrent"' \ + 'args:torrent:_files -g ".torrent(-.)"' \ 'args:url:_urls' } # complete torrents diff --git a/Completion/Unix/Command/_truncate b/Completion/Unix/Command/_truncate new file mode 100644 index 000000000..117be9702 --- /dev/null +++ b/Completion/Unix/Command/_truncate @@ -0,0 +1,69 @@ +#compdef truncate + +local curcontext=$curcontext variant rs ret=1 +local -a state state_descr line specs optA +typeset -A opt_args + +_pick_variant -r variant gnu=GNU $OSTYPE --version +[[ $variant != gnu ]] && rs='-r -s' # -r/-s mutually exclusive + +# common specs +specs=( + '(hv -c --no-create)'{-c,--no-create}'[do not create any files]' + "(hv $rs -r --reference)"{-r+,--reference=}'[base size on the specified file]:reference file:_files' + "(hv $rs -s --size)"{-s+,--size=}'[set or adjust the file size by specified bytes]:size:->size' + '(hv)*: :_files' +) + +case $variant in + gnu) # GNU coreutils 8.32 + specs+=( + '(hv -o --io-blocks)'{-o,--io-blocks}'[treat the specified size as number of IO blocks instead of bytes]' + + 'hv' + '(- *)--help[display help and exit]' + '(- *)--version[output version information and exit]' + ) + ;; + *) # FreeBSD/DragonFly + specs=( ${specs:#(|*\))--*} ) # remove long options + optA=( -A '-*' ) + ;; +esac + +_arguments -C -s -S : $specs && ret=0 + +case $state in + size) + local unit=bytes + (( ${#opt_args[(I)(-o|--io-blocks)]} )) && unit=blocks + local -a suffix=( K:1024 M G T ) + local -a prefix=( '+:extend by' '-:reduce by' ) + local prefix_char='[-+]' + case $variant in + gnu|freebsd*) + prefix+=( '/:round down to multiple of' '%:round up to multiple of' ) + ;| + gnu) + suffix=( K:1024 KB:1000 {M,G,T,P,E,Z,Y}{,B} ) + prefix+=( '<:at most' '>:at least' ) + prefix_char='([-+/%]|\\[<>])' + ;; + freebsd*) + prefix_char='[-+/%]' + ;; + esac + local -a numbers=( _numbers -u $unit size $suffix ) + + if compset -P "$prefix_char"; then + $numbers && ret=0 + elif (( ${#opt_args[(I)(-r|--reference)]} )); then + # prefix is required if the reference file is given + _describe -t 'prefixes' 'prefix' prefix && ret=0 + else + _alternative "prefixes:prefix:((${(@q)prefix}))" \ + "sizes: :$numbers" && ret=0 + fi + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_uname b/Completion/Unix/Command/_uname index 31af91eb7..c58f2edfd 100644 --- a/Completion/Unix/Command/_uname +++ b/Completion/Unix/Command/_uname @@ -62,12 +62,21 @@ else '-v[print detailed operating system version]' ) case $OSTYPE in - freebsd*|dragonfly*) args+=( '-i[print kernel ident]' ) ;| - freebsd<10->.*) + freebsd*|dragonfly*) args+=( - '-K[print FreeBSD kernel version]' - '-U[print FreeBSD user environment version]' + '-i[print kernel ident]' + '-K[print kernel version]' + '-U[print user environment version]' ) + ;| + dragonfly*) + args+=( + '-P[write ABI string for dports / pkgng, including odd-to-even version-munging]' + '-PP[write ABI string for dports / pkgng, without version-munging]' + ) + ;; + freebsd<13->.*) + args+=( "-b[print kernel's linker-generated build-id]" ) ;; solaris*) args+=( diff --git a/Completion/Unix/Command/_uniq b/Completion/Unix/Command/_uniq index 97f73b3ac..e123a94cd 100644 --- a/Completion/Unix/Command/_uniq +++ b/Completion/Unix/Command/_uniq @@ -23,8 +23,9 @@ args=( if ! _pick_variant gnu=Free\ Soft unix --version; then local optchars="cdufs" if [[ "$OSTYPE" == (darwin|dragonfly|freebsd|openbsd)* ]]; then - optchars="${optchars}i" + optchars+=i fi + [[ $OSTYPE = freebsd* ]] && optchars+=D args=( ${(M)args:#(|\*)(|\(*\))-[$optchars]*} ) fi diff --git a/Completion/Unix/Command/_unison b/Completion/Unix/Command/_unison index 2a3333742..91fa57e5b 100644 --- a/Completion/Unix/Command/_unison +++ b/Completion/Unix/Command/_unison @@ -6,7 +6,7 @@ typeset -A opt_args _arguments \ '-auto[automatically accept default (nonconflicting) actions]' \ '-batch[batch mode\: ask no questions at all]' \ - '-doc[show documentation]:topics:(about people lists status copying ack install tutorial basics failures running ssh news all topics)' \ + '-doc[show documentation]:topic:(about people lists status copying ack install tutorial basics failures running ssh news all topics)' \ '-follow[add a pattern to the follow list]:pattern:' \ '-force[force changes from this replica to the other]:replica:' \ '-group[synchronize group attributes]' \ @@ -84,9 +84,6 @@ _arguments \ '*:profile:->profile' if [[ $state == profile ]]; then - local -a profiles - - profiles=( ~/.unison/*.prf(N) ) - (( $#profiles )) && \ - compadd "$@" - ${${profiles#~/.unison/}%.prf} + local -a profiles=( ${UNISON:-~/.unison}/*.prf(N:t:r) ) + compadd "$@" -a profiles fi diff --git a/Completion/Unix/Command/_units b/Completion/Unix/Command/_units index bea77ae67..6d86f4dc3 100644 --- a/Completion/Unix/Command/_units +++ b/Completion/Unix/Command/_units @@ -40,10 +40,12 @@ local -a testfiles testfiles=( /usr/share/units.dat # GNU on Fedora /usr/share/units/units.dat # on gentoo - /usr/share/misc/units.dat # on Debian + /usr/share/units/definitions.units # on Debian, units 2.00 and newer /usr/local/share/units.dat # GNU DIY install /usr/share/lib/unittab # Solaris - /usr/share/misc/units.lib # BSD + /usr/share/misc/units.lib # OpenBSD [as of 2020]; also FreeBSD 9.1 + /usr/share/misc/definitions.units # FreeBSD 12.1 + /usr/share/misc/units.dat # on Debian, units 1.88 and older ) datfile=${opt_args[-f]:-${opt_args[--file]}} diff --git a/Completion/Unix/Command/_user_admin b/Completion/Unix/Command/_user_admin index c7e1efc80..db1c977ad 100644 --- a/Completion/Unix/Command/_user_admin +++ b/Completion/Unix/Command/_user_admin @@ -54,7 +54,7 @@ case ${service%???}:${(M)service%???}:$OSTYPE in ;| user:*:(net|open)bsd*) args+=( - '-L[specify login class]:login class' + '-L[specify login class]:login class:_login_classes' '-p+[specify encrypted password]:encrypted password' ) ;| diff --git a/Completion/Unix/Command/_vcsh b/Completion/Unix/Command/_vcsh deleted file mode 100644 index 00aed7d28..000000000 --- a/Completion/Unix/Command/_vcsh +++ /dev/null @@ -1,89 +0,0 @@ -#compdef vcsh - -function __vcsh_repositories () { - local -a repos - repos=( ${(f)"$(_call_program repositories vcsh list)"} ) - _describe -t repositories 'repository' repos -} - -function _vcsh-clone () { - _default #TODO -} - -local func -for func in help init list list-tracked pull push version; do - _vcsh-$func() { _nothing } -done -for func in delete enter list-tracked-by upgrade write-gitignore; do - _vcsh-$func() { (( CURRENT == 2 )) && __vcsh_repositories } -done - -function _vcsh-rename () { - case $CURRENT in - 2) __vcsh_repositories ;; - 3) _message "new repository name" ;; - *) _nothing ;; - esac -} - -function _vcsh-run () { - (( CURRENT == 2 )) && __vcsh_repositories - if (( CURRENT >= 3 )); then - words=( "${(@)words[3,-1]}" ) - (( CURRENT -= 2 )) - _complete - fi -} - -function _vcsh () { - local curcontext="${curcontext}" ret=1 - local state vcshcommand - local -a args subcommands - - subcommands=( - "clone:clone an existing repository" - "delete:delete an existing repository" - "enter:enter repository; spawn new <\$SHELL>" - "help:display help" - "init:initialize an empty repository" - "list:list all local vcsh repositories" - "list-tracked:list all files tracked by vcsh" - "list-tracked-by:list files tracked by a repository" - "pull:pull from all vcsh remotes" - "rename:rename a repository" - "run:run command with <\$GIT_DIR> and <\$GIT_WORK_TREE> set" - "upgrade:upgrade repository to currently recommended settings" - "version:print version information" - "which:find <substring> in name of any tracked file" - "write-gitignore:write .gitignore.d/<repo> via git ls-files" - ) - - args=( - '-c[source <file> prior to other configuration files]:config files:_path_files' - '-d[enable debug mode]' - '-v[enable verbose mode]' - '*:: :->subcommand_or_options_or_repo' - ) - - _arguments -C ${args} && ret=0 - - if [[ ${state} == "subcommand_or_options_or_repo" ]]; then - if (( CURRENT == 1 )); then - _describe -t subcommands 'vcsh sub-commands' subcommands && ret=0 - __vcsh_repositories && ret=0 - else - vcshcommand="${words[1]}" - if ! (( ${+functions[_vcsh-$vcshcommand]} )); then - # There is no handler function, so this is probably the name - # of a repository. Act accordingly. - _dispatch git git && ret=0 - else - curcontext="${curcontext%:*:*}:vcsh-${vcshcommand}:" - _call_function ret _vcsh-${vcshcommand} - fi - fi - fi - return ret -} - -_vcsh "$@" diff --git a/Completion/Unix/Command/_vi b/Completion/Unix/Command/_vi new file mode 100644 index 000000000..6201299a2 --- /dev/null +++ b/Completion/Unix/Command/_vi @@ -0,0 +1,47 @@ +#compdef ex vi view + +local -a args + +if _pick_variant vim='(N|)VIM' vi --version; then + _vim + return +fi + +args=( + '-c+[execute command on the first file loaded]:command:' + '-r[recover the named files]' + '-t+[start editing at the specified tag]:tag:' + '-w+[set window size to specified number of lines]:lines:' + '*: :_files' +) + +[[ $service != view ]] && args+=( + '-R[set readonly]' +) + +[[ $service == ex ]] && args+=( + '-s[enter batch mode]' + '-v[start in vi mode]' +) + +case $OSTYPE in + *bsd*|dragonfly*) + args+=( + "-F[don't copy the entire file on start]" + '-S[set the secure option]' + ) + [[ $service != ex ]] && args+=( + '-e[start in ex mode]' + ) + ;| + netbsd*) + args+=( + '-G[start in gtags mode]' + ) + [[ $service == vi ]] && args+=( + '-l[set the lisp and showmatch options]' + ) + ;; +esac + +_arguments -s -S -A '-*' : $args diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim index d9dc1a5b3..5c6054e70 100644 --- a/Completion/Unix/Command/_vim +++ b/Completion/Unix/Command/_vim @@ -27,9 +27,8 @@ arguments=( '-D[debugging mode]' '-n[no swap file (memory only)]' {-r,-L}'[list swap files and exit or recover from a swap file]::swap file:_vim_files -g "*.sw?(-.)"' - '( -H -F)-A[start in Arabic mode]' - '(-A -F)-H[start in Hebrew mode]' - '(-A -H )-F[start in Farsi mode]' + '(-H)-A[start in Arabic mode]' + '(-A)-H[start in Hebrew mode]' '-u[use given vimrc file instead of default .vimrc]:config:->config' "--noplugin[don't load plugin scripts]" '-o-[number of windows to open (default: one for each file)]::window count: ' @@ -99,8 +98,11 @@ fi [[ $service != *view ]] && arguments+='-R[readonly mode]' [[ $service = *g* ]] || (( ${words[(I)-g]} )) && arguments+=( '(--nofork -f)'{--nofork,-f}'[do not detach the GUI version from the shell]' + '(-background -bg)'{-background,-bg}'[use specified color for the background]:color:_x_color' + '(-foreground -fg)'{-foreground,-fg}'[use specified color for normal text]:color:_x_color' '-font:font:_xft_fonts' '-geometry:geometry:_x_geometry' + '-iconic[start vim iconified]' '(-rv -reverse)'{-rv,-reverse}'[use reverse video]' '-display:display:_x_display' '--role[set unique role to identify main window]:role' diff --git a/Completion/Unix/Command/_vmstat b/Completion/Unix/Command/_vmstat index f3ac1af14..e05bc88bc 100644 --- a/Completion/Unix/Command/_vmstat +++ b/Completion/Unix/Command/_vmstat @@ -8,6 +8,7 @@ case $OSTYPE in '(-t --timestamp)'{-t,--timestamp}'[show timestamp]' '(-n --one-header)'{-n,--one-header}'[do not redisplay header]' '(-S --unit)'{-S+,--unit=}'[specify unit for displayed sizes]:unit prefix [K]:((k\:1000 K\:1024 m\:1000000 M\:1048576))' + '(-C --full-cache)'{-C,--full-cache}'[add further cache lines to main cache]' '1: :_guard "[0-9]#" "interval (seconds)"' '2:count' + '(action)' \ '(- :)'{-h,--help}'[display help information]' diff --git a/Completion/Unix/Command/_w b/Completion/Unix/Command/_w index 8fb4154c7..69751c5e5 100644 --- a/Completion/Unix/Command/_w +++ b/Completion/Unix/Command/_w @@ -11,6 +11,7 @@ case $OSTYPE in '(H -o --old-style -s --short)'{-o,--old-style}'[old style output format]' '(H -s --short -o --old-style)'{-s,--short}'[use short output format]' '(H -u --no-current)'{-u,--no-current}'[ignore the username while figuring out the current process and cpu times]' + '(H -n --no-truncat)'{-n,--no-truncat}'[non-truncated listing (large)]' + H '(-)--help[display help information]' '(-)'{-V,--version}'[display version information]' diff --git a/Completion/Unix/Command/_w3m b/Completion/Unix/Command/_w3m index 6e83a6781..de425cfb1 100644 --- a/Completion/Unix/Command/_w3m +++ b/Completion/Unix/Command/_w3m @@ -1,14 +1,12 @@ #compdef w3m -# w3m version w3m/0.5.1 - local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args _arguments -C \ '-t[set tab width]:tab width:' \ '-r[ignore backspace effect]' \ - '-l[specify number of preserved lines]:number of lines (default 10000):' \ + '-l[specify number of preserved lines]:number of lines [10000]' \ '-I[document charset]:charset:->charset' \ '-O[display/output charset]:charset:->charset' \ '( -s -j)-e[EUC-JP]' \ @@ -21,7 +19,7 @@ _arguments -C \ '(-B *)-v[visual startup mode]' \ '-M[monochrome display]' \ '-N[open URL of command line on each new tab]' \ - '-F[automatically render frame]' \ + '-F[automatically render frames]' \ '-cols[specify column width (used with -dump)]:column width' \ '-ppc[specify the number of pixels per character (4.0...32.0)]:number of pixels (4.0...32.0):' \ '-ppl[specify the number of pixels per line (4.0...64.0)]:number of pixels (4.0...64.0):' \ @@ -34,17 +32,17 @@ _arguments -C \ '-header[insert string as a header]:header:' \ '+-[goto specified line]:line number:_guard "[0-9]#" "line number"' \ '-num[show line number]' \ + '-session[use specified session]:id' \ "-no-proxy[don't use proxy]" \ '(-6)-4[IPv4 only (-o dns_order=4)]' \ '(-4)-6[IPv6 only (-o dns_order=6)]' \ "-no-mouse[don't use mouse]" \ '(-no-cookie)-cookie[use cookie]' \ "(-cookie)-no-cookie[don't use cookie]" \ - '-pauth[proxy authentication]:user\:pass:->pauth' \ - '(-no-graph)-graph[use graphic character]' \ - "(-graph)-no-graph[don't use graphic character]" \ + '(-no-graph)-graph[use DEC special graphics for border of table and menu]' \ + '(-graph)-no-graph[use ASCII character for border of table and menu]' \ '-S[squeeze multiple blank lines]' \ - '-W[toggle wrap search mode]' \ + '-W[toggle search wrap mode]' \ "-X[don't use termcap init/deinit]" \ '-title=[set buffer name to terminal title string]:terminal:_terminals' \ '*-o[assign value to config option]:option=value:->option' \ @@ -84,7 +82,7 @@ case "$state" in _alternative \ 'files:file:_files -g "*.x#html(-.)"' \ 'urls:URL:_urls' \ - 'bookmarks:bookmarks:compadd -a bookmarks' \ + 'bookmarks:bookmark:compadd -a bookmarks' \ 'history:history:compadd -a w3mhistory' && ret=0 ;; option) @@ -97,14 +95,6 @@ case "$state" in _describe -t options 'option' options "$suf[@]" && ret=0 fi ;; - pauth) - if compset -P 1 '*:'; then - _message -e passwords 'password' - else - compset -S ':*' || suf=( -S ':' ) - _users "$suf[@]" && ret=0 - fi - ;; esac return ret diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget index 49c8e8b01..50fd7791a 100644 --- a/Completion/Unix/Command/_wget +++ b/Completion/Unix/Command/_wget @@ -34,6 +34,8 @@ _arguments -C -s \ '(--server-response -S)'{--server-response,-S}'[print server response]' \ "--spider[don't download anything]" \ '(--timeout -T)'{--timeout=,-T+}'[set all timeout values]:timeout (seconds)' \ + '--dns-servers=[specify DNS servers to query]:DNS server:_sequence _hosts' \ + '--bind-dns-address=[bind DNS resolver to specified address]:hostname or IP on local host' \ '(--timeout -T)--dns-timeout=[set the DNS lookup timeout]:DNS lookup timeout (seconds)' \ '(--timeout -T)--connect-timeout=[set the connect timeout]:connect timeout (seconds)' \ '(--timeout -T)--read-timeout=[set the read timeout]:read timeout (seconds)' \ @@ -107,7 +109,7 @@ _arguments -C -s \ "--ca-directory=[specify dir where hash list of CA's are stored]:directory:_directories" \ '--crl-file=[specify file with bundle of CRLs]:file:_files' \ '--pinnedpubkey=:file:_files' \ - '!--random-file=:file:_files' \ + '--random-file[specify file with random data for seeding generator]:file:_files' \ '--egd-file=[specify filename of EGD socket]:file:_files' \ '--ciphers=[set the priority string (GnuTLS) or cipher list string (OpenSSL) directly]:string' \ '--no-hsts[disable HSTS]' \ @@ -137,7 +139,7 @@ _arguments -C -s \ '(--reject -R)'{--reject=,-R+}'[specify rejected extensions]:extensions' \ --{accept,reject}-regex=:regex '--regex-type=:regex type:(posix pcre)' \ '(--domains -D)'{--domains=,-D+}'[specify accepted domains]:domains:_domains' \ - '--exclude-domains=:rejected domains:_domains' \ + '--exclude-domains=:rejected domain:_sequence _domains' \ '--follow-ftp' \ '--follow-tags=:HTML tags:' \ '--ignore-tags=[specify ignored HTML tags]:HTML tags' \ diff --git a/Completion/Unix/Command/_wiggle b/Completion/Unix/Command/_wiggle index 0a2f0c0cb..1d747a479 100644 --- a/Completion/Unix/Command/_wiggle +++ b/Completion/Unix/Command/_wiggle @@ -1,15 +1,17 @@ #compdef wiggle -local fns='-m --merge -d --diff -x --extract' +local fns='-m --merge -d --diff -x --extract -B --browse' _arguments \ "($fns -1 -2 -3)"{-m,--merge}'[select the merge function]' \ "($fns -3 3)"{-d,--diff}'[display differences between files]' \ "($fns 2 3)"{-x,--extract}'[extract one branch of a patch or merge file]' \ '(-w --words -l --lines)'{-w,--words}'[make operations and display word based]' \ - '(-l --lines -w --words)'{-l,--lines}'[make operations and display line based]' \ + '(-l --lines -w --words --non-space)'{-l,--lines}'[make operations and display line based]' \ + '(-l --lines)--non-space[words are separated by spaces]' \ '(-p --patch)'{-p,--patch}'[treat last named file as a patch]' \ '(-r --replace)'{-r,--replace}'[replace original file with merged output]' \ + '--no-backup[never save original file (as name.porig)]' \ '(-R --reverse -x --extract)'{-R,--reverse}'[swap the files or revert changes]' \ '(-2 -3 -m --merge)-1[select branch]' \ '(-1 -3 -m --merge)-2[select branch]' \ diff --git a/Completion/Unix/Command/_xargs b/Completion/Unix/Command/_xargs index f21784ef1..8e23a04bb 100644 --- a/Completion/Unix/Command/_xargs +++ b/Completion/Unix/Command/_xargs @@ -25,7 +25,7 @@ case $variant in '-R[specify maximum arguments that -I will replace in]:replacements' ) ;| - freebsd*|netbsd*) + freebsd*|netbsd*|dragonfly*) args+=( '-S[space that -I can use for replacements]:size (bytes) [255]' ) diff --git a/Completion/Unix/Command/_xmlsoft b/Completion/Unix/Command/_xmlsoft index 487974fdb..08b123e54 100644 --- a/Completion/Unix/Command/_xmlsoft +++ b/Completion/Unix/Command/_xmlsoft @@ -45,7 +45,7 @@ case $service in '--encoding[the input document character encoding]:encoding:(${encoding[@]})' \ '*--param[pass a parameter,value pair]:name::value (xpath expression)' \ '*--stringparam[pass a parameter]:name::value' \ - '--path[provide a set of paths for resources]:paths:_files -/' \ + '--path[provide a set of paths for resources]:path:_dir_list' \ '--nonet[refuse to fetch DTDs or entities over network]' \ '--nowrite[refuse to write to any file or resource]' \ '--nomkdir[refuse to create directories]' \ @@ -70,7 +70,7 @@ case $service in '--noent[substitute entity references by their value]' \ '--noenc[ignore any encoding specified inside the document]' \ "(--output -o)--noout[don't output the result tree]" \ - '--path[provide a set of paths for resources]:paths:_files -/' \ + '--path[provide a set of paths for resources]:path:_dir_list' \ '--load-trace[print trace of all external entities loaded]' \ '--nonet[refuse to fetch DTDs or entities over network]' \ '--nocompact[do not generate compact text nodes]' \ @@ -80,6 +80,7 @@ case $service in '(--dtdvalid --relaxng --schema)--postvalid[do a posteriori validation, i.e after parsing]' \ '(--postvalid --relaxng --schema --dtdvalidfpi)--dtdvalid[do a posteriori validation against a given DTD]:DTD:_webbrowser' \ '(--postvalid --relaxng --schema --dtdvalid)--dtdvalidfpi[as --dtdvalid but specify DTD with public identifier]:DTD identifier' \ + '--quiet[be quiet when successful]' \ '--timing[print some timings]' \ '(--noout --output -o)'{--output,-o}'[save to a given file]:output file:_files' \ '--repeat[repeat 100 times, for timing or profiling]' \ @@ -98,7 +99,7 @@ case $service in '--format[reformat/reindent the input]' \ '--encode[output in the given encoding]:encoding:(${encoding[@]})' \ '--dropdtd[remove the DOCTYPE of the input docs]' \ - "--pretty[pretty-print in a particular style]:style:((0\:don't\ pretty\ print 1\:reformat 2\:add\ whitespace))" \ + "--pretty[pretty-print in a particular style]:style:((0\:don\'t\ pretty\ print 1\:reformat 2\:add\ whitespace))" \ '--c14n[save in W3C canonical format]' \ '--c14n11[save in W3C canonical format v1.1 (with comments)]' \ '--exc-c14n[save in W3C exclusive canonical format]' \ diff --git a/Completion/Unix/Command/_xmms2 b/Completion/Unix/Command/_xmms2 index 525d5177c..ca2383b2f 100644 --- a/Completion/Unix/Command/_xmms2 +++ b/Completion/Unix/Command/_xmms2 @@ -43,7 +43,7 @@ _xmms2_command() { ) if (( CURRENT == 1 )); then - _describe -t command "xmms2 commands" xmms2_cmds + _describe -t command "xmms2 command" xmms2_cmds else local curcontext="$curcontext" fi @@ -63,7 +63,7 @@ _xmms2_command() { fi done - _values -s ' ' 'playlist items' ${(On)playlistitems} + _values -s ' ' 'playlist item' ${(On)playlistitems} } @@ -84,7 +84,7 @@ _xmms2_mlib() { ) if (( CURRENT == 2 )); then - _describe -t command "xmms2 mlib commands" mlib_cmds + _describe -t command "xmms2 mlib command" mlib_cmds else local curcontext="$curcontext" fi @@ -107,7 +107,7 @@ _xmms2_playlist() { remove:"Remove a playlist" ) if (( CURRENT == 2 )); then - _describe -t command "xmms2 playlist commands" playlist_cmds + _describe -t command "xmms2 playlist command" playlist_cmds else local curcontext="$curcontext" fi @@ -121,14 +121,14 @@ _xmms2_playlist() { _xmms2_playlist_load() { local list list=($(xmms2 playlist list)) - _describe -t command "xmms2 playlists" list + _describe -t command "xmms2 playlist" list } _xmms2_playlist_remove() { local list list=($(xmms2 playlist list)) - _describe -t command "xmms2 playlists" list + _describe -t command "xmms2 playlist" list } @@ -146,7 +146,7 @@ _xmms2_coll() { attr:"Get/set an attribute for a saved collection" ) if (( CURRENT == 2 )); then - _describe -t command "xmms2 collection commands" coll_cmds + _describe -t command "xmms2 collection command" coll_cmds else local curcontext="$curcontext" fi @@ -160,7 +160,7 @@ _xmms2_coll() { _xmms2_coll_helper() { local list list=($(xmms2 coll list)) - _describe -t command "xmms2 playlists" list + _describe -t command "xmms2 playlist" list } _xmms2_coll_rename() { diff --git a/Completion/Unix/Command/_xxd b/Completion/Unix/Command/_xxd index 3a8efd664..31d26ab64 100644 --- a/Completion/Unix/Command/_xxd +++ b/Completion/Unix/Command/_xxd @@ -39,6 +39,7 @@ arguments=( {-g+,-groupsize}'[specify the number of octets per group]: :_guard "[0-9]#" "number of octets per group"' {-l+,-len}'[specify number of octets to output]: :_guard "[0-9]#" "number of octets to output"' {-o+,-offset}'[add specified offset to displayed file position]:offset' + '-d[show offset in decimal instead of hex]' {-s,-skip,-seek}'[specify file offset to dump from]: :_guard "[0-9]#" "file offset to dump from (absolute or relative)"' ': :_files' diff --git a/Completion/Unix/Command/_yafc b/Completion/Unix/Command/_yafc index 1e0a601a1..946c0b4ce 100644 --- a/Completion/Unix/Command/_yafc +++ b/Completion/Unix/Command/_yafc @@ -32,7 +32,7 @@ _yafc_bookmarks() { if [[ -f $bkmfile ]]; then local -a bkms expl bkms=(${${${(M)"${(f)$(<$bkmfile)}":#machine*alias ##\'*\' #}##machine*alias ##\'}%%\' #}) #" vim syntax goes crazy - _wanted bookmarks expl 'bookmarks' compadd "$@" -a - bkms + _wanted bookmarks expl 'bookmark' compadd "$@" -a - bkms fi } diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs index 814358bc7..be4a64b33 100644 --- a/Completion/Unix/Command/_zfs +++ b/Completion/Unix/Command/_zfs @@ -1,553 +1,1350 @@ -#compdef zfs -# Synced with the S11U1 man page - -_zfs() { - local context state line expl implementation - typeset -A opt_args - local -a subcmds rw_properties rw_propnames ro_properties create_properties - local -a share_nfs_ro_properties share_nfs_rw_properties - local -a share_smb_ro_properties share_smb_rw_properties - local -a share_ro_properties share_rw_properties - local -a difffields delegatable_perms - - _pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris - - subcmds=( - "create" "destroy" "clone" "promote" "rename" "snapshot" - "rollback" "list" "set" "get" "inherit" "mount" "unmount" - "share" "unshare" "send" "receive" "allow" "unallow" - "upgrade" "userspace" "groupspace" "hold" "holds" "release" - "diff" "key" "help" - ) - - [[ $OSTYPE == freebsd<7->.* ]] && subcmds+=(jail unjail) - - share_nfs_ro_properties=( - "share.nfs.all" - ) - - share_nfs_rw_properties=( - "share.nfs:value:(on off)" - "share.nfs.aclok:value:(on off)" - "share.nfs.acflfab:value:(on off)" - "share.nfs.anon:uid:" - "share.nfs.charset.euc-cn:access-list:" - "share.nfs.charset.euc-jpms:access-list:" - "share.nfs.charset.euc-kr:access-list:" - "share.nfs.charset.euc-tw:access-list:" - "share.nfs.charset.iso8859-1:access-list:" - "share.nfs.charset.iso8859-2:access-list:" - "share.nfs.charset.iso8859-5:access-list:" - "share.nfs.charset.iso8859-6:access-list:" - "share.nfs.charset.iso8859-7:access-list:" - "share.nfs.charset.iso8859-8:access-list:" - "share.nfs.charset.iso8859-9:access-list:" - "share.nfs.charset.iso8859-13:access-list:" - "share.nfs.charset.iso8859-15:access-list:" - "share.nfs.charset.koi8-r:access-list:" - "share.nfs.index:file:_files" - "share.nfs.log:nfslog.conf tag:" - "share.nfs.nosub:value:(on off)" - "share.nfs.nosuid:value:(on off)" - "share.nfs.public:value:(on off)" - "share.nfs.sec:security-mode-list:" - "share.nfs.sec.default.none:access-list:" - "share.nfs.sec.default.ro:access-list:" - "share.nfs.sec.default.root:access-list:" - "share.nfs.sec.default.root_mapping:uid:" - "share.nfs.sec.default.rw:access-list:" - "share.nfs.sec.default.window:seconds" - "share.nfs.sec.dh.none:access-list:" - "share.nfs.sec.dh.ro:access-list:" - "share.nfs.sec.dh.root:access-list:" - "share.nfs.sec.dh.root_mapping:uid:" - "share.nfs.sec.dh.rw:access-list:" - "share.nfs.sec.dh.window:seconds" - "share.nfs.sec.krb5.none:access-list:" - "share.nfs.sec.krb5.ro:access-list:" - "share.nfs.sec.krb5.root:access-list:" - "share.nfs.sec.krb5.root_mapping:uid:" - "share.nfs.sec.krb5.rw:access-list:" - "share.nfs.sec.krb5.window:seconds" - "share.nfs.sec.krb5i.none:access-list:" - "share.nfs.sec.krb5i.ro:access-list:" - "share.nfs.sec.krb5i.root:access-list:" - "share.nfs.sec.krb5i.root_mapping:uid:" - "share.nfs.sec.krb5i.rw:access-list:" - "share.nfs.sec.krb5i.window:seconds" - "share.nfs.sec.krb5p.none:access-list:" - "share.nfs.sec.krb5p.ro:access-list:" - "share.nfs.sec.krb5p.root:access-list:" - "share.nfs.sec.krb5p.root_mapping:uid:" - "share.nfs.sec.krb5p.rw:access-list:" - "share.nfs.sec.krb5p.window:seconds" - "share.nfs.sec.none.none:access-list:" - "share.nfs.sec.none.ro:access-list:" - "share.nfs.sec.none.root:access-list:" - "share.nfs.sec.none.root_mapping:uid:" - "share.nfs.sec.none.rw:access-list:" - "share.nfs.sec.none.window:seconds" - "share.nfs.sec.sys.none:access-list:" - "share.nfs.sec.sys.ro:access-list:" - "share.nfs.sec.sys.root:access-list:" - "share.nfs.sec.sys.root_mapping:uid:" - "share.nfs.sec.sys.rw:access-list:" - "share.nfs.sec.sys.window:seconds" - ) - - share_smb_ro_properties=( - "share.smb.all" - ) - - share_smb_rw_properties=( - "share.smb:value:(on off)" - "share.smb.ad-container" - "share.smb.abe" - "share.smb.csc:value:(disabled manual auto vdo)" - "share.smb.catia:value:(on off)" - "share.smb.dfsroot:value:(on off)" - "share.smb.guestok:value:(on off)" - "share.smb.ro:access-list:" - "share.smb.rw:access-list:" - "share.smb.none:access-list:" - ) - - share_ro_properties=( - "share.all" - "share.fs" - "share.name" - "share.point" - "share.protocols" - "share.state" - $share_nfs_ro_properties - $share_smb_ro_properties - ) - - share_rw_properties=( - "share.desc:description:" - "share.noauto:value:(on off)" - "share.path:path:" - $share_nfs_rw_properties - $share_smb_rw_properties - ) - - # TODO: userused@ and groupused@ could have more extensive handling - ro_properties=( - "name" "type" "creation" "used" "available" "referenced" - "compressratio" "mounted" "origin" "usedbychildren" - "usedbydataset" "usedbyrefreservation" "usedbysnapshots" - "defer_destroy" "userused@" "userrefs" "groupused@" - "keychangedate" "keystatus" "rekeydate" - $share_ro_properties - ) - - # TODO: Be cleverer about what values can be set. Is there any way to - # set the sorting for *size properties to false by default? - rw_properties=( - "aclinherit:value:(discard noallow restricted passthrough passthrough-x)" - "atime:value:(on off)" - "canmount:value:(on off noauto)" - "checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)" - "compression:value:(on off lzjb lz4 gzip gzip-{1..9} zle)" - "copies:value:(1 2 3)" - "dedup:value:(on off verify sha256 sha256,verify)" - "devices:value:(on off)" - "encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)" - "exec:value:(on off)" - "groupquota@:value:" # TODO: complete group=size|none - "keysource:value:_zfs_keysource_props" - "logbias:value:(latency throughput)" - "mlslabel:value:(none)" # TODO: list sensitivity labels - "mountpoint:path, 'legacy', or 'none':{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}" - "multilevel:value:(on off)" - "nbmand:value:(on off)" - "primarycache:value:(all none metadata)" - "quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}" - "readonly:value:(on off)" - "recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)" - "refquota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refquota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refquota' compadd none; fi}" - "refreservation:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refreservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refreservation' compadd none; fi}" - "reservation:value:{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == reservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'reservation' compadd none; fi}" - "rstchown:value:(on off)" - "secondarycache:value:(all none metadata)" - "setuid:value:(on off)" - "shadow:value:" # TODO: complete URI|none - "share:share properties:" - "snapdir:value:(hidden visible)" - "sync:value:(standard always disabled)" - "userquota@:value:" # TODO: complete user=size|none - "version:value:(1 2 3 4 current)" - "volsize:value:" # <size> - "vscan:value:(on off)" - "xattr:value:(on off)" - "zoned:value:(on off)" - $share_rw_properties - ) - - if [[ "$OSTYPE" == "linux-gnu" ]]; then - rw_properties+=("acltype:value:(off noacl posixacl)") - elif [[ "$implementation" == "solaris" ]]; then - rw_properties+=("aclmode:value:(discard mask passthrough)") - else - rw_properties+=("aclmode:value:(discard groupmask passthrough restricted)") - fi - - - create_properties=( - $rw_properties - "casesensitivity:value:(sensitive insensitive mixed)" - "normalization:value:(none formC formD formKC formKD)" - "utf8only:value:(on off)" - "volblocksize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)" - ) - - delegatable_perms=( - "allow" "clone" "create" "destroy" "diff" "hold" "key" - "keychange" "mount" "promote" "receive" "release" "rename" - "rollback" "send" "share" "snapshot" - "groupused" "userused" "userprop" - ${create_properties%%:*} - ) - - rw_propnames=( ${rw_properties%%:*} ) - - difffields=( - object parent size links linkschange name oldname user group - ctime mtime atime crtime - ) - - if [[ $service == "zfs" ]]; then - _arguments -C -A "-*" \ - '-\?[Help]' \ - '*::command:->subcmd' && return 0 - - if (( CURRENT == 1 )); then - _wanted commands expl "zfs subcommand" compadd -a subcmds - return - fi - service="$words[1]" - curcontext="${curcontext%:*}=$service:" - fi - - case $service in - ("create") - _arguments -A "-*" \ - '-p[Create parent datasets]' \ - '*-o[Set initial properties]:property:_values -s , "property" $create_properties' \ - - set1 \ - ':filesystem:_zfs_dataset -t fs -e "parent dataset"' \ - - set2 \ - '-s[Create sparse volume]' \ - '-b[Set volblocksize]:blocksize:' \ - '-V[Set size]:size:' \ - ':volume:_zfs_dataset -t fs -e "parent dataset"' - ;; - - ("destroy") - _arguments -A "-*" \ - '-r[Recursively destroy all children]' \ - '-R[Recursively destroy all dependents]' \ - - set1 \ - '-d[delete or mark deferred]' \ - ':snapshot:_zfs_dataset -t snap' \ - - set2 \ - '-f[Force unmounts]' \ - ':filesystem/volume/snapshot:_zfs_dataset -t fs -t vol' - ;; - - (snap(|shot)) - _arguments -A "-*" \ - '-r[Recursively snapshot all descendant datasets]' \ - '*-o[Set property]:property:_values -s , "property" $create_properties' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol -S@' - ;; - - ("rollback") - _arguments -A "-*" \ - '-r[Recursively destroy more recent snapshots]' \ - '-R[Recursively destroy more recent snapshots and clones]' \ - '-f[Force unmounts]' \ - ':snapshot:_zfs_dataset -t snap' - ;; - - ("clone") - # XXX needs to bail if there are no snapshots - _arguments -A "-*" \ - '-p[Create parent datasets]' \ - '-K[Create encryption key]' \ - '*-o[Set property]:property:_values -s , "property" $create_properties' \ - ':snapshot:_zfs_dataset -t snap' \ - ':filesystem/volume:_zfs_dataset -t fs -e "parent dataset"' - ;; - - ("promote") - _arguments \ - ':filesystem:_zfs_dataset -t clone' \ - ;; - - ("rename") - _arguments -A "-*" \ - '(-r)-p[Create parent datasets]' \ - '(-p)-r[Recursively rename snapshots of all descendent datasets]' \ - ':dataset:_zfs_dataset -r1' \ - ':dataset:_zfs_dataset -r2' - ;; - - ("list") - _arguments -A "-*" \ - '-r[Recursively display children]' \ - '-H[Scripting mode]' \ - '-d[Depth]:value:' \ - '-o[Properties to list]:property:_values -s , "property" $ro_properties $rw_propnames' \ - '*-s[Sort key (ascending)]:property:_values "property" $ro_properties $rw_propnames' \ - '*-S[Sort key (descending)]:property:_values "property" $ro_properties $rw_propnames' \ - '-t[Dataset types to list]:dataset type:_values -s , "dataset type" all filesystem snapshot volume' \ - '*:filesystem/volume/snapshot/path:_zfs_dataset -p' - ;; - - ("set") - _arguments \ - '-r[Recursively apply value]' \ - ':property:_values -s , "property" $rw_properties' \ - '*:filesystem/volume:_zfs_dataset -t fs -t vol' - ;; - - ("get") - _arguments -A "-*" \ - "-r[Recursively display children's properties]" \ - '-d[Depth]:value:' \ - '-H[Scripting mode]' \ - '-p[Display numbers exactly]' \ - '-s[Specify sources]:source:_values -s , "source" local default inherited temporary none' \ - '-o[Specify fields]:field:_values -s , "field" name property value source' \ - ':property:_values -s , "property" $ro_properties $rw_propnames all' \ - '*:filesystem/volume/snapshot:_zfs_dataset' - ;; - - ("inherit") - _arguments -A "-*" \ - '-r[Recursively inherit property for all children]' \ - '-S[Revert to received property value]' \ - ':property:_values -s , "property" $ro_properties $rw_properties' \ - '*:filesystem/volume:_zfs_dataset -t fs -t vol' - ;; - - ("userspace"|"groupspace") - _arguments -A "-*" \ - '-n[Print numeric ID]' \ - '-i[Translate SID to POSIX ID]' \ - '-H[Tab-delimited output with no headers]' \ - '-p[Parseable mode]' \ - '-o[Properties to list]:property:_values -s , "property" type name used quota' \ - '*-s[Sort key (ascending)]:property:_values "property" type name used quota' \ - '*-S[Sort key (descending)]:property:_values "property" type name used quota' \ - '-t[Types to list]:type:_values -s , "type" all posixuser smbuser posixgroup smbgroup' \ - '*:filesystem/volume/snapshot:_zfs_dataset' - ;; - - ("mount") - _arguments -A "-*" \ - '-o[Mount options]:mount options:_values -s , "option" {,no}{devices,exec,setuid} ro rw' \ - '-O[Overlay mount]' \ - '-v[Report mount progress]' \ - - set1 \ - ':filesystem:_zfs_dataset -t fs' \ - - set2 \ - '-a[Mount all available ZFS filesystems]' - ;; - - ("unmount") - _arguments -A "-*" \ - - set1 \ - '-f[Force unmount]' \ - ':filesystem:_zfs_dataset -t fs -t mtpt' \ - - set2 \ - '-a[Unmount all ZFS filesystems]' - ;; - - ("share") - _arguments -A "-*" \ - - set1 \ - '-a[Share all available ZFS filesystems]' \ - - set2 \ - '-r[Share filesystems recursively]' \ - ':filesystem:_zfs_dataset -t fs' \ - - set3 \ - '*-o[Create a share with these properties]:property:_values -w "share properties" $share_rw_properties' \ - '-u[Create a share without sharing it]' \ - ':filesystem:_zfs_dataset -t fs' \ - - set4 \ - ':filesystem:_zfs_dataset -t fs -t mtpt -t share' - ;; - - ("unshare") - _arguments -A "-*" \ - - set1 \ - '-a[Unshare all shared ZFS filesystems]' \ - - set2 \ - '-r[Unshare filesystems recursively]' \ - ':filesystem:_zfs_dataset -t fs' \ - - set3 \ - ':filesystem:_zfs_dataset -t fs -t mtpt -t share' - ;; - - ("send") - _arguments -A "-*" \ - '-b' \ - '-i[Generate an incremental stream]:snapshot:_zfs_dataset -t snap' \ - '-D[Perform dedup processing]' \ - '-p[Send properties]' \ - '-v[Verbose]' \ - - set1 \ - '-I[Generate an incremental stream with intermediary snapshots]:snapshot:_zfs_dataset -t snap' \ - '-R[Generate a replication stream package]' \ - ':snapshot:_zfs_dataset -t snap' \ - - set2 \ - '-c[Create a self-contained stream]' \ - '-r[Generate a recursive stream package]' \ - ':snapshot:_zfs_dataset -t snap' - ;; - - ("receive") - _arguments -A "-*" \ - '-v[Verbose]' \ - '-n[Do not receive the stream]' \ - '-F[Force a rollback if necessary]' \ - '-u[Filesystem is not mounted]' \ - '-o[Include property change in the stream]::' \ - '-x[Exclude property change from the stream]:property:' \ - - set1 \ - ':filesystem/volume/snapshot:_zfs_dataset' \ - - set2 \ - '(-e)-d[Set path prefix from stream, excluding only pool name]' \ - '(-d)-e[Set path prefix from stream, using last path element]' \ - '-:filesystem:_zfs_dataset -t fs' - ;; - - ("allow") - _arguments -A "-*" \ - '(1 -g -e -c -s)-u[delegate to user]:user:_users' \ - '(1 -u -e -c -s)-g[delegate to group]:group:_groups' \ - '(1 -g -u -c -s)-e[delegate to everyone]' \ - '(1 -u -g -e -l -d -s)-c[set permissions for newly-created descendant filesystems]' \ - '(1 -u -g -e -l -d -c)-s[define or modify permission sets]:permission set' \ - '(1 -c -s)-l[allow for named dataset]' \ - '(1 -c -s)-d[allow for descendent datasets]' \ - '1::filesystem/volume:_zfs_dataset -t fs -t vol' \ - ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' \ - ;; - - ("unallow") - _arguments -A "-*" \ - '-r[Recursive removal]' \ - - set1 \ - '-s[Remove permissions from or delete a permission set]:permission set:' \ - ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' \ - - set2 \ - '(-g)-u[User]:user:_users' \ - '(-u)-g[Group]:group:_groups' \ - '-l[Allow for named dataset]' \ - '-d[Allow for descendent datasets]' \ - ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' \ - - set3 \ - '-e[Everyone]' \ - '-l[Allow for named dataset]' \ - '-d[Allow for descendent datasets]' \ - ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' \ - - set4 \ - '-c[Create-time permissions]' \ - ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' - ;; - - ("upgrade") - _arguments -A "-*" \ - - set1 \ - '-v[Verbose]' \ - - set2 \ - '-a[Upgrade all filesystems on all pools]' \ - '-r[Upgrade descendent filesystems, too]' \ - '-V[Upgrade to specified version]:version:(1 2)' \ - - set3 \ - '-r[Upgrade descendent filesystems, too]' \ - '-V[Upgrade to specified version]:version:(1 2)' \ - ':filesystem:_zfs_dataset -t fs' - ;; - - ("hold") - _arguments -A "-*" \ - '-r[Apply hold recursively]' \ - ':tag:' \ - ':snapshot:_zfs_dataset -t snap' - ;; - - ("holds") - _arguments -A "-*" \ - '-r[List holds recursively]' \ - ':snapshot:_zfs_dataset -t snap' - ;; - - ("release") - _arguments -A "-*" \ - '-r[Release holds recursively]' \ - ':tag:' \ - ':snapshot:_zfs_dataset -t snap' - ;; - - ("diff") - _arguments -A "-*" \ - '-F[Add column for filetype character]' \ - '-H[Parseable output]' \ - '-e[Only show new and changed files]' \ - '*-o[Show fields]:field:_values "field" $difffields' \ - '-t[Add column for ctime]' \ - - set1 \ - ':snapshot:_zfs_dataset -t snap' \ - ':snapshot or filesystem:_zfs_dataset -t snap -t fs' \ - - set2 \ - '-E[Show difference from empty]' \ - ':snapshot or filesystem:_zfs_dataset -t snap -t fs' - ;; - - ("key") - _arguments -A "-*" \ - - set1 \ - '-a[Apply to all datasets in all pools]' \ - '(-u -K -f)-l[Load the encryption key]' \ - '(-l -K)-u[Unload the encryption key]' \ - '(-l -u -f)-K[Create a new data encryption key]' \ - '(-l -K)-f[Unmount the dataset before unloading the encryption key]' \ - '-r[Apply recursively]' \ - ':filesystem or volume:_zfs_dataset -t fs -t vol' \ - - set2 \ - '-c[Change the encryption key]' \ - '-o[Change a property]:property:_zfs_keysource_props' \ - ':filesystem or volume:_zfs_dataset -t fs -t vol' - ;; - - ("jail"|"unjail") - _arguments \ - '1: : _jails' \ - '2:filesystem:_zfs_dataset -t fs' - ;; - - ("help") - _arguments -A "-*" \ - - set1 \ - ':command:($subcmds $delegatable_perms $ro_properties ${rw_properties%%:*} properties)' \ - - set2 \ - '-l[Display property information]' \ - ': :(properties)' - ;; - - (*) - _message "unknown zfs subcommand: $service" - ;; - esac -} - -_zfs "$@" +#compdef zfs zdb zpool + +local curcontext="$curcontext" implementation nm="$compstate[nmatches]" +local -a state curstate line state_descr expl alts args +typeset -A opt_args val_args +local MATCH MBEGIN MEND +local -a subcmds +local -a share_nfs_ro_properties share_nfs_rw_properties +local -a share_smb_ro_properties share_smb_rw_properties +local -a share_ro_properties share_rw_properties +local -a difffields delegatable_perms key_properties +local -a ds_types sum_algorithms comp_algorithms dedup_algorithms + +local -a ds_propnames ro_ds_props rw_ds_props ci_ds_props # dataset properties +local -a po_propnames ro_po_props rw_po_props ci_po_props # pool properties + +_pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris + +ds_types=( filesystem snapshot volume all ) +sum_algorithms=( on off fletcher2 fletcher4 sha256 ) +comp_algorithms=( on off lzjb lz4 gzip gzip-{1..9} zle ) +dedup_algorithms=( on off verify sha256 sha256,verify ) + +ro_po_props=( # readonly + 'all[all properties]' + 'allocated[space allocated]' + 'capacity[space used (percentage)]' + 'dedupratio[deduplication ratio]' + 'free[space unallocated]' + 'health[health status]' + 'size[total size]' +) +ci_po_props=( # only set at create or import + 'altroot[alternate root directory]:path:_directories' + 'guid[unique identifier]:identifier' + 'readonly[whether the pool can be modified]:value:(on off)' +) +rw_po_props=( + 'autoexpand[automatic pool expansion]:value:(on off)' + 'autoreplace[automatic device replacement]:value:(on off)' + 'bootfs[default bootable dataset]:dataset:_zfs_dataset' + 'cachefile[pool configuration cache file location]:value' + 'dedupditto[threshold for number of copies]:value [0]' + 'delegation[delegated administration]:value:(on off)' + 'failmode[failure-mode behavior]:value:(wait continue panic)' + "listshares[show shares in 'zfs list']:value:(on off)" + "listsnaps[show snapshots in 'zfs list']:value:(on off)" + 'version[pool version]:version' +) + +# TODO: userused@ and groupused@ could have more extensive handling +ro_ds_props=( + name type creation space used available referenced compressratio mounted + origin usedbychildren usedbydataset usedbyrefreservation usedbysnapshots + defer_destroy userused@ userrefs groupused@ keystatus +) +ci_ds_props=( + 'casesensitivity:value:(sensitive insensitive mixed)' + 'normalization:value:(none formC formD formKC formKD)' + 'utf8only:value:(on off)' +) +rw_ds_props=( + 'aclinherit:value:(discard noallow restricted passthrough passthrough-x)' + 'atime:value:(on off)' + 'canmount:value:(on off noauto)' + "checksum:value:($sum_algorithms)" + "compression:value:($comp_algorithms)" + 'copies:value:(1 2 3)' + "dedup:value:($dedup_algorithms)" + 'devices:value:(on off)' + 'encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)' + 'exec:value:(on off)' + 'groupquota@' + 'logbias:value:(latency throughput)' + "mountpoint: : _alternative \ + 'properties:property:(none legacy)' \ + 'paths:mountpoint:_directories -W / -P /'" + 'multilevel:value:(on off)' + 'nbmand:value:(on off)' + 'primarycache:value:(all none metadata)' + 'quota: :->quotas' + 'readonly:value:(on off)' + 'recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)' + 'refquota: :->quotas' + "refreservation: : _alternative \ + 'sizes: :_numbers -M \"m:{a-zA-Z}={A-Za-z}\" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \ + 'properties:property:(auto none)'" + 'reservation: :->quotas' + 'rstchown:value:(on off)' + 'secondarycache:value:(all none metadata)' + 'setuid:value:(on off)' + 'shadow:value' # TODO: complete URI|none + 'share:share properties' + 'snapdir:value:(hidden visible)' + 'sync:value:(standard always disabled)' + 'userquota@' + 'version:value' + 'volsize:size:_numbers -M "m:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' +) + +case $service:$implementation in + *:openzfs) + ds_types+=( bookmark ) + sum_algorithms+=( noparity sha512 skein edonr ) + comp_algorithms+=( zstd zstd-{1..19} zstd-fast zstd-fast-{{1..9}{,0},100,500,1000} ) + dedup_algorithms+=( {sha512,skein}{,\,verify} edonr,verify ) + share_rw_properties=( sharesmb:option sharenfs:option ) + ro_po_props+=( + 'expandsize[uninitialized space within the pool]' + 'fragmentation[amount of fragmentation in the pool]' + 'freeing[amount of space remaining to be reclaimed]' + 'used[amount of storage space used within the pool]' + 'load_guid[unique identifier generated when pool is loaded]' + ) + ci_po_props+=( + 'ashift[pool sector size exponent]:exponent:((9\:512 10\:1024 11\:2048 12\:4096 13\:8192 14\:16384 15\:32768 16\:65536))' + ) + rw_po_props+=( + 'autotrim[periodically trim recently freed space]:value:(on off)' + 'comment[text string that is available even if the pool becomes faulted]:value' + 'multihost[perform pool activity check during import]:value:(on off)' + ) + rw_ds_props+=( + 'aclmode:value:(discard groupmask passthrough restricted)' + 'acltype:value:(off noacl nfsv4 posix posixacl)' + 'mlslabel:value:(none)' # TODO: list sensitivity labels + 'redundant_metadata:value:(all most)' + 'vscan:value:(on off)' + 'xattr:value:(on off dir sa)' + "filesystem_limit: :{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ -prefix n ]]; then compadd none; else _message -e limits 'number or none'; fi}" + "snapshot_limit: :{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ -prefix n ]]; then compadd none; else _message -e limits 'number or none'; fi}" + 'volmode:mode:(( + default\:use\ system-wide\ tunable + full\:expose\ as\ block\ devices + geom\:expose\ as\ block\ devices + dev\:hide\ partitions + none\:not\ exposed\ outside\ zfs + ))' + ) + ro_ds_props+=( + createtxg clones filesystem_count guid logicalreferenced logicalused + receive_resume_token refcompressratio snapshot_count volblocksize written + ) + delegatable_perms=( + bookmark load-key change-key userobjquota userobjused groupobjquota + groupobjused projectused projectquota projectobjused projectobjquota + ) + ;| + *:solaris) + ds_types+=( share ) + sum_algorithms+=( sha256+mac ) + share_nfs_ro_properties=( share.nfs.all ) + share_nfs_rw_properties=( + 'share.nfs:value:(on off)' + 'share.nfs.aclok:value:(on off)' + 'share.nfs.aclfab:value:(on off)' + 'share.nfs.anon:uid' + 'share.nfs.charset.'{cp932,euc-{cn,jpns,kr,tw},iso8859-{1,2,5,6,7,8,9,13,15},koi8-r,shift_jis}':access-list' + 'share.nfs.index:file:_files' + 'share.nfs.labeled:value:(on off)' + 'share.nfs.noaclfab:value:(on off)' + 'share.nfs.log:nfslog.conf tag' + 'share.nfs.nosub:value:(on off)' + 'share.nfs.nosuid:value:(on off)' + 'share.nfs.public:value:(on off)' + 'share.nfs.sec:security-mode-list' + 'share.nfs.sec.'{default,dh,krb5{,i,p},none,sys}.{ro,root,rw}':access-list' + 'share.nfs.sec.'{default,dh,krb5{,i,p},none,sys}.root_mapping':uid' + 'share.nfs.sec.'{default,dh,krb5{,i,p},none,sys}.window':credential lifetime (seconds)' + 'share.nfs.sec.sys.resvport:value:(on off)' + ) + share_smb_ro_properties=( share.smb.all ) + share_smb_rw_properties=( + 'share.smb:value:(on off)' + 'share.smb.abe' + 'share.smb.ad-container' + 'share.smb.catia:value:(on off)' + 'share.smb.csc:value:(disabled manual auto vdo)' + 'share.smb.dfsroot:value:(on off)' + 'share.smb.encrypt:value:(on off)' + 'share.smb.guestok:value:(on off)' + 'share.smb.oplocks:value:(disabled enabled)' + 'share.smb.cont_avail:value:(on off)' + 'share.smb.'{none,ro,rw}':access-list' + ) + share_ro_properties=( + share.all share.fs share.name share.point share.protocols share.state + $share_nfs_ro_properties $share_smb_ro_properties + ) + share_rw_properties=( + 'share.desc:description' + 'share.auto:value:(on off)' + 'share.autoname:value' + 'share.nfs.cksum:value' + 'share.path:path' + $share_nfs_rw_properties $share_smb_rw_properties + ) + ro_po_props+=( + 'lastscrub[start time of the last successful scrub]' + ) + rw_po_props+=( + 'clustered[pool is imported as a global pool in Oracle Solaris Cluster]:value:(on off)' + 'scrubinternal[time interval between scheduled scrubs]:interval' + ) + ro_ds_props+=( keychangedate rekeydate effective{read,write}limit ) + rw_ds_props+=( + 'aclmode:value:(discard mask passthrough)' + "defaultreadlimit: : _alternative \ + 'sizes: :_guard \[0-9\]\#\(\|\[BKMGTPEZ\]\) size\ \(bytes\ per\ second\)' \ + 'properties:property:(none)'" + "defaultwritelimit: : _alternative \ + 'sizes: :_guard \[0-9\]\#\(\|\[BKMGTPEZ\]\) size\ \(bytes\ per\ second\)' \ + 'properties:property:(none)'" + 'defaultuserquota:->quotas' + 'defaultgroupquota: :->quotas' + 'keysource:value:->keysources' + ) + ci_ds_props+=( + 'volblocksize:value:compadd -o nosort 512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M' + ) + difffields=( + object parent size links linkschange name oldname user group + ctime mtime atime crtime mountpoint dataset_name + ) + delegatable_perms=( key keychange ) + ;| + zfs:openzfs) + subcmds+=( + bookmark change-key load-key program project projectspace redact + unload-key wait + ) + ;| + zpool:openzfs) + subcmds+=( + checkpoint events labelclear initialize reopen resilver sync trim wait + version + ) + ;| + zfs:solaris) + subcmds+=( key help ) + ;| + zpool:solaris) + subcmds+=( help label monitor ) + ;| + + zfs:*) + subcmds+=( + create destroy clone promote rename snapshot rollback list set get + inherit mount unmount share unshare send receive allow unallow upgrade + userspace groupspace hold holds release diff + ) + [[ $OSTYPE = freebsd<7->.* ]] && subcmds+=( jail unjail ) + ;; + zpool:*) + subcmds+=( + add attach clear create destroy detach export get history import iostat + list offline online reguid remove replace scrub set split status upgrade + ) + ;; +esac + +case $OSTYPE in + solaris*) + rw_ds_props+=( 'zoned:value:(on off)' ) + ;; + freebsd*) + [[ $OSTYPE = freebsd<-12>.* ]] && subcmds+=( remap ) + rw_ds_props+=( 'jailed:value:(on off)' ) + ;; + linux-gnu) + rw_ds_props+=( 'relatime:value:(on off)' ) + ci_ds_props+=( + {,fs,def,root}'context:SELinux context:_selinux_contexts' + ) + ;; +esac + +delegatable_perms+=( + allow clone create destroy diff hold key keychange mount promote receive + release rename rollback send share snapshot groupquota groupused userprop + userused ${ci_ds_props%%:*} +) + +key_properties=( + 'keylocation:location [prompt]:_files -P file\:// -W /' + 'keyformat:format:(raw hex passphrase)' + 'pbkdf2iters:iterations [350000]' +) + +ro_ds_props+=( $share_ro_properties ) +rw_ds_props+=( $share_rw_properties ) +ci_ds_props+=( $rw_ds_props ) + +ds_propnames=( ${rw_ds_props%%:*} ) +po_propnames=( ${ro_po_props%%:*} ${ci_po_props%%:*} ${rw_po_props%%:*} ) + + +case $service in + zfs|zpool) + _arguments -C -A "-*" \ + '-?[display usage information]' \ + '*::command:->subcmd' && return 0 + + if (( CURRENT == 1 )); then + _wanted commands expl "subcommand" compadd -a subcmds + return + fi + curcontext="${curcontext%:*}-$words[1]:" + ;; + zdb) + if [[ $implementation = openzfs ]]; then + args=( + '-mm[also display free space histogram associated with each metaslab]' + {-mmm,-MM}'[display more free space information]' + {-mmmm,-MMM}'[display every spacemap record]' + '-DD[display a histogram of deduplication statistics]' + '-DDD[display deduplication statistics independently for each table]' + '-DDDD[dump the contents of the deduplication tables describing duplicate blocks]' + '-DDDDD[also dump the contents of the deduplication tables describing unique blocks]' + '-E+[decode and display block from a given embedded block pointer]:word' + '(-l)-ll+[like -l but display L2ARC log blocks]:device:_files' + '(-l -ll)-lll+[like -l but display every configuration, unique or not]:device:_files' + "-q[don't print labels (with -l)]" + '-k[examine the checkpointed state of the pool]' + '-M[display the offset, spacemap, and free space of each metaslab]' \ + '-O+[look up the specified path inside of the dataset]:dataset:_zfs_dataset:path:_files' + '-o+[set the given global libzpool variable]:variable' + '-r+[copy the specified path inside of the dataset to the specified destination]:dataset:_zfs_dataset:path:_files:destination:_files' + '-x+[copy all blocks accessed to files in the specified directory]:directory:_directories' + '-V[attempt verbatim import]' + '-Y[attempt all possible combinations when reconstructing indirect split blocks]' + '-y[perform validation for livelists that are being deleted]' + ) + else + args=( + '-?[display usage information]' + '-M+[dump MOS contents]:contents: _values -s , raw_config all objset dir pool_props metaslab sync_bplist dtl config spares l2cache history errlog_scrub errlog_last bpmap-vdev bpmap_defer_obj dtl-scan ddt2' + '-r[dump datasets recursively]' + '-z[report zombies only]' + '-V[verify DDT xtree block data]' + "-a[don't import l2arc cache data]" + '-f[attempt to force import (with -e)]' + '-w+[specify directory to save shadow copy of all accessed disk locations]: :_directories' + '-x+[set kernel tunable]:tunable' + '-G[dump the contents of the zfs_dbgmsg buffer before exiting]' + '-I[limit the number of outstanding checksum I/Os to the specified value]' + ) + fi + _arguments -A "-*" -S $args \ + '(-C)-b[display block statistics]' \ + '(-C)*-c[verify checksum of metadata blocks]' \ + '(-b -c -d)-C[display configuration information]' \ + '(-C)*-d[display dataset information]' \ + '-h[display pool history]' \ + '-i[display intent log (ZIL) information]' \ + '-l+[read the vdev labels from the specified device]:device:_files' \ + '-m[display the offset, spacemap, and free space of each metaslab]' \ + '-s[report statistics on zdb I/O]' \ + '*-u[also display the uberblocks on the device (with -l)]' \ + '*-v[enable verbose output]' \ + '-D[display deduplication statistics]' \ + '-S[simulate the effects of deduplication, displaying constructed DDT as with -DD]' \ + '-L[disable leak detection and the loading of space maps]' \ + '-R+[read and display a block from the specified device]:device' \ + "-A[don't abort should any assertion fail]" \ + "-AA[enable panic recovery]" \ + '-F[try progressively older transactions until pool is readable]' \ + '-U+[specify cache file to use]:cache file [/etc/zfs/zpool.cache]:_files' \ + '-X[attempt "extreme" transaction rewind]' \ + '-e[operate on an exported pool]' \ + '-p[specify path under which to search for devices (with -e)]:path:_files' \ + '-P[use exact (parsable) numeric output]' \ + '-t+[specify the highest transaction to use when searching for uberblocks]:transaction' \ + '1:pool:_zfs_pool' + return + ;; +esac + +case $service:$words[1] in + zfs:create) + [[ $implementation = openzfs ]] && args=( + '-P[print machine-parsable verbose information about the created dataset]' + '-n[do a dry-run, no dataset will be created]' + '-v[print verbose information about the created dataset]' + ) + _arguments -C -A "-*" -S $args \ + '-p[create parent datasets]' \ + '*-o+[set initial propertyvalue]:property:->create-properties' \ + - set1 \ + ':filesystem:_zfs_dataset -t fs -e "parent dataset"' \ + - set2 \ + '-s[create sparse volume]' \ + '-b+[set volblocksize]: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes blocksize \:B {k,M,G,T,P,E,Z}{,B}' \ + '-V+[set size]: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size \:B {k,M,G,T,P,E,Z}{,B}' \ + ':volume:_zfs_dataset -t fs -e "parent dataset"' + ;; + + zfs:destroy) + if [[ $implementation = openzfs ]]; then + args=( + '-n[do a dry-run, no data will be deleted]' + '-p[print machine-parsable verbose information about the deleted data]' + '-v[print verbose information about the deleted data]' + ) + else + args=( '-s[destroy snapshots synchronously - only return when blocks freed]' ) + fi + _arguments -A "-*" -S $args \ + '-r[recursively destroy all children]' \ + '-R[recursively destroy all dependents]' \ + '(-f)-d[delete or mark deferred]' \ + '(-d)-f[force unmounts]' \ + ':dataset:_zfs_dataset -t fs -t vol ${=${opt_args[(i)-f]:--t snap}:/-f/} ${=${opt_args[(i)-*]:--t bookmark}:/-?/}' + ;; + + zfs:snap(|shot)) + _arguments -C -A "-*" -S \ + '-r[recursively snapshot all descendant datasets]' \ + '*-o+[set property]:property:->create-properties' \ + ':filesystem/volume:_zfs_dataset -t fs -t vol -S@' + ;; + + zfs:rollback) + _arguments -A "-*" -S \ + '-r[recursively destroy more recent snapshots]' \ + '-R[recursively destroy more recent snapshots and clones]' \ + '-f[force unmounts]' \ + ':snapshot:_zfs_dataset -t snap' + ;; + + zfs:clone) + [[ $implementation = solaris ]] && args+=( + '-K[create encryption key]' + ) + _arguments -C -A "-*" -S $args \ + '-p[create parent datasets]' \ + '*-o+[set property]:property:->create-properties' \ + ':snapshot:_zfs_dataset -t snap' \ + ':filesystem/volume:_zfs_dataset -t fs -e "parent dataset"' + ;; + + zfs:promote) + _arguments \ + ':filesystem:_zfs_dataset -t clone' \ + ;; + + zfs:rename) + [[ $implementation = openzfs ]] && args=( + '(-r -u)-f[force unmount any filesystems]' + "(-r -f)-u[don't remount file systems during rename]" + ) + _arguments -A "-*" -S $args \ + '(-r)-p[create parent datasets]' \ + '(-p -u -f)-r[recursively rename snapshots of all descendent datasets]' \ + ':dataset:_zfs_dataset -r1' \ + ':dataset:_zfs_dataset -r2' + ;; + + zfs:bookmark) + _arguments \ + ':snapshot or bookmark:_zfs_dataset -t snap -t bookmark' \ + ':bookmark' + ;; + + zfs:program) + _arguments -A "-*" -S \ + '-j[display channel program output in JSON format]' \ + '-n[execute a read-only channel program]' \ + '-t+[limit the number of Lua instructions to execute]:instruction limit' \ + '-m+[specify memory limit]:memory limit (bytes) [10MB]' \ + ':pool:_zfs_pool' \ + ':script:_files' \ + '*: :_default' + ;; + + zfs:list) + if [[ $implementation = solaris ]]; then + args=( '-I+[specify dataset states to display instead of normal datasets]:dataset state:_sequence compadd - receiving resumable hidden all' ) + else + args=( '-p[use exact (parsable) numeric output]' ) + fi + _arguments -A "-*" -S $args \ + '(-d)-r[recursively display children]' \ + '-H[suppress printing of headers]' \ + '(-r)-d+[depth]:value' \ + '-o+[specify properties to list]: :_values -s , "property" $ro_ds_props $ds_propnames' \ + '*-s+[specify sort key (ascending)]: :_values "property" $ro_ds_props $ds_propnames' \ + '*-S+[specify sort key (descending)]: :_values "property" $ro_ds_props $ds_propnames' \ + '-t+[specify dataset types to list]: :_values -s , "dataset type" $ds_types' \ + '*:filesystem/volume/snapshot/path:_zfs_dataset -p' + ;; + + zfs:set) + [[ $implementation = solaris ]] && args=( + '-r[recursively apply value]' \ + ) + _arguments -C -A "-*" -S $args \ + ':property:->set-properties' \ + '*:filesystem/volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:get) + if [[ $implementation == openzfs ]]; then + args=( '-t+[specify dataset types to display]: :_values -s , "dataset type" $ds_types' ) + else + args=( '-e[expand property sublists to any depth]' ) + fi + _arguments -A "-*" -S $args \ + "(-d)-r[recursively display children's properties]" \ + '(-r)-d+[depth]:value' \ + '-H[suppress printing of headers]' \ + '-p[use exact (parsable) numeric output]' \ + '-s+[specify sources]: :_values -s , "source" local default inherited received temporary none' \ + '-o+[specify fields]: :_values -s , "field" name property received value source' \ + ':property:_values -s , "property" $ro_ds_props $ds_propnames all' \ + '*:filesystem/volume/snapshot:_zfs_dataset' + ;; + + zfs:inherit) + _arguments -C -A "-*" -S \ + '-r[recursively inherit property for all children]' \ + '-S[revert to received property value]' \ + ':property:_values "property" $ro_ds_props ${rw_ds_props%%:*}' \ + '*:filesystem/volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:remap) + _arguments \ + ':filesystem or volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:upgrade) + _arguments -A "-*" -S \ + '(- :)-v[display supported ZFS versions]' \ + '(-v :)-a[upgrade all filesystems on all pools]' \ + '(-v)-r[upgrade descendent filesystems, too]' \ + '(-v)-V+[upgrade to specified version]:version' \ + '(-a -v):filesystem:_zfs_dataset -t fs' + ;; + + zfs:(user|group)space) + args=( + '-n[print numeric ID]' + '-i[translate SID to POSIX ID]' + ) + ;& # fall-through + zfs:projectspace) + [[ $implementation = solaris ]] && args+=( + '(- *)'{-h,--help}'[display usage information]' + ) + _arguments -A "-*" -S $args \ + '-H[suppress printing of headers, tab-delimit columns]' \ + '-p[use exact (parsable) numeric output]' \ + '-o+[specify properties to list]:property:_values -s , "property" type name used quota' \ + '*-s+[specify sort key (ascending)]: :_values "property" type name used quota' \ + '*-S+[specify sort key (descending)]: :_values "property" type name used quota' \ + '-t+[specify types to list]:type:_values -s , "type" all posixuser smbuser posixgroup smbgroup' \ + '*:filesystem/volume/snapshot:_zfs_dataset' + ;; + + zfs:project) + _arguments -A "-*" -S \ + '(-r -C -k -p -s)-d[act on the directory project ID and inherit flag, not its children]' \ + '(-d)-r[act on subdirectories recursively]' \ + '(-0 -c -d -s)-C[clear project inherit flag and/or ID on the file(s) or directories]' \ + '(-0 -c -d -p -s)-k[keep the project ID unchanged]' \ + '(-k -C -s)-c[check project ID and inherit flag on the file(s) or directories]' \ + '(-k -C -s)-0[print file name with a trailing NUL instead of newline]' \ + '(-k)-p+[specify project ID]:project ID' \ + '(-0 -c -k -C)-s[set project inherit flag on the given file(s) or directories]' \ + '*:file:_files' + ;; + + zfs:mount) + [[ $OSTYPE != freebsd* ]] && args=( '-O[overlay mount]' ) + [[ $implementation = openzfs ]] && args+=( + '-l[load keys for encrypted filesystems as they are being mounted]' + ) + _arguments -A "-*" -S $args \ + '-o+[specify temporary file system options]: :_values -s , "option" {,no}{atime,dev,exec,relatime,suid,xattr} ro rw' \ + '-v[report mount progress]' \ + '-f[force mount]' \ + '(:)-a[mount all available ZFS filesystems]' \ + '(-a):filesystem:_zfs_dataset -t fs' + ;; + + zfs:u(|n)mount) + [[ $implementation = openzfs ]] && args+=( + '-u[unload keys for any unmounted encryption roots]' + ) + _arguments -A "-*" -S $args \ + '-f[force unmount]' \ + '(:)-a[unmount all ZFS filesystems]' \ + '(-a):dataset or mountpoint:_zfs_dataset -t fs -t mtpt' + ;; + + zfs:share) + [[ $implementation = solaris ]] && args=( + - set2 \ + '-r[share filesystems recursively]' \ + ':dataset:_zfs_dataset -t fs' \ + - set3 \ + '*-o+[create a share with specified properties]: :_values -w "share properties" $share_rw_properties' \ + '-u[create a share without sharing it]' \ + ':dataset:_zfs_dataset -t fs' \ + ) + _arguments -A "-*" -S \ + - set1 \ + '-a[share all available ZFS filesystems]' \ + $args \ + - set4 \ + ':dataset or mountpoint:_zfs_dataset -t fs -t mtpt -t share' + ;; + + zfs:unshare) + [[ $implementation = solaris ]] && args=( + - set2 + '-r[unshare filesystems recursively]' + ':filesystem:_zfs_dataset -t fs' + ) + _arguments -A "-*" -S $args \ + - set1 \ + '-a[unshare all shared ZFS filesystems]' \ + - set3 \ + ':filesystem:_zfs_dataset -t fs -t mtpt -t share' + ;; + + zfs:send) + if [[ $implementation = openzfs ]]; then + args=( + '(-L --large-block)'{-L,--large-block}'[generate a stream which may contain blocks larger than 128KB]' + '(-P --parsable)'{-P,--parsable}'[print machine-parsable verbose information about the stream generated]' + '(-e --embed)'{-e,--embed}'[more compact stream for blocks stored with the embedded_data feature]' + '(-c --compressed)'{-c,--compressed}'[more compact stream for compressed blocks]' + '(-h --holds)'{-h,--holds}'[send snapshot holds]' + '-V[set the process title to a per-second report of how much data has been send]' + '-t[create a send stream that resumes an interrupted receive]:resume token' + '(-w --raw)'{-w,--raw}'[keep encrypted data exactly as it exists on disk]' + - redact + '(-h -V -t -w --raw)--redact[generate a redacted send stream]' + - saved + '(-S --saved)'{-S,--saved}'[generate stream from partially received dataset]' + ) + else + args=( + '-w+[send compressed filesystem blocks as compressed in the stream]:compression:(compress none)' + '-m+[limit amount of memory used by deduplication processing]: :_numbers -u bytes "memory size" K M G' + '-s+[set stream options]:token:(streamsize check nocheck memsize)' + '-C[read a receive checkpoint from stdin]' + '-c[create a self-contained stream]' + '(-R)-r[generate a recursive stream package]' + ) + fi + _arguments -A "-*" -S \ + '-b[send only received property values]' \ + '(-I)-i[generate an incremental stream]:snapshot:_zfs_dataset -t snap' \ + '-D[perform dedup processing]' \ + "-n[don't send the stream]" \ + '-p[send properties]' \ + '-v[verbose]' \ + '(-i)-I[generate an incremental stream with intermediary snapshots]:snapshot:_zfs_dataset -t snap' \ + '(-r)-R[generate a replication stream package]' \ + ':snapshot:_zfs_dataset -t snap -t bookmark' \ + $args + ;; + + zfs:redact) + _arguments \ + ':snapshot:_zfs_dataset -t snap' \ + ':bookmark:_zfs_dataset -t bookmark' \ + ':redaction snapshot:_zfs_dataset -t snap' + ;; + + zfs:(receive|recv)) + if [[ $implementation = openzfs ]]; then + args=( + '-h[skip the receive of holds]' + '-s[if the receive is interrupted, save the partially received state]' + '(- set2)-A[abort an interrupted zfs recv -s, deleting its saved partially received state]' + ) + [[ $OSTYPE != linux* ]] && args+=( + '-M[force an unmount of the file system while receiving a snapshot]' + ) + else + args=( '(-)-C[write a receive checkpoint to stdout]' ) + fi + _arguments -A "-*" -S $args \ + '-v[verbose]' \ + "-n[don't receive the stream]" \ + '-F[force a rollback if necessary]' \ + '-u[filesystem is not mounted]' \ + '-o[include property change in the stream]:property' \ + '-x[exclude property change from the stream]:property' \ + - set1 \ + ':filesystem/volume/snapshot:_zfs_dataset' \ + - set2 \ + '(-e)-d[set path prefix from stream, excluding only pool name]' \ + '(-d)-e[set path prefix from stream, using last path element]' \ + ':filesystem:_zfs_dataset -t fs' + ;; + + zfs:allow) + _arguments -C -A "-*" -S \ + '(-g -e -c -s)-u[delegate to user]' \ + '(-u -e -c -s)-g[delegate to group]' \ + '(1 -g -u -c -s)-e[delegate to everyone]' \ + '(1 -u -g -e -l -d -s)-c[set permissions for newly-created descendant filesystems]' \ + '(-u -g -e -l -d -c)-s[define or modify permission sets]:permission set' \ + '(-c -s)-l[allow for named dataset]' \ + '(-c -s)-d[allow for descendent datasets]' \ + '1: :->first' \ + ':permission list:_values -s , "permission or set" $delegatable_perms' \ + ':filesystem/volume:_zfs_dataset -t fs -t vol' + + if [[ -n $state ]]; then + case $opt_args[(I)-[ugs]] in + ^-[ug]) alts+=( 'permission-sets: :_guard "(|@*)" "permission set"' ) ;| + ^-[gs]) alts+=( 'users:user:_users' ) ;| + ^-[us]) alts+=( 'groups:group:_groups' ) ;| + '') + alts+=( + 'all:everyone:(everyone)' + 'filesystems:filesystem/volume:_zfs_dataset -t fs -t vol' + ) + ;; + esac + _alternative $alts + fi + ;; + + zfs:unallow) + _arguments -A "-*" -S \ + '-r[recursive removal]' \ + '(-e -g -s -c)-u[user]' \ + '(-e -u -s -c)-g[group]' \ + '(1 -g -u -s -c)-e[everyone]' \ + '(1 -u -g -e -s -l -d)-c[create-time permissions]' \ + '(-e -u -g -c)-s[remove permissions from or delete a permission set]:permission set' \ + '(-c -s)-l[allow for named dataset]' \ + '(-c -s)-d[allow for descendent datasets]' \ + '1: :->first' \ + '::permissions or sets:_values -s , "permission or set" $delegatable_perms' \ + ':filesystem/volume:_zfs_dataset -t fs -t vol' + + if [[ -n $state ]]; then + case $opt_args[(I)-[ugs]] in + ^-[ug]) alts+=( 'permission-sets: :_guard "(|@*)" "permission set"' ) ;| + ^-[gs]) alts+=( 'users:user:_users' ) ;| + ^-[us]) alts+=( 'groups:group:_groups' ) ;| + '') alts+=( 'all:everyone:(everyone)' ) ;; + esac + _alternative $alts + fi + ;; + + zfs:hold) + _arguments -A "-*" -S \ + '-r[apply hold recursively]' \ + ':tag' \ + ':snapshot:_zfs_dataset -t snap' + ;; + + zfs:holds) + [[ $implementation = openzfs ]] && args=( + '-H[suppress printing of headers, tab-delimit columns]' + ) + [[ $OSTYPE = freebsd<-12>.* ]] && args+=( + # features were lost with the openzfs rebase + '-p[use exact (parsable) numeric output]' + '(-r)-d+[depth]:value' + ) + _arguments -A "-*" -S $args \ + '(-d)-r[list holds recursively]' \ + ':snapshot:_zfs_dataset -t snap' + ;; + + zfs:release) + _arguments -A "-*" -S \ + '-r[release holds recursively]' \ + ':tag' \ + ':snapshot:_zfs_dataset -t snap' + ;; + + zfs:diff) + [[ $implementation = solaris ]] && args=( + '(-E)-e[only show new and changed files, no deleted]' + '*-o+[show specified fields]:field:_values "field" $difffields' + '-q[silence warnings for missing snapshots on recursive datasets]' + '-N[enumerate new child datasets (with -r)]' + '(1 -e)-E[show difference from empty]' + ) + _arguments -A "-*" -S $args \ + '-F[add column for filetype character, similar to ls(1)]' \ + '-H[suppress printing of headers and arrows, tab-delimit columns]' \ + '-t[add column for ctime]' \ + '(-E)1:snapshot:_zfs_dataset -t snap' \ + '2:snapshot or filesystem:_zfs_dataset -t snap -t fs' + ;; + + zfs:wait) + _arguments -A "-*" -S \ + '-t[specify background activity]:activity:(deleteq)' \ + ':filesystem:_zfs_dataset' + ;; + + zfs:key) + _arguments -C -A "-*" -S \ + '-t+[only apply to given dataset type]: :_values -s , "dataset type" $ds_types' \ + '(-u -c -K -f -o)-l[load the encryption key]' \ + "(-u -c -K -f -o)-M[don't mount file systems after loading their keys]" \ + "(-u -c -K -f -o)-S[don't share file systems after loading their keys]" \ + '(-l -c -K -o -M -S)-u[unload the encryption key]' \ + '(-l -c -K -o -M -S)-f[force unmount the dataset before unloading the encryption key]' \ + '(-l -u -K -f -M -S)-c[change the encryption key]' \ + '(-l -u -K -f -M -S)-o+[change a property]:property:->keysources' \ + '(-l -c -u -f -o -M -S)-K[create a new data encryption key]' \ + '(1 -r)-a[apply to all datasets in all pools]' \ + '(-a)-r[apply recursively]' \ + ':filesystem or volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:load-key) + _arguments -A "-*" -S \ + "-L+[specify location of user's encryption key]:key location [prompt]:_files -P file\:// -W /" \ + '(:)-a[load keys for all encryption roots in all imported pools]' \ + '-n[do a dry-run, simply check that the provided key is correct]' \ + '-r[load keys for datasets recursively]' \ + '(-a):filesystem or volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:unload-key) + _arguments -A "-*" -S \ + '(:)-a[unload keys for all encryption roots in all imported pools]' \ + '-r[unload keys for datasets recursively]' \ + '(-a):filesystem or volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:change-key) + _arguments -A "-*" -S \ + '(-o)-i[make filesystem inherit key from its parent]' \ + '-l[ensure key is loaded before attempting to change it]' \ + '(-i)*-o+[change encryption key property]: :_values -s , "property" $key_properties' \ + ':filesystem or volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:jail|zfs:unjail) + _arguments \ + '1: : _jails' \ + '2:filesystem:_zfs_dataset -t fs' + ;; + + zfs:help) + _arguments -A "-*" -S \ + - set1 \ + ':command:($subcmds $delegatable_perms $ro_ds_props ${rw_ds_props%%:*} properties)' \ + - set2 \ + '(2)-l[display property information]' \ + ':help topic:(property)' \ + ':property:($delegatable_perms $ro_ds_props ${rw_ds_props%%:*})' + ;; + + zpool:help) + _arguments -A "-*" -S \ + - commands \ + ':command:($subcmds)' \ + - properties \ + '(2)-l[display property information]' \ + ':help topic:(property)' \ + ':property:(${po_propnames%%\[*})' + ;; + + zpool:add) + if [[ $implementation = openzfs ]]; then + args=( + '-g[display vdev, GUIDs instead of the normal device names]' + '-L[display real paths for vdevs resolving all symbolic links]' + '-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"' \ + '-P[display real paths for vdevs instead of only the last component of the path]' + ) + elif [[ $implementation = solaris ]]; then + args=( '-l[display configuration in /dev/chassis location form]' ) + fi + _arguments -A "-*" -S $args \ + '-f[force use of in-use devices]' \ + '-n[display configuration without modifying pool]' \ + ':pool:_zfs_pool' \ + '*:virtual device:->virtual-devices' + ;; + + zpool:attach) + if [[ $implementation = openzfs ]]; then + args=( + '-w[wait until new device has finished resilvering before returning]' + '-s[reconstruct sequentially to restore redundancy as quickly as possible]' + '-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"' + ) + fi + _arguments -A "-*" -S $args \ + '-f[force attach, even if in use]' \ + ':pool:_zfs_pool' \ + ':virtual device:->pool-devices' \ + ':virtual device:->disk-devices' + ;; + + zpool:checkpoint) + _arguments -A "-*" -S \ + '(-d --discard)'{-d,--discard}'[discard an existing checkpoint from the pool]' \ + '(-w --wait)'{-w,--wait}'[wait until the checkpoint has finished being discarded before returning]' \ + ':pool:_zfs_pool' + ;; + + zpool:clear) + [[ $implementation = solaris ]] && args=( + '-f[ignore fmadm acquit and fmadm repair failures]' + ) + _arguments -C -A "-*" -S $args \ + '-F[discard transactions to allow pool opening]' \ + '-n[with -F, check if discarding transactions would work]' \ + '-X[(undocumented) extreme rewind of transactions]' \ + ':pool:_zfs_pool' \ + '*:virtual device:->pool-devices' + ;; + + zpool:create) + if [[ $implementation = openzfs ]]; then + args=( + "-d[don't enable any features on the new pool]" + ) + else + args=( + '-B[create EFI boot partition on whole disks]' + '-l[display configuration in /dev/chassis location form]' + "-N[create pool but don't mount or share]" + ) + fi + _arguments -C -A "-*" -S $args \ + '-o+[set pool property at creation time]:property:->newpool-properties' \ + '-O+[set dataset property at creation time]:property:->create-properties' \ + '-f[force use of in-use devices]' \ + '-n[display configuration without creating pool]' \ + '-R+[use alternate root]:alternate root:_directories' \ + '-m+[set mountpoint for root dataset]:mountpoint' \ + '-t+[use a temporary pool name]:pool name' \ + ':pool :_guard "^-*" "pool name"' \ + '*: :->virtual-devices' + ;; + + zpool:destroy) + _arguments -A "-*" -S \ + '-f[force active datasets to be unmounted]' \ + ':pool:_zfs_pool' + ;; + + zpool:detach) + _arguments -C \ + ':pool:_zfs_pool' \ + ':virtual device:->pool-devices' + ;; + + zpool:events) + _arguments -A "-*" -S \ + '(- 1)-c[clear all previous events]' \ + '-f[follow mode - continue running, showing new events]' \ + '-H[suppress headers and tab-delimit fields]' \ + '-v[print the entire payload for each event]' \ + '(-c)1:pool:_zfs_pool' + ;; + + zpool:export) + [[ $implementation = openzfs ]] && args=( '(*)-a[export all pools]' ) + _arguments -A "-*" -S $args \ + '-f[forcefully unmount all datasets]' \ + '*:pool:_zfs_pool' + ;; + + zpool:get) + [[ $implementation = solaris ]] && args=( + '-s+[specify sources to display]: :_values -s "source" local default none' + ) + _arguments -A "-*" -S $args \ + '-H[suppress headers and tab-delimit fields]' \ + '-p[display numbers in parseable (exact) values]' \ + '-o+[specify fields to display]: : _values -s , field name property value source' \ + ':property:_values -s , "property" $po_propnames' \ + '*:pool:_zfs_pool' + ;; + + zpool:history) + _arguments -A "-*" -S \ + '-i[display internal events]' \ + '-l[long format]' \ + '*:pool:_zfs_pool' + ;; + + zpool:import) + # TODO: -o should complete mount options, too + if [[ $implementation = openzfs ]]; then + args=( + '-t[new pool name is temporary]' + '-l[request encryption keys for all encrypted datasets]' + '--rewind-to-checkpoint[rewind pool to the checkpointed state]' + '-s[scan using the default search path]' + '(-F -X)-T[specify the txg to use for rollback]' + ) + else + args=( + '(-a)-t+[use a temporary pool name]:pool name' + '-l[display configuration in /dev/chassis location form]' + ) + fi + _arguments -C -A "-*" -S $args \ + '(1 2 -t)-a[search for and import all pools found]' \ + '-D[destroyed pools only]' \ + '(-d)*-c+[use cache file]:cache file:_files' \ + '(-c -D)*-d+[search for devices or files in directory]:directory:_files -/' \ + '-F[recovery mode: discard transactions if required]' \ + '-X[(undocumented) extreme rewind of transactions]' \ + '!-V' \ + '-f[force import]' \ + '-m[ignore missing log devices]' \ + '-N[import pool without mounting any filesystems]' \ + "-n[with -F; don't perform input]" \ + '-R+[specify alternate root]:alternate root:_files -/' \ + '-o+[set pool or dataset property]:property:->import-properties' \ + '1:pool name or id:_zfs_pool' \ + '2::new pool name' + ;; + + zpool:initialize) + _arguments -A "-*" -S \ + '(-s --suspend -c --cancel)'{-c,--cancel}'[cancel initializing on specified devices]' \ + '(-s --suspend -c --cancel)'{-s,--suspend}'[suspend initializing on specified devices]' \ + '(-w --wait)'{-w,--wait}'[wait until devices have finished initializing before returning]' \ + ':pool:_zfs_pool' \ + '*:device:pool-devices' + ;; + + zpool:iostat) + if [[ $implementation = openzfs ]]; then + args=( + '-c[run scripts on each vdev]:script:_files -W "($ZPOOL_SCRIPTS_PATH /etc/zfs/zpool.d ~/.zpool.d)"' + '-g[display vdev GUIDs instead of normal device names]' + '-H[suppress headers and tab-delimit fields]' + '-L[display real paths for vdevs resolving all symbolic links]' + '-n[print headers only once]' + '-p[display numbers in parsable (exact) values and times in nanoseconds]' + '-P[display full paths for vdevs instead of only the last component of the path]' + "-r[print request size histograms for the leaf vdev's IO]" + '-y[omit statistics since boot]' + '-w[display latency histograms]' + '-l[include average latency statistics]' + '-q[include active queue statistics]' + ) + else + args=( '-l[display configuration in /dev/chassis location form]' ) + fi + _arguments -A "-*" -S $args \ + '-T+[display a timestamp]:format:((d\:standard u\:internal))' \ + '-v[verbose statistics]' \ + '*::pool:_zfs_pool' \ + '::interval' \ + '::count' + ;; + + zpool:label) + _arguments -C -A "-*" -S \ + '(-c)*-d+[specify path in which to search for devices or files]:path:_directories' \ + '(-d)-c+[read configuration from specified cache file]:cache file:_files' \ + '(-R)-C[clear ZFS metadata on an inactive pool or device]' \ + '(-C)-R[recover ZFS metadata for a pool]' \ + '1::pool:_zfs_pool' \ + '2:device:->pool-devices' + ;; + + zpool:labelclear) + _arguments -A "-*" -S \ + '-f[treat exported or foreign devices as inactive]' \ + '*:virtual device:_files' + ;; + + zpool:list) + [[ $implementation = openzfs ]] && args=( + '-g[display vdev GUIDs instead of normal device names]' + '-L[display real paths for vdevs resolving all symbolic links]' + '-p[display numbers in parsable (exact) values]' + '-P[display full paths for vdevs instead of only the last component of the path]' + '-v[report usage statistics for individual vdevs within the pool]' + ) + _arguments -A "-*" -S $args \ + '-H[suppress headers and tab-delimit fields]' \ + '-T+[display a timestamp]:format:((d\:standard u\:internal))' \ + '-o+[specify fields to list]: :_values -s , "field" $po_propnames' \ + '::pool:_zfs_pool' + ;; + + zpool:monitor) + _arguments -A "-*" -S \ + '-t+[specify provider]:provider:(send receive scrub resilver ddtmigrate destroy)' \ + '-o+[specify fields]: :_values -s , field done other pctdone pool provider speed starttime tag timeleft timestmp total' \ + '-T+[display a timestamp]:format:((d\:standard u\:internal))' \ + '-p[use machine-parseable output format]' \ + '1:pool:_zfs_pool' \ + '2:interval' \ + '3:count' + ;; + + zpool:offline) + [[ $implementation = openzfs ]] && args=( + '-f[force disk into faulted state]' + ) + _arguments -C -A "-*" -S $args \ + '-t[offline until next reboot]' \ + ':pool:_zfs_pool' \ + '*:virtual device:->pool-devices' + ;; + + zpool:online) + _arguments -C -A "-*" -S \ + '-e[expand device to use all available space]' \ + ':pool:_zfs_pool' \ + '*:virtual device:->pool-devices' + ;; + + zpool:reopen) + _arguments -A "-*" -S \ + "-n[don't restart an in-progress scrub operation]" \ + '1:pool:_zfs_pool' + ;; + + zpool:reguid) + _zfs_pool + ;; + + zpool:remove) + [[ $implementation = openzfs ]] && args=( + '(-s)-w[wait until removal has completed before returning]' + ) + _arguments -C -A "-*" -S $args \ + "(-s)-n[don't perform the removal, display mapping table memory use]" \ + '(-s)-p[with -n, display numbers in parseable (exact) values]' \ + '(- *)-s[stop and cancel an in-progress removal]' \ + '1:pool:_zfs_pool' \ + '*:device:->pool-devices' + ;; + + zpool:replace) + [[ $implementation = openzfs ]] && args=( + '-w[wait until replacement has completed before returning]' + '-s[reconstruct sequentially to restore redundancy as quickly as possible]' + '-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"' + ) + _arguments -A "-*" -S $args \ + '-f[force attach, even if in use]' \ + ':pool:_zfs_pool' \ + ':virtual device:_files' \ + '::virtual device:_files' + ;; + + zpool:(resilver|sync)) + _arguments \ + '*:pool:_zfs_pool' + ;; + + zpool:scrub) + [[ $implementation = openzfs ]] && args=( + '(-s)-p[pause scrubbing]' + '-w[wait until scrub has completed before returning]' + ) + _arguments -A "-*" -S $args \ + '(-p)-s[stop scrubbing]' \ + '*:pool:_zfs_pool' + ;; + + zpool:set) + _arguments -C -A "-*" -S \ + ':property:->set-pool-properties' \ + '*:pool:_zfs_pool' + ;; + + zpool:split) + if [[ $implementation = solaris ]]; then + args=( '-l[display configuration in /dev/chassis location form]' ) + else + args=( + '-g[display vdev GUIDs instead of normal device names]' + '-L[display real paths for vdevs resolving all symbolic links]' + '-l[request encryption keys for encrypted datasets]' + '-P[display full paths for vdevs instead of only the last component of the path]' + ) + fi + _arguments -C -A "-*" -S $args \ + '-R+[specify alternate root]:alternate root:_files -/' \ + '-n[display configuration without splitting]' \ + '-o+[set pool or dataset property]:property:->import-properties' \ + ':pool name or id:_zfs_pool' \ + ':new pool name' \ + '*:virtual device:->pool-devices' + ;; + + zpool:status) + if [[ $implementation = openzfs ]]; then + args=( + '-D[display a histogram of deduplication statistics]' + '-c[run scripts on each vdev]:script:_files -W "($ZPOOL_SCRIPTS_PATH /etc/zfs/zpool.d ~/.zpool.d)"' + '-i[display vdev initialization status]' + '-g[display vdev GUIDs instead of the normal device names]' + '-L[display real paths for vdevs resolving all symbolic links]' + '-p[display numbers in parsable (exact) values and times in nanoseconds]' + '-P[display full paths for vdevs instead of only the last component of the path]' + '-s[display the number of leaf VDEV slow IOs]' + '-t[display vdev TRIM status]' + ) + else + args=( '-l[display configuration in /dev/chassis location form]' ) + fi + _arguments -A "-*" -S $args\ + '-v[verbose information]' \ + '-x[show only unhealthy pools]' \ + '-T+[display a timestamp]:format:((d\:standard u\:internal))' \ + '*::pool:_zfs_pool' \ + ':: :_guard "[0-9]#" interval' \ + ':: :_guard "[0-9]#" count' + ;; + + zpool:trim) + _arguments -C -A "-*" -S \ + '(-d --secure)'{-d,--secure}'[initiate a secure TRIM]' \ + '(-r --rate)'{-r,--rate}'[set rate at which the TRIM operation progresses]:rate (bytes per second)' \ + '(-c --cancel)'{-c,--cancel}'[cancel trimming]' \ + '(-s --suspend)'{-s,--suspend}'[suspend trimming]' \ + '(-w --wait)'{-w,--wait}'[wait until devices are done being trimmed]' \ + '1:pool:_zfs_pool' \ + '*:device:->pool-devices' + ;; + + zpool:upgrade) + _arguments -A "-*" -S \ + '(- *)-v[display ZFS versions and descriptions]' + "(-v)-V+[upgrade to given version]:version" \ + '(-v *)-a[upgrade all pools]' \ + '(-a -v)*:pool:_zfs_pool' + ;; + + zpool:wait) + _arguments -A "-*" -S \ + '-H[suppress printing of headers, tab-delimit columns]' \ + '-P[use exact (parsable) numeric output]' \ + '-t+[specify background activity]: : _values -s , activity discard free initialize replace remove resilver scrub trim' \ + '-T+[display a timestamp]:format:((d\:standard u\:internal))' \ + ':pool:_zfs_pool' \ + ':interval' + ;; + + *) + _default + ;; +esac + +while (( $#state )); do + curstate=$state + state=() + case $curstate in + virtual-devices) + local -a vdevtypes + vdevtypes=( mirror raidz{,1,2,3} spare log cache ) + if [[ $implementation = openzfs ]]; then + vdevtypes+=( draid{,1,2,3} dedup special ) + else + vdevtypes+=( meta ) + fi + # cache can't be a mirror + [[ $words[CURRENT-1] != cache ]] && alts=( + 'vdev-types:vdev type:compadd -a vdevtypes' + ) + [[ -prefix / ]] || alts+=( + 'disk-vdevs:disk vdev:_files -g "*(-%)" -W /dev' + ) + _alternative $alts 'file-vdevs:file vdev:_files -W / -P /' + ;; + + pool-devices) + local -a devices + devices=( ${${${(M)${(f)"$(_call_program devices zpool status $line[1])"}:#$'\t' *}##[[:blank:]]#}%%[[:blank:]]*} ) + if (( $#devices )); then + _description devices expl "$state_descr" + compadd "$expl[@]" -a devices + break + fi + ;& # fall-through if we found none + + disk-devices) + [[ -prefix / ]] || alts=( + 'disk-vdevs:disk vdev:_files -g "*(-%)" -W /dev' + ) + _alternative $alts 'file-vdevs:file vdev:_files -W / -P /' + ;; + + keysources) + local -a suf + + compset -S ",*" || suf=(-S ,) + if compset -P 1 "*,"; then + _alternative \ + 'zfs-keylocator-prompt:"prompt" locator:(prompt)' \ + 'zfs-keylocator-file:file locator:_files' \ + 'zfs-keylocator-pkcs11: : _message -e zfs-keylocator-pkcs11 "PKCS#11 locator"' \ + 'zfs-keylocator-https: : _message -e zfs-keylocator-https "HTTPS URL locator"' + else + _description keysource-formats expl "keysource format" + compadd $suf -q "$expl[@]" "$@" raw hex passphrase + fi + ;; + + quotas) + _alternative \ + 'sizes: :_numbers -M "m:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \ + 'properties:property:(none)' + ;; + + import-properties) args=( $ci_ds_props $rw_ds_props $ci_po_props ) ;| + create-properties) args=( $ci_ds_props ) ;| + set-properties) args=( $rw_ds_props ) ;| + newpool-properties) args=( $rw_po_props $ci_po_props ) ;| + set-pool-properties) args=( $rw_po_props ) ;| + + *-properties) + if compset -P 1 '(#m)*@'; then + if compset -P 1 '*='; then + case $MATCH in + *quota@) _alternative \ + 'sizes: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size \:B {k,M,G,T,P,E,Z}{,B}' \ + 'properties:property:(none)' + ;; + esac + else + case $MATCH in + user*@) _users -S = ;; + group*@) _groups -S = ;; + project*@) _message -e projects project ;; + esac + fi + else + _wanted values expl "$state_descr" compadd -S@ ${${(M)args:#*@}%@} + _values -C "$state_descr" ${args:#*@} + fi + ;; + esac +done + +[[ nm -ne "$compstate[nmatches]" ]] diff --git a/Completion/Unix/Command/_zip b/Completion/Unix/Command/_zip index bc9aab1a5..cfa51be36 100644 --- a/Completion/Unix/Command/_zip +++ b/Completion/Unix/Command/_zip @@ -115,7 +115,7 @@ case $service in '(-U)-UU[ignore any Unicode fields]' \ '-W[modify pattern matching so only ** matches /]' \ '-\:[allow extraction outside of extraction base directory]' \ - '-\\\^[allow control characters in extracted entries]' \ + '-^[allow control characters in extracted entries]' \ '-i[include the following names]:*-*:pattern' \ '-x[exclude the following names]:*-*:pattern' \ "(-p -f -u -l -t -z -n -o -j -C -X -q -qq -a -aa -v -L -M)1:zip file:_files -g '(#i)*.(zip|xpi|[ejw]ar)(-.)'" \ diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool deleted file mode 100644 index d9c2caa52..000000000 --- a/Completion/Unix/Command/_zpool +++ /dev/null @@ -1,311 +0,0 @@ -#compdef zpool -# Synced with the S11U1 man page - -_zpool() { - local context state line expl implementation - local -a subcmds fields ro_props rw_props versions create_properties_dataset - - _pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris - - subcmds=( - create destroy add remove list iostat status online - offline clear attach detach replace scrub import export - upgrade history get set split help - ) - - if [[ $implementation = openzfs ]] && [[ $OSTYPE != solaris* ]]; then - subcmds+=( labelclear initialize ) - fi - - versions=( - ${${${(M)"${(f)$(_call_program versions zpool upgrade -v)}":#[[:space:]]#<->*}##[[:space:]]}%%[[:space:]]*} - ) - - ro_props=( - "all[All properties]" - "allocated[Space allocated]" - "capacity[Space used (percentage)]" - "dedupratio[Deduplication ratio]" - "free[Space unallocated]" - "guid[Unique identifier]" - "health[Health status]" - "size[Total size]" - ) - - rw_props=( - "altroot[Alternate root directory]:value:" - "autoexpand[Automatic pool expansion]:value:(on off)" - "autoreplace[Automatic device replacement]:value:(on off)" - "bootfs[Default bootable dataset]:value:" - "cachefile[Pool configuration cache file location]:value:" - "dedupditto[Threshold for number of copies]:value:" - "delegation[Delegated administration]:value:(on off)" - "failmode[Failure-mode behavior]:value:(wait continue panic)" - "listshares[Show shares in 'zfs list']:value:(on off)" - "listsnaps[Show snapshots in 'zfs list']:value:(on off)" - "readonly[Controls whether the pool can be modified]:value:(on off)" - "version[Pool version]:version:($versions)" - ) - - fields=( ${ro_props%%:*} ${rw_props%%:*} ) - - create_properties_dataset=( - "aclinherit:value:(discard noallow restricted passthrough passthrough-x)" - "aclmode:value:(discard mask passthrough)" - "atime:value:(on off)" - "canmount:value:(on off noauto)" - "checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)" - "compression:value:(on off lzjb gzip gzip-{1..9} zle)" - "copies:value:(1 2 3)" - "dedup:value:(on off verify sha256 sha256,verify)" - "devices:value:(on off)" - "encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)" - "exec:value:(on off)" - "groupquota@:value:" # TODO: complete group=size|none - "keysource:value:_zfs_keysource_props" - "logbias:value:(latency throughput)" - "mlslabel:value:(none)" # TODO: list sensitivity labels - "mountpoint:path, 'legacy', or 'none':{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}" - "nbmand:value:(on off)" - "primarycache:value:(all none metadata)" - "quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}" - "readonly:value:(on off)" - "recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)" - "refquota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refquota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refquota' compadd none; fi}" - "refreservation:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refreservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refreservation' compadd none; fi}" - "reservation:value:{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == reservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'reservation' compadd none; fi}" - "rstchown:value:(on off)" - "secondarycache:value:(all none metadata)" - "setuid:value:(on off)" - "shadow:value:" # TODO: complete URI|none - "share:share properties:" - "sharenfs:value:(on off)" - "sharesmb:value:(on off)" - "snapdir:value:(hidden visible)" - "sync:value:(standard always disabled)" - "userquota@:value:" # TODO: complete user=size|none - "version:value:(1 2 3 4 current)" - "volsize:value:" # <size> - "vscan:value:(on off)" - "xattr:value:(on off)" - "zoned:value:(on off)" - ) - - if [[ $service == "zpool" ]]; then - _arguments -C \ - '-\?[show help information]' \ - '1:subcommand:compadd -a subcmds' \ - '*:: :->subcmd' && return - - service="$words[1]" - curcontext="${curcontext%:*}-$service:" - fi - - case $service in - (help) - _arguments -A "-*" \ - - set1 \ - ':command/property:($subcmds ${fields%%\[*} properties)' \ - - set2 \ - '-l[Display property information]' \ - ': :(properties)' - ;; - - (clear) - _arguments -A "-*" \ - '-F[Discard transactions to allow pool opening]' \ - '-f[Ignore fmadm acquit and fmadm repair failures]' \ - '-n[With -F, check if discarding transactions would work]' \ - ':pool name:_zfs_pool' \ - '*:virtual device:_files' - ;; - - (create) - # TODO: investigate better vdev handling - _arguments -A "-*" \ - '-B[Create EFI boot partition on whole disks]' \ - '-o[Set pool property at creation time]:property:_values -s , "property" $rw_props' \ - '-O[Set dataset property at creation time]:property:_values -s , "property" $create_properties_dataset' \ - '-f[Force use of in-use devices]' \ - '-l[Display configuration in /dev/chassis location form]' \ - '-n[Display configuration without creating pool]' \ - '-R[Use alternate root]:alternate root:_files -/' \ - '-m[Set mountpoint for root dataset]:mountpoint:' \ - ':pool name:' \ - '*:virtual device:_files' - ;; - - (destroy) - _arguments -A "-*" \ - '-f[Force active datasets to be unmounted]' \ - ':pool name:_zfs_pool' - ;; - - (add) - _arguments -A "-*" \ - '-f[Force use of in-use devices]' \ - '-l[Display configuration in /dev/chassis location form]' \ - '-n[Display configuration without modifying pool]' \ - ':pool name:_zfs_pool' \ - '*:virtual device:_files' - ;; - - (list) - _arguments \ - '-H[Scripted mode]' \ - '-T[timestamp]:value:(u d)' \ - '-o[Fields to list]:field:_values -s , "field" $fields' \ - '::pool name:_zfs_pool' - ;; - - (initialize) - _arguments -A "-*" \ - '(-c --cancel)'{-c,--cancel}'[cancel initializing on specified devices]' \ - '(-s --suspend)'{-s,--suspend}'[suspend initializing on specified devices]' \ - ':pool name:_zfs_pool' \ - '*:device:_files' - ;; - - (iostat) - _arguments -A "-*" \ - '-l[Display configuration in /dev/chassis location form]' \ - '-T[timestamp]:value:(u d)' \ - '-v[Verbose statistics]' \ - '*::pool name:_zfs_pool' \ - '::interval:' \ - '::count:' - ;; - - (labelclear) - _arguments -A "-*" \ - '-f[treat exported or foreign devices as inactive]' \ - '*:virtual device:_files' - ;; - - (status) - _arguments -A "-*" \ - '-l[Display configuration in /dev/chassis location form]' \ - '-v[Verbose information]' \ - '-x[Show only unhealthy pools]' \ - '-T[timestamp]:value:(u d)' \ - '*::pool name:_zfs_pool' - ;; - - (offline) - _arguments -A "-*" \ - '-t[Offline until next reboot]' \ - ':pool name:_zfs_pool' \ - '*:virtual device:_files' - ;; - - (online) - _arguments \ - '-e[Expand device to use all available space]' \ - ':pool name:_zfs_pool' \ - '*:virtual device:_files' - ;; - - (attach) - # TODO: first device should choose first from existing. - _arguments \ - '-f[Force attach, even if in use]' \ - ':pool name:_zfs_pool' \ - ':virtual device:_files' \ - ':virtual device:_files' - ;; - - (detach) - _arguments \ - ':pool name:_zfs_pool' \ - ':virtual device:_files' - ;; - - (replace) - _arguments -A "-*" \ - '-f[Force attach, even if in use]' \ - ':pool name:_zfs_pool' \ - ':virtual device:_files' \ - '::virtual device:_files' - ;; - - (scrub) - _arguments -A "-*" \ - '-s[Stop scrubbing]' \ - '*:pool name:_zfs_pool' - ;; - - (export) - _arguments -A "-*" \ - '-f[Forcefully unmount all datasets]' \ - '*:pool name:_zfs_pool' - ;; - - (import) - # TODO: -o should complete mount options, too - _arguments -A "-*" \ - '-D[Destroyed pools]' \ - '(-d)*-c[Use cache file]:cache file:_files' \ - '(-c -D)*-d[Search for devices or files in directory]:directory:_files -/' \ - '-F[Recovery mode: discard transactions if required]' \ - '-f[Force import]' \ - '-l[Display configuration in /dev/chassis location form]' \ - '-m[Ignore missing log devices]' \ - '-N[Import pool without mounting any filesystems]' \ - '-n[With -F; do not perform input]' \ - '-R[Alternate root]:alternate root:_files -/' \ - '-o[Set pool or dataset property]:property:_values -s , "property" $create_properties_dataset $rw_props' \ - - set1 \ - '*:pool name or id:_zfs_pool' \ - '::new pool name:' \ - - set2 \ - '-N[Do not mount any filesystems]' \ - '-a[All pools]' - ;; - - (get) - _arguments -A "-*" \ - ':property:_values -s , "property" $fields' \ - '*:pool name:_zfs_pool' - ;; - - (set) - _arguments -A "-*" \ - ':property:_values -s , "property" $rw_props' \ - '*:pool name:_zfs_pool' - ;; - - (split) - _arguments -A "-*" \ - '-R[Alternate root]:alternate root:_files -/' \ - '-l[Display configuration in /dev/chassis location form]' \ - '-n[Display configuration without splitting]' \ - '-o[Set pool or dataset property]:property:_values -s , "property" $create_properties_dataset $rw_props' \ - ':pool name or id:_zfs_pool' \ - ':new pool name:' \ - '*::virtual device:_files -/' - ;; - - (upgrade) - _arguments -A "-*" \ - - set1 \ - '-v[Display ZFS versions and descriptions]' \ - - set2 \ - "-V[Upgrade to given version]:version:($versions)" \ - '-a[Upgrade all pools]' \ - '*:pool name:_zfs_pool' - ;; - - (history) - _arguments -A "-*" \ - '-i[Display internal events]' \ - '-l[Long format]' \ - '*:pool name:_zfs_pool' - ;; - - (*) - _message "unknown zpool subcommand: $service" - ;; - esac -} - -_zpool "$@" diff --git a/Completion/Unix/Type/_bpf_filters b/Completion/Unix/Type/_bpf_filters index 54e2172c9..b744b1ab4 100644 --- a/Completion/Unix/Type/_bpf_filters +++ b/Completion/Unix/Type/_bpf_filters @@ -63,7 +63,7 @@ compquote suf # protocol or field: it is one, the other or both but not neither _regex_arguments _bpf /$'[^\0]#\0'/ \( \ - /$'(not[ \0]#|![ \0]#|(\\\\|)\\([ \0]#)'/ ':operators:operator:(not ()' \# \ + /$'(not[ \0]#|![ \0]#|(\\\\|)\\([ \0]#)'/ ':operators:operator:(not \()' \# \ \(\ \(\ \(\ diff --git a/Completion/Unix/Type/_date_formats b/Completion/Unix/Type/_date_formats index 889a95779..55af7c591 100644 --- a/Completion/Unix/Type/_date_formats +++ b/Completion/Unix/Type/_date_formats @@ -1,6 +1,6 @@ #autoload -local flag +local flag ret=1 local -aU specs local -A exclusion @@ -106,5 +106,7 @@ for flag in ${(s..)PREFIX#%}; do done _describe -t date-format-specifier 'date format specifier' specs \ - -p "${(Q)PREFIX:-%}" -S '' + -p "${(Q)PREFIX:-%}" -S '' && ret=0 [[ $1 == zsh ]] && _message -e date-format-precision 'precision for %%. (1-9)' + +return ret diff --git a/Completion/Unix/Type/_diff_options b/Completion/Unix/Type/_diff_options index 440913dff..dfa9889f2 100644 --- a/Completion/Unix/Type/_diff_options +++ b/Completion/Unix/Type/_diff_options @@ -70,9 +70,7 @@ if _pick_variant -r variant -c $cmd gnu=GNU unix -v || [[ $OSTYPE = freebsd<12-> '(-E --ignore-tab-expansion)'{-E,--ignore-tab-expansion}'[ignore changes due to tab expansion]' '(-Z --ignore-trailing-space)'{-Z,--ignore-trailing-space}'[ignore white space at line end]' "($ofwuc $oss -F --show-function-line)"{-F+,--show-function-line=}'[show the most recent line matching regex]:regex' - "($ofwy $ouc --width -W)"{--width=,-W+}'[set size of line]:number of characters per line' "($ofwy $ouc)--left-column[output only left column of common lines]" - "($ofwy $ouc)--suppress-common-lines[do not output common lines]" "($ofwg $ouc $oss)--old-group-format=[set old group format]:old group format" "($ofwg $ouc $oss)--new-group-format=[set new group format]:new group format" "($ofwl $ouc $oss)--unchanged-line-format=[set unchanged line format]:unchanged line format" @@ -80,8 +78,6 @@ if _pick_variant -r variant -c $cmd gnu=GNU unix -v || [[ $OSTYPE = freebsd<12-> '(--from-file)--to-file=[compare all operands to specified file]:to file:_files' \ '--color=-[use colors in output]::when [auto]:(never always auto)' '--palette=[specify colors to use]:color:_diff_palette' - "($of $ouc)--side-by-side[output in two columns]" - "($of $ouc)-y[output in two columns]" ) else args+=( '!--speed-large-files' ) @@ -128,6 +124,9 @@ if _pick_variant -r variant -c $cmd gnu=GNU unix -v || [[ $OSTYPE = freebsd<12-> '(-S --starting-file)'{-S+,--starting-file=}'[set first file in comparison]:start with file:_files' \ '--horizon-lines=[set number of lines to keep in prefix and suffix]:number of horizon lines' \ '(-d --minimal)'{-d,--minimal}'[try to find a smaller set of changes]' \ + "($of $ouc)"{-y,--side-by-side}'[output in two columns]' \ + "($ofwy $ouc)--suppress-common-lines[don't output common lines]" \ + "($ofwy $ouc --width -W)"{--width=,-W+}'[set size of line]:number of characters per line' \ "$@" else of='-c -e -f' diff --git a/Completion/Unix/Type/_email_addresses b/Completion/Unix/Type/_email_addresses index 8a5877a9c..d5f175a79 100644 --- a/Completion/Unix/Type/_email_addresses +++ b/Completion/Unix/Type/_email_addresses @@ -69,7 +69,7 @@ _email-ldap() { fi done compstate[insert]=menu - _wanted email-ldap expl 'matching names' \ + _wanted email-ldap expl 'matching name' \ compadd -U -i "$IPREFIX" -I "$ISUFFIX" "$@" -a - ali } diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files index 6adaa8154..f03b4a148 100644 --- a/Completion/Unix/Type/_files +++ b/Completion/Unix/Type/_files @@ -1,6 +1,7 @@ #compdef -redirect-,-default-,-default- local -a match mbegin mend +local -a subtree local ret=1 # Look for glob qualifiers. This is duplicated from _path_files because @@ -91,7 +92,10 @@ for def in "$pats[@]"; do pat="${${sdef%%:${tag}*}//\\:/:}" if [[ "$sdef" = *:${tag}:* ]]; then + # If the file-patterns spec includes a description, use it and give the + # group/description options from it precedence over passed in parameters. descr="${(Q)sdef#*:${tag}:}" + end= else if (( $opts[(I)-X] )); then descr= @@ -107,27 +111,30 @@ for def in "$pats[@]"; do while _next_label "$tag" expl "$descr"; do _comp_ignore=( $_comp_ignore $ign ) if [[ -n "$end" ]]; then - if _path_files -g "$pat" "$opts[@]" "$expl[@]"; then - ret=0 - elif [[ $PREFIX$SUFFIX != */* ]] && zstyle -a ":completion:${curcontext}:$tag" recursive-files rfiles; then - local subtree - for rfile in $rfiles; do - if [[ $PWD/ = ${~rfile} ]]; then - if [[ -z $subtree ]]; then - subtree=( **/*(/) ) - fi - for prepath in $subtree; do - oprefix=$PREFIX - PREFIX=$prepath/$PREFIX - _path_files -g "$pat" "$opts[@]" "$expl[@]" && ret=0 - PREFIX=$oprefix - done - break - fi - done - fi + expl=( "$opts[@]" "$expl[@]" ) else - _path_files "$expl[@]" -g "$pat" "$opts[@]" && ret=0 + expl+=( "$opts[@]" ) + fi + + if _path_files -g "$pat" "$expl[@]"; then + ret=0 + elif [[ $PREFIX$SUFFIX != */* ]] && \ + zstyle -a ":completion:${curcontext}:$tag" recursive-files rfiles + then + for rfile in $rfiles; do + if [[ $PWD/ = ${~rfile} ]]; then + if [[ -z $subtree ]]; then + subtree=( **/*(/) ) + fi + for prepath in $subtree; do + oprefix=$PREFIX + PREFIX=$prepath/$PREFIX + _path_files -g "$pat" "$expl[@]" && ret=0 + PREFIX=$oprefix + done + break + fi + done fi done (( ret )) || break diff --git a/Completion/Unix/Type/_find_net_interfaces b/Completion/Unix/Type/_find_net_interfaces index 3f5db6b9a..06238b11c 100644 --- a/Completion/Unix/Type/_find_net_interfaces +++ b/Completion/Unix/Type/_find_net_interfaces @@ -22,11 +22,17 @@ case $OSTYPE in darwin*|freebsd*|dragonfly*) net_intf_list=( $(ifconfig -l) ) ;; irix*) net_intf_list=( ${${${(f)"$(/usr/etc/netstat -i)"}%% *}[2,-1]} ) ;; *) - # linux's deprecated ifconfig may truncate long interface names - net_intf_list=( $(_call_program interfaces "ifconfig -a 2>/dev/null | sed -n 's/^\([^ :]*\).*/\1/p'") ) + if (( $+commands[ip] )); then + # if ip is available, we can also show altnames + net_intf_list=( $(_call_program interfaces "ip link | sed -ne 's/^[0-9]\+: \([^:@]\+\).*/\1/p;t; s/^[\ ]\+altname \(.\+\)\$/\1/p'") ) + else + # linux's deprecated ifconfig may truncate long interface names + net_intf_list=( $(_call_program interfaces "ifconfig -a 2>/dev/null | sed -n 's/^\([^ :]*\).*/\1/p'") ) + fi + if (( ${#net_intf_list} == 0 )) && [[ -d /proc/sys/net/ipv4/conf ]]; then # On linux we used to use the following as the default, without /sys/class/net/*. - # However, we now use ifconfig since it finds additional devices such + # However, we now use ip or ifconfig since it finds additional devices such # as tunnels. So only do this if that didn't work. typeset -gU net_intf_list net_intf_list=( /proc/sys/net/ipv4/conf/*~*(all|default)(N:t) /sys/class/net/*(N:t) ) diff --git a/Completion/Unix/Type/_path_commands b/Completion/Unix/Type/_path_commands index 66795ae0f..4d5a6c5af 100644 --- a/Completion/Unix/Type/_path_commands +++ b/Completion/Unix/Type/_path_commands @@ -87,18 +87,19 @@ fi # 'if' block move up to the "_command_names -" branch of _command_names? if [[ -o path_dirs ]]; then local -a path_dirs - path_dirs=(${^path}/*(/N:t)) - (( ${#path_dirs} )) && - _wanted path-dirs expl 'directory in path' compadd "$@" -a path_dirs && ret=0 if [[ $PREFIX$SUFFIX = */* ]]; then + path_dirs=( ${path:#.} ) # Find command from path, not hashed - _wanted commands expl 'external command' _path_files -W path -g '*(*)' && - ret=0 + _wanted commands expl 'external command' _path_files -W path_dirs -g '*(-*)' && ret=0 + else + path_dirs=(${^path}/*(/N:t)) + (( ${#path_dirs} )) && + _wanted path-dirs expl 'directory in path' compadd "$@" -S / -a path_dirs && ret=0 fi fi -return $ret +return ret } _path_commands "$@" diff --git a/Completion/Unix/Type/_perl_modules b/Completion/Unix/Type/_perl_modules index d27a7f7af..3e11de9ea 100644 --- a/Completion/Unix/Type/_perl_modules +++ b/Completion/Unix/Type/_perl_modules @@ -60,10 +60,11 @@ _perl_modules () { with_pod=_with_pod fi - local perl=${words[1]%doc} perl_modules - if whence $perl >/dev/null; then + local perl perl_modules + if [[ $service == (perl|perldoc) ]] && whence -- ${${(Q)words[1]}%doc} >/dev/null; then + perl=$_ perl_modules=_${${perl//[^[:alnum:]]/_}#_}_modules$with_pod - elif (( ${+commands[perl]} )); then + elif whence perl > /dev/null; then perl=perl perl_modules=_perl_modules$with_pod else @@ -81,8 +82,8 @@ _perl_modules () { else local inc libdir new_pms - if [[ ${+perl} -eq 1 ]]; then - inc=( $( $perl -e 'print "@INC"' ) ) + if [[ -n $perl ]]; then + inc=( $( _call_program perl-inc ${(q)perl}$' -e \'print "@INC"\'' ) ) else # If perl isn't there, one wonders why the user's trying to # complete Perl modules. Maybe her $path is wrong? diff --git a/Completion/Unix/Type/_pgids b/Completion/Unix/Type/_pgids new file mode 100644 index 000000000..25d0c4af0 --- /dev/null +++ b/Completion/Unix/Type/_pgids @@ -0,0 +1,5 @@ +#autoload + +local expl + +_wanted pgids expl 'process group ID' compadd "$@" - ${(un)$(_call_program pgids ps -A -o pgid=)} diff --git a/Completion/Unix/Type/_remote_files b/Completion/Unix/Type/_remote_files index 3fa5779c8..93e1b7f43 100644 --- a/Completion/Unix/Type/_remote_files +++ b/Completion/Unix/Type/_remote_files @@ -4,13 +4,16 @@ # key-based authentication with no passwords or a running ssh-agent to work. # # Usage: -# _remote_files [-/] [-g glob] [-h host] -- <cmd> [<cmd options>] +# _remote_files [-/] [-g glob] [-h host] [-W dir] -- <cmd> [<cmd options>] # # Options: # - -/: only complete directories # - -g: specify a pattern to match against files # p, = and * glob qualifiers supported # - -h: specify the remote host, default is ${IPREFIX%:} +# - -W: specify the parent directory to list files from, +# default is the home directory +# # # Commands: # - ssh: Additional options for non-interactive use are automatically added @@ -30,12 +33,12 @@ # There should be coloring based on all the different ls -F classifiers. local expl rempat remfiles remdispf remdispd args cmd suf ret=1 local -a args cmd_args -local glob host +local glob host dir dirprefix if zstyle -T ":completion:${curcontext}:files" remote-access; then # Parse options to _remote_files. Stops at the first "--". - zparseopts -D -E -a args / g:=glob h:=host + zparseopts -D -E -a args / g:=glob h:=host W:=dir (( $#host)) && shift host || host="${IPREFIX%:}" args=( ${argv[1,(i)--]} ) @@ -53,9 +56,13 @@ if zstyle -T ":completion:${curcontext}:files" remote-access; then cmd_args=( "$@" ) fi + if (( $#dir )); then + dirprefix=${dir}/ + fi + if [[ -z $QIPREFIX ]] - then rempat="${PREFIX%%[^./][^/]#}\*" - else rempat="${(q)PREFIX%%[^./][^/]#}\*" + then rempat="${dirprefix}${PREFIX%%[^./][^/]#}\*" + else rempat="${dirprefix}${(q)PREFIX%%[^./][^/]#}\*" fi # remote filenames @@ -78,12 +85,15 @@ if zstyle -T ":completion:${curcontext}:files" remote-access; then remdispf=( ${(M)remdispf:#${~glob[2]}} ) fi + local -a autoremove + [[ -o autoremoveslash ]] && autoremove=(-r "/ \t\n\-") + _tags remote-files while _tags; do while _next_label remote-files expl ${suf:-remote directory}; do [[ -n $suf ]] && compadd "$args[@]" "$expl[@]" -d remdispf -- ${(q)remdispf%[*=|]} && ret=0 - compadd ${suf:+-S/} -r "/ \t\n\-" "$args[@]" "$expl[@]" -d remdispd \ + compadd ${suf:+-S/} $autoremove "$args[@]" "$expl[@]" -d remdispd \ -- ${(q)remdispd%/} && ret=0 done (( ret )) || return 0 diff --git a/Completion/Unix/Type/_ssh_hosts b/Completion/Unix/Type/_ssh_hosts index e20142cfd..a4a08ad91 100644 --- a/Completion/Unix/Type/_ssh_hosts +++ b/Completion/Unix/Type/_ssh_hosts @@ -19,11 +19,24 @@ fi if [[ -r $config ]]; then local key line host local -a lines=("${(@f)$(<"$config")}") 2>/dev/null - while (($#lines)); do - IFS=$'=\t ' read -r key line <<<"${lines[1]}" + local -a match_args + local idx=1 + while (( idx <= $#lines )); do + IFS=$'=\t ' read -r key line <<<"${lines[idx]}" + if [[ "$key" == ((#i)match) ]]; then + match_args=(${(z)line}) + while [[ $#match_args -ge 2 ]]; do + if [[ "${match_args[1]}" == (#i)(canonical|final|(|original)host) ]]; then + key="Host" + line="${match_args[2]//,/ }" + break + fi + shift 2 match_args + done + fi case "$key" in ((#i)include) - lines[1]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;; + lines[idx]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;; ((#i)host(|name)) for host in ${(z)line}; do case $host in @@ -31,7 +44,7 @@ if [[ -r $config ]]; then (*) config_hosts+=("$host") ;; esac done ;& - (*) shift lines;; + (*) (( ++idx ));; esac done if (( ${#config_hosts} )); then diff --git a/Completion/Unix/Type/_tar_archive b/Completion/Unix/Type/_tar_archive index e8ddb1e59..bc49c4a3a 100644 --- a/Completion/Unix/Type/_tar_archive +++ b/Completion/Unix/Type/_tar_archive @@ -20,8 +20,10 @@ if [[ "$1" = *[urtx]* ]]; then _files "$expl[@]" -g '*.(tar|TAR).bz2(-.)' elif [[ "$1" = *J* ]]; then _files "$expl[@]" -g '*.(tar|TAR).(lzma|xz)(-.)' - elif [[ "$_cmd_variant[$service]" == (gnu|libarchive) ]]; then - _files "$expl[@]" -g '*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|)|(tbz|tgz|txz))(-.)' + elif [[ "$_cmd_variant[$service]" == gnu ]]; then + _files "$expl[@]" -g '*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|.zst|lzo|)|(tbz|tgz|txz|tzst|taz|taZ|tz2|tbz2|tlz))(-.)' + elif [[ "$_cmd_variant[$service]" == libarchive ]]; then + _files "$expl[@]" -g '*.((tar|TAR|cpio)(.gz|.GZ|.Z|.bz2|.lzma|.xz|.zst|lzo|)|(tbz|tgz|txz|tzst|tzo|taz|tbz2|tz2|tlz|tZ|7z|ar|iso|deb|cab|lha|mtree|rar|warc|xar|zip))(-.)' else _files "$expl[@]" -g '*.(tar|TAR)(-.)' fi diff --git a/Completion/Unix/Type/_time_zone b/Completion/Unix/Type/_time_zone index cd924bbc7..c437252a8 100644 --- a/Completion/Unix/Type/_time_zone +++ b/Completion/Unix/Type/_time_zone @@ -6,4 +6,4 @@ if (( ! $+_zoneinfo_dirs )); then _zoneinfo_dirs=( /usr/{share,lib,share/lib}/{zoneinfo*,locale/TZ}(/) ) fi -_wanted time-zones expl 'time zone' _files -W _zoneinfo_dirs "$@" - +_wanted time-zones expl 'time zone' _files -g '[A-Z]*' -W _zoneinfo_dirs "$@" - diff --git a/Completion/Unix/Type/_urls b/Completion/Unix/Type/_urls index 5d4990442..f9cdd58cd 100644 --- a/Completion/Unix/Type/_urls +++ b/Completion/Unix/Type/_urls @@ -103,7 +103,7 @@ case "$scheme" in bookmark) if [[ -f "$urls/$scheme/${(Q)PREFIX}${(Q)SUFFIX}" && -s "$urls/$scheme/${(Q)PREFIX}${(Q)SUFFIX}" ]]; then - _wanted -C bookmark bookmarks expl bookmarks \ + _wanted -C bookmark bookmarks expl bookmark \ compadd "$@" -U - \ "$ipre$(<"$urls/$scheme/${(Q)PREFIX}${(Q)SUFFIX}")" && ret=0 else diff --git a/Completion/Unix/Type/_zfs_dataset b/Completion/Unix/Type/_zfs_dataset index 6bef04e45..7edcfd5d7 100644 --- a/Completion/Unix/Type/_zfs_dataset +++ b/Completion/Unix/Type/_zfs_dataset @@ -11,10 +11,12 @@ local expl_type # -t takes arguments (what kinds of datasets) and can appear multiple times zparseopts -D -E e:=expl_type_arr p=paths_allowed r1=rsrc r2=rdst t+:=type -[[ -n $type[(r)fs] ]] && typearg=( filesystem ) -[[ -n $type[(r)vol] ]] && typearg=( $typearg volume ) -[[ -n $type[(r)snap] ]] && typearg=( $typearg snapshot ) -[[ -n $type[(r)share] ]] && typearg=( $typearg share ) +[[ -n $type[(r)fs] ]] && typearg=( filesystem ) +[[ -n $type[(r)vol] ]] && typearg+=( volume ) +[[ -n $type[(r)snap] ]] && typearg+=( snapshot ) +[[ -n $type[(r)share] && $implementation = solaris ]] && typearg+=( share ) +[[ -n $type[(r)bookmark] && $implementation = openzfs ]] && + typearg+=( bookmark ) if [[ -n $typearg ]]; then typearg=( -t ${(j:,:)typearg} ) # We know we're in zfs list if paths_allowed is non-empty. @@ -58,14 +60,14 @@ if [[ ${#rdst} -gt 0 ]]; then fi if [[ -n $type[(r)clone] ]]; then - datasetlist=( ${="$(zfs list -H -o name,origin -t filesystem 2>/dev/null | awk "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} ) + datasetlist=( ${(f)"$(zfs list -H -o name,origin -t filesystem 2>/dev/null | awk -F$'\t' "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} ) else - datasetlist=( ${="$(zfs list -H -o name $typearg 2>/dev/null)":#no datasets available} ) + datasetlist=( ${(f)"$(zfs list -H -o name $typearg 2>/dev/null)":#no datasets available} ) fi expl_type=${typearg[2,-1]//,/\/} if [[ -n $type[(r)mtpt] ]]; then - mlist=( ${="$(zfs list -H -o mountpoint $typearg 2>/dev/null)":#no mountpoints available} ) + mlist=( ${(f)"$(zfs list -H -o mountpoint $typearg 2>/dev/null)":#no mountpoints available} ) datasetlist=( $datasetlist $mlist ) expl_type="$expl_type/mountpoint" fi @@ -74,4 +76,5 @@ if [[ -n $expl_type_arr[2] ]]; then expl_type=$expl_type_arr[2] fi -_wanted dataset expl "$expl_type" _multi_parts "$@" -q / datasetlist +_description datasets expl "$expl_type" +_multi_parts "$@" "$expl[@]" -q / datasetlist diff --git a/Completion/Unix/Type/_zfs_keysource_props b/Completion/Unix/Type/_zfs_keysource_props deleted file mode 100644 index 01f63257a..000000000 --- a/Completion/Unix/Type/_zfs_keysource_props +++ /dev/null @@ -1,15 +0,0 @@ -#autoload - -local -a suf -local expl - -compset -S ",*" || suf=(-S ,) -if compset -P 1 "*,"; then - _alternative "zfs-keylocator-prompt:\"prompt\" locator:(prompt)" \ - "zfs-keylocator-file:file locator:_path_files" \ - "zfs-keylocator-pkcs11:PKCS#11 locator: " \ - "zfs-keylocator-https:HTTPS URL locator: " -else - _description format expl "keysource format" - compadd $suf -q "$expl[@]" "$@" raw hex passphrase -fi |