diff options
Diffstat (limited to 'Completion/Unix/Command')
128 files changed, 3756 insertions, 3743 deletions
diff --git a/Completion/Unix/Command/_7zip b/Completion/Unix/Command/_7zip new file mode 100644 index 000000000..6867d353c --- /dev/null +++ b/Completion/Unix/Command/_7zip @@ -0,0 +1,209 @@ +#compdef 7z 7za 7zr 7zz + +# this covers both the official 7-zip and the now deprecated p7zip (but not the +# p7zip command, which is a gzip-like wrapper) +# +# notes: +# - seemingly all 7zip commands, options, and option arguments are +# case-insensitive. we only partially support this +# - most options only work with certain commands. the html documentation lists +# which ones, but it was so consistently wrong or contradictory that i gave up +# on trying to separate them. do not blindly trust the documentation on this + +local ret=1 +local -a context line state state_descr args +local -A opt_args + +args=( + '*-ai-[specify archives to include]: :->file-refs' + "(2)-an[don't take archive name on command line (with -ai)]" + '-ao-[specify overwrite mode]:overwrite mode:(( + a\:"overwrite existing files without prompt" + s\:"skip extracting files that already exist" + t\:"auto-rename existing files" + u\:"auto-rename extracting files" + ))' + '*-ax-[specify archives to exclude]: :->file-refs' + '-bb-[specify output log level]::log level:(( + 0\:"disable log" + 1\:"show names of processed files" + 2\:"show names of additional files processed internally" + 3\:"show information about additional operations" + ))' + '-bd[disable progress indicator]' + '*-bs-[specify output stream]: :->output-streams' + '-bt[show execution time statistics]' + '*-i-[specify files to include]: :->file-refs' + '*-m-[specify compression method parameter]:method parameter' # @todo complete these + '-o-[specify output directory]:output directory:_files -/' + '-p-[specify password]:password' + "-r-[recurse into subdirectories (or specify)]::recursion method:(( + -\:\"don't recurse into subdirectories\" + 0\:'recurse into subdirectories only for wildcard names' + ))" + '-sa-[specify archive naming mode]:archive naming mode:(( + a\:"always add archive type extension" + e\:"use file name exactly as given" + s\:"add archive type extension only if file name has no extension" + ))' + '-scc-[specify charset for console input/output]: :->charsets-io' + '-scrc-[specify hash function]: :->hash-functions' + '-scs-[specify charset for list files]: :->charsets-listfile' + '-sdel[delete files after adding to archive]' + '-seml-[send archive by e-mail (specify behaviour)]::e-mail behaviour:(( + .\:"delete archive after attaching to e-mail" + ))' + '-sfx-[create SFX archive]:: :->sfx-modules' + '-si-[compress data from stdin (specify file name)]::file name in archive:_files' + '-slt[show technical information]' + '-snc[extract as alternate stream if : in file name]' + '-snh[store hard links as links (tar and WIM only)]' + '-sni[store NTFS security information (WIM only)]' + '-snl[store symbolic links as links (tar and WIM only)]' + "-sns-[store NTFS alternate streams (or specify) (WIM only)]::alternate-streams behaviour:(( + -\:\"don't store NTFS alternate streams\" + ))" + "-snt-[replace trailing dots and spaces in file names (or specify)]::trailing-character behaviour:(( + -\:\"don't replace trailing dots and spaces in file names\" + ))" + '-so[write data to stdout]' + '-spd[disable wildcard matching for file names]' + '-spe[eliminate duplication of root folder]' + '-spf-[use fully qualified (absolute) file paths (or specify)]::absolute-file-path behaviour::(( + 2\:"use full path without leading slash or drive letter" + ))' + '-ssc-[enable case-sensitive mode (or specify)]::case-sensitive mode:(( + -\:"disable case-sensitive mode" + ))' + '-sse[stop archive creation if unable to open input file]' + "-ssp[don't change access time of source files]" + '-ssw[compress files open for writing by other programs]' + '-stl[set archive time stamp from most recently modified file]' + '-stm-[specify CPU thread affinity mask]:affinity mask (hexadecimal)' + '-stx-[exclude specified archive type]: :->archive-types' + '-t-[specify archive type]: :->archive-types' + '-u-[specify update options]:update options' # @todo complete these + '-v-[create volume of specified size]: :_numbers -u bytes "volume size" b k m g' + '-w-[use temporary work directory (or specify)]::work directory:_files -/' + '*-x-[specify files to exclude]: :->file-refs' + '-y[assume yes to all queries]' + '1:command:(( + a\:"add files to archive" + b\:"benchmark" + d\:"delete files from archive" + e\:"extract files from archive (without full paths)" + h\:"calculate hash values for files" + i\:"show information about supported formats" + l\:"list contents of archive" + rn\:"rename files in archive" + t\:"test integrity of archive" + u\:"update files in archive" + x\:"extract files (with full paths)" + ))' + '(-an)2:archive file:_files' + '*: :_files' # @todo complete more specifically, handle list files +) + +_arguments -S : $args && ret=0 + +case $state in + archive-types) + local -a formats=( "${(@f)"$( _call_program 7z-info $words[1] i )"}" ) + formats=( "${(@)formats[(r)*Formats:*,-1]}" ) + formats=( ${formats[2,(r)]} ) + + # 'C' appears in fourth column if compression is supported + [[ ${(L)words[(rn:2:)^-*]} == (a|d|rn|u) ]] && + formats=( ${(M)formats:#???C*} ) + + # new (?) format + if [[ -n ${(M)formats:#*....*} ]]; then + formats=( ${formats/#?(#c28)/} ) + # old/p7zip format + else + formats=( ${formats/#?(#c17)/} ) + fi + formats=( ${formats%%[[:space:]]*} ) + + (( $#formats )) || formats=( 7z bzip2 gzip tar xz zip ) + formats=( ${formats//:/\\:} ) + + # @todo also complete the various -t* and -t# modes + _describe \ + -t formats \ + 'archive type' \ + formats \ + -M 'm:{a-z}={A-Z}' \ + && ret=0 + ;; + + charsets-io) + _describe \ + -t charsets \ + 'character set' \ + '( UTF-8 WIN DOS )' \ + -M 'm:{a-z}={A-Z}' \ + && ret=0 + ;; + + charsets-listfile) + _describe \ + -t charsets \ + 'character set (or Windows code-page number)' \ + '( UTF-8 UTF-16LE UTF-16BE WIN DOS )' \ + -M 'm:{a-z}={A-Z}' \ + && ret=0 + ;; + + file-refs) + # @todo complete this properly + if compset -P 1 '*[@!]'; then + _files && ret=0 + else + _describe -t file-refs 'file-ref type' '( + "@:list file" + "!:file name or wildcard" + )' && ret=0 + fi + ;; + + hash-functions) + local -a hashers=( "${(@f)"$( _call_program 7z-info $words[1] i )"}" ) + hashers=( "${(@)hashers[(r)*Hashers:*,-1]}" ) + hashers=( ${hashers[2,(r)]} ) + hashers=( ${hashers##*[[:space:]]} ) + (( $#hashers )) || hashers=( CRC32 CRC64 SHA1 SHA256 BLAKE2sp ) + hashers+=( \* ) + hashers=( ${hashers//:/\\:} ) + _describe -t hashers 'hash function' hashers -M 'm:{a-z}={A-Z}' && ret=0 + ;; + + output-streams) + if compset -P '?'; then + _describe -t stream-dests 'output stream destination' '( + 0:disabled + 1:stdout + 2:stderr + )' && ret=0 + else + _describe -t stream-types 'output stream type' '( + "e:error messages" + "o:standard output messages" + "p:progress information" + )' && ret=0 + fi + ;; + + sfx-modules) + # sfx modules should be in the same directory as the 7zip executable. on + # some systems they live in some lib directory so we look there too + local -aU sfxes=( + ${${(Q)words[1]}:c:h}/*.sfx(#q.N:t) + ${${(Q)words[1]}:c:P:h}/*.sfx(#q.N:t) + {,/opt,/usr}{,/local}/lib/7zip/*.sfx(#q.N:t) + ) + _describe -t sfx-modules 'SFX modules' sfxes && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_aap b/Completion/Unix/Command/_aap deleted file mode 100644 index 38e50f1fc..000000000 --- a/Completion/Unix/Command/_aap +++ /dev/null @@ -1,50 +0,0 @@ -#compdef aap - -# A-A-P recipe executive version 1.076; released 2005 May 30 12:47:03 GMT - -local curcontext="$curcontext" state line ret=1 -typeset -A opt_args - -_arguments -C -s -S \ - '(- *)'{-V,--version}'[print version information and exit]' \ - '(- *)'{-h,--help}'[print help information and exit]' \ - '(-s --silent -v --verbose)'{-v,--verbose}'[print more information]' \ - '(-v --verbose -s --silent)'{-s,--silent}'[print less information]' \ - '(-d --debug)'{-d,--debug=}'[debug the specified items]:flags:' \ - '--profile=[profile A-A-P execution and write results in specified file]:output file:_files' \ - '(-n --nobuild)'{-n,--nobuild}'[print the build commands but do not execute them]' \ - '--changed=[consider specified file changed]:changed file:_files' \ - '(-t --touch)'{-t,--touch}'[update target signatures, do not build]' \ - '(-F --force)'{-F,--force}'[force rebuilding]' \ - '(-C --contents)'{-C,--contents}'[only build when file contents changed]' \ - \*{-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]' \ - '(-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]' \ - '(-j --jobs)'{-j,--jobs=}'[maximum number of parallel jobs]:number of jobs:' \ - '(-f --recipe -u --search-up --up)'{-u,--search-up,--up}'[search directory tree upwards for main.aap recipe]' \ - \*{-I,--include=}'[directory to search for included recipes]:include directory:_files -/' \ - '(-u --search-up --up -f --recipe)'{-f,--recipe=}'[recipe file to be executed]:recipe file:_files -g \*.aap\(-.\)' \ - '--install=[install specified package]:package name:' \ - '--[end of options, targets and assignments follow]' \ - '*:aap target:->target' && ret=0 - -if [[ "$state" = target ]]; then - local targets recipe - if [[ -n $opt_args[(I)(-u|--search-up|--up)] ]]; then - recipe=( (../)#main.aap(N[-1]) ) - else - recipe=${(v)opt_args[(I)(-f|--recipe)]:-main.aap} - fi - if [[ -f $recipe ]]; then - targets=( ${${(f)"$(_call_program targets $words[1] -f $recipe comment 2>/dev/null)"}/(#b)target (*):[[:blank:]]##(*)/$match[1]:${match[2]:l}} comment ) - _describe -t targets 'aap target' targets && ret=0 - else - _message -e targets 'aap target' - fi -fi - -return ret diff --git a/Completion/Unix/Command/_abcde b/Completion/Unix/Command/_abcde index 6b09d87b5..be18d7f05 100644 --- a/Completion/Unix/Command/_abcde +++ b/Completion/Unix/Command/_abcde @@ -34,7 +34,7 @@ _arguments -s -S -A "-*" \ '(- :)-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:_command_names -e' \ + '-X+[use an alternative "cue2discid" implementation]:cue2discid:_phony builtin _command_names -e' \ '-w+[add a comment to the tracks ripped from the CD]:comment' \ "-W+[concatenate CD's]:cd-number" \ '-z[debug mode]' \ diff --git a/Completion/Unix/Command/_age b/Completion/Unix/Command/_age new file mode 100644 index 000000000..487933d92 --- /dev/null +++ b/Completion/Unix/Command/_age @@ -0,0 +1,24 @@ +#compdef age age-keygen + +case $service in + age) + _arguments -S -A '-?*' \ + '(- :)'{-h,--help}'[display usage information]' \ + '!(-d --decrypt)'{-e,--encrypt} \ + '(-e --encrypt -d --decrypt -a --armor -p --passphrase -r --recipient -R --recipients-file)'{-d,--decrypt}'[decrypt the input to the output]' \ + '(-o --output)'{-o,--output=}'[write result to given file]:output file:_files' \ + '(-a --armor -d --decrypt)'{-a,--armor}'[encrypt to PEM encoded format]' \ + '(-p --passphrase -d --decrypt)'{-p,--passphrase}'[encrypt with passphrase]' \ + '(-d --decrypt)'\*{-r,--recipient=}'[encrypt to specified recipient]:recipient' \ + '(-d --decrypt)'\*{-R,--recipients-file=}'[encrypt to recipients listed in specified file]:recipients file:_files' \ + \*{-i,--identity=}'[use given identify file]:identity:_files' \ + ':input:_files' + ;; + age-keygen) + _arguments -S -A '-?*' \ + '-pq[generate post-quantum hybrid ML-KEM-768 + X25519 key pair]' \ + '(-o --output)'{-o,--output}'[write the result to the given file]:file:_files' \ + '-y[convert an identity file to a recipients file]' \ + ':input:_files' + ;; +esac diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible index ab0cdee6c..d87bf49c2 100644 --- a/Completion/Unix/Command/_ansible +++ b/Completion/Unix/Command/_ansible @@ -50,11 +50,12 @@ case $service in args+=( '(-J --ask-vault-pass --ask-vault-password)'{-J,--ask-vault-pass{,word}}'[ask for vault password]' \*{-e+,--extra-vars=}'[set additional variables]:key=value, YAML/JSON or @file:->extra-vars' + '--flush-cache[clear fact cache for every host in inventory]' '*--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' + '!*--inventory-file=:inventory file:_files' '(-l --limit --host --graph)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts' ) ;| @@ -65,8 +66,8 @@ case $service in ;| ansible-playbook|ansible-pull) args+=( - \*{-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]" + \*{-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]:tag:->tags" ) ;| ansible-playbook|ansible-console) @@ -142,7 +143,6 @@ case $service in ;; ansible-playbook) args+=( - '--flush-cache[clear the fact cache for every host in inventory]' '--force-handlers[run handlers even if a task fails]' '--list-tags[list all available tags]' '--list-tasks[list all tasks that would be executed]' @@ -207,10 +207,15 @@ case $state in else local -a inventory typeset -ga _ansible_hosts _ansible_groups + typeset -g _ansible_inventory_last_cwd + if [[ $PWD != $_ansible_inventory_last_cwd ]]; then + unset _ansible_hosts _ansible_groups + fi if (( !$#_ansible_hosts || !$#_ansible_groups )); then inventory=( ${(f)"$(_call_program groups ansible-inventory --graph)"} ) _ansible_hosts=( ${${(M)inventory%--[^:]#}#--} ) _ansible_groups=( ${${${(M)inventory%@*:}%:}#@} ) + _ansible_inventory_last_cwd=$PWD fi if [[ $state = hosts ]]; then suf=( -qS: ) diff --git a/Completion/Unix/Command/_attr b/Completion/Unix/Command/_attr index efa7c5c4f..208c46db6 100644 --- a/Completion/Unix/Command/_attr +++ b/Completion/Unix/Command/_attr @@ -2,11 +2,9 @@ case $service in attr) - local -a list - [[ $OSTYPE = irix* ]] && - list=( '(-g -s -r -V)-l[list extended attributes associated with file]' ) - _arguments -s -S "$list[@]" \ + _arguments -s -S \ '(-l -r -s -V)-g[get extended attribute for file]:attribute name' \ + '(-g -s -r -V)-l[list extended attributes associated with file]' \ '(-l -g -s -q -V)-r[remove given attribute from file]:attribute name' \ '(-l -g -r)-s[set named attribute for file]:attribute name' \ '(-r)-q[quiet output]' \ diff --git a/Completion/Unix/Command/_base64 b/Completion/Unix/Command/_base64 index bbf100acb..6309d8022 100644 --- a/Completion/Unix/Command/_base64 +++ b/Completion/Unix/Command/_base64 @@ -8,7 +8,12 @@ local variant type=base${service//[^2346]/} _pick_variant -r variant \ - gnu='(Free Soft|uutils)' fourmilab=fourmi darwin=-D unix --version + gnu='(Free Soft|uutils)' freebsd=FreeBSD netbsd='<wrap>' fourmilab=fourmi unix --version + +# as of macOS 13, Apple's base64 is based on FreeBSD's, and it reports that way, +# but it's moderately customised so that it supports roughly the same options as +# the base64 shell script they provided previously +[[ $variant == (freebsd|unix) && $OSTYPE == darwin* ]] && variant=darwin case $variant in gnu) @@ -27,17 +32,42 @@ case $variant in darwin) _arguments -s -S : \ '(: -)'{-h,--help}'[display help information]' \ + '(: -)--version[display version information]' \ + '(dec)' \ - '(enc)'{-D,--decode}"[decode input from $type]" \ + '(enc)'{-d,-D,--decode}"[decode input from $type]" \ + '(enc)' \ - '(dec)'{-b+,--break=}'[wrap encoded lines at specified number of columns]:number of columns' \ + '(dec)'{-b+,-w+,--break=,--wrap=}'[wrap encoded lines at specified number of columns]:number of columns' \ + '!(dec)--breaks=:number of columns' \ + '(out)' \ {-o+,--output=}'[specify output file]:output file:_files' \ + '(in)' \ - {-i+,--input=}'[specify input file]:input file:_files' \ + {-i+,--input=}'[specify input file]:input file:_files' + return + ;; + freebsd) + _arguments -s -S -A '-*' : \ + '(: -)--help[display help information]' \ + '(: -)--version[display version information]' \ + + dec \ + '(enc -d --decode)'{-d,--decode}"[decode input from $type]" \ + '!(enc)'{-i,--ignore-garbage} \ + + '(enc)' \ + '(dec)'{-w+,--wrap=}'[wrap encoded lines at specified number of columns]:number of columns' \ + + in \ '1:input file:_files' return ;; + netbsd) + _arguments -s -S -A '-*' : \ + + dec \ + '(enc -d -D)'{-d,-D}"[decode input from $type]" \ + '(enc)-i[ignore irrelevant characters when decoding]' \ + + '(enc)' \ + '(dec)'{-b+,-w+}'[wrap encoded lines at specified number of columns]:number of columns' \ + + in \ + '*:input file:_files' + return + ;; fourmilab) _arguments -s -S : \ '(: -)--copyright[display copyright information]' \ diff --git a/Completion/Unix/Command/_baz b/Completion/Unix/Command/_baz deleted file mode 100644 index 0acdc4639..000000000 --- a/Completion/Unix/Command/_baz +++ /dev/null @@ -1,585 +0,0 @@ -#compdef baz - -autoload -z is-at-least -local BAZ=$words[1] -local baz_version -local hide_short - -# ask the user which version of baz this is -if ! zstyle -s ":completion:${curcontext}:" baz-version baz_version; then - # ask baz instead - baz_version="${${$($BAZ --version)#baz Bazaar version }%% \(thelove@canonical.com*}" -fi - -# test whether to hide short options from completion -if zstyle -s ":completion:${curcontext}:" hide-shortopts hide_short; then - case $hide_short in - true|yes|on|1) hide_short='!' ;; - *) hide_short='' ;; - esac -fi - -# completion functions -(( $+functions[_baz_archives] )) || -_baz_archives () { _arch_archives baz "$@" } - -(( $+functions[_baz_categories] )) || -_baz_categories () { _arch_namespace baz 1 "$argv[@]" } - -(( $+functions[_baz_branches] )) || -_baz_branches () { _arch_namespace baz 2 "$argv[@]" } - -(( $+functions[_baz_versions] )) || -_baz_versions () { _arch_namespace baz 3 "$argv[@]" } - -(( $+functions[_baz_revisions] )) || -_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 "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. - # Should complete based on -A, -R, -d -} - -(( $+functions[_baz_config] )) || -_baz_config () { - local configdir root ret=1 n expl - - n=$opt_args[(i)(-d|--dir)] - [[ -n "$n" ]] && configdir=$opt_args[$n] - root="$(_call_program baz $BAZ tree-root ${configdir} 2>&1)" - if (( $? )); then - if [[ -d "configs" ]]; then - root=. - else - _message -e messages "Error: $root" - return $ret - fi - fi - - if [[ -d "$root/configs" ]]; then - configdir=("$root/configs") - _description files expl 'config file' - _files -W configdir "$expl[@]" && ret=0 - else - _message -e messages "No configs/ directory in tree whose root is $root" - fi - return $ret -} - -(( $+functions[_baz_limit] )) || -_baz_limit () { #presently only does push-mirror style limits - [[ $words[$CURRENT] == *@* ]] && return 1 - - local expl archive - archive=${words[(r)*@*]:-$($BAZ my-default-archive 2> /dev/null)} - if [ $archive ]; then - - if [[ $PREFIX != *--* ]]; then - _description -V categories expl "categories in $archive" - compadd -q -S -- "$expl[@]" `$BAZ category $archive` - else - _baz_namespace_branches 3 - fi - fi -} - -(( $+functions[_baz_tree_or_rev] )) || -_baz_tree_or_rev () { - _alternative 'trees:tree:_files -/' 'revisions:revision:_baz_revisions' -} - -(( $+functions[_baz_libraries] )) || -_baz_libraries () { - local libraries expl - libraries=($(_call_program baz $BAZ my-revision-library)) - _description -V libraries expl "revision library" - compadd "$expl[@]" -a libraries -} - -(( $+functions[_baz_my_revision_library] )) || -_baz_my_revision_library () { - if [[ -n $words[(r)-d] ]] || [[ -n $words[(r)--delete] ]]; then - _baz_libraries - else - _files -/ - fi -} - -(( $+functions[_baz_log_versions] )) || -_baz_log_versions () { - local logs expl - logs=($(_call_program baz $BAZ log-versions)) - _description -V versions expl "log version" - compadd "$expl[@]" -a logs -} - -# command argument definitions -# commands with different versions - -local cmd_register_archive cmd_archives cmd_ls_archives cmd_redo -local cmd_redo_changes cmd_what_changed cmd_categories -local cmd_branches cmd_versions cmd_cacherev cmd_logs cmd_log_versions -local cmd_log_ls cmd_update cmd_join_branch cmd_replay cmd_deltapatch -local cmd_delta_patch cmd_apply_delta cmd_sync_tree cmd_make_sync_tree -local cmd_delta cmd_revdelta cmd_library_categories cmd_library_branches -local cmd_library_versions cmd_library_revisions -local cmd_status cmd_diff - -cmd_log_ls=('*:version:_baz_log_versions') -cmd_log_versions=() -# the options should only complete items that are in the tree - -cmd_register_archive=('::archive:_baz_archives' ':location:_files -/') -cmd_archives=('::regex:') -cmd_redo=('::changeset:_files -/') -cmd_status=('::dir:_files -/') -cmd_diff=('::revision:_baz_revisions' - # ':separator:(--)' '*::limit:_files' - #don't understand the limit usage -) -cmd_categories=('::archive:_baz_archives') -cmd_branches=('::category:_baz_categories') -cmd_versions=('::branch:_baz_branches') -cmd_cacherev=('::revision:_baz_revisions') -#should only complete non-cached revisions - -cmd_logs=($cmd_log_ls) -cmd_update=('::revision:_baz_revisions') -cmd_join_branch=(':revision:_baz_revisions') -#should only complete continuation revisions - -cmd_replay=('*::revision:_baz_revisions') -cmd_deltapatch=(':FROM:_baz_tree_or_rev' ':TO:_baz_tree_or_rev') -cmd_sync_tree=(':revision:_baz_revisions') -cmd_delta=(':FROM:_baz_tree_or_rev' ':TO:_baz_tree_or_rev' '::DEST:_files -/') -cmd_library_categories=('::archive:_baz_archives --library') -cmd_library_branches=('::category:_baz_categories --library') -cmd_library_versions=('::branch:_baz_branches --library') -cmd_library_revisions=('::version:_baz_versions --library') - -cmd_ls_archives=($cmd_archives) -cmd_redo_changes=($cmd_redo) -cmd_what_changed=($cmd_changes) -cmd_delta_patch=($cmd_deltapatch) -cmd_apply_delta=($cmd_deltapatch) -cmd_make_sync_tree=($cmd_sync_tree) -cmd_revdelta=($cmd_delta) - -# commands the same in all versions - -local cmd_help -cmd_help=() - -local cmd_my_id -cmd_my_id=('::id-string:') - -local cmd_my_default_archive -cmd_my_default_archive=('::archive:_baz_archives') - -local cmd_whereis_archive -cmd_whereis_archive=(':archive:_baz_archives') - -local cmd_init_tree -cmd_init_tree=('::version:_baz_versions') - -local cmd_tree_id -cmd_tree_id=('::directory:_files -/') - -local cmd_tree_root -cmd_tree_root=('::directory:_files -/') - -local cmd_tree_version -cmd_tree_version=(':version:_baz_versions') - -local cmd_build_config cmd_buildcfg -cmd_build_config=(':config:_baz_config') -cmd_buildcfg=($cmd_build_config) - -local cmd_cat_config cmd_catcfg cmd_cfgcat -cmd_cat_config=(':config:_baz_config') -cmd_catcfg=($cmd_cat_config) -cmd_cfgcat=($cmd_cat_config) - -local cmd_undo cmd_undo_changes -cmd_undo=('::revision:_baz_revisions') -cmd_undo_changes=($cmd_undo) - -local cmd_file_diffs -cmd_file_diffs=(':file:_files' '::revision:_baz_revisions') - -local cmd_file_find -cmd_file_find=(':file:_files' '::revision:_baz_revisions') - -local cmd_inventory cmd_srcfind -cmd_inventory=('::separator:(--)' '*:directory:_files -/') -cmd_srcfind=($cmd_inventory) - -local cmd_lint -cmd_lint=('::directory:_files -/') - -local cmd_id cmd_invtag -cmd_id=('*:file:_files') -cmd_invtag=($cmd_id) - -local cmd_id_tagging_method cmd_tagging_method methods -cmd_id_tagging_method=('::tagging method:(($methods))') -methods=( - 'names:use naming conventions only' - 'implicit:use naming conventions but permit for inventory tags' - 'tagline:use naming conventions but permit for inventory tags' - 'explicit:require explicit designation of source' -) -cmd_tagging_method=($cmd_id_tagging_method) - -local cmd_add cmd_add_id cmd_add_tag -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=('*:file to delete:_files') -cmd_delete_id=($cmd_delete) -cmd_delete_tag=($cmd_delete) - -local cmd_move cmd_move_id cmd_move_tag -cmd_move_id=(':old name:_files' ':new name:_files') -cmd_move_id=($cmd_move) -cmd_move_tag=($cmd_move) -#would be nice not to offer dirs for newname if oldname is a file, and -#vice versa - -local cmd_mv -cmd_mv=('*:file:_files') -# not really right, but close enough - -local cmd_default_id cmd_explicit_default cmd_default_tag -cmd_default_id=('::TAG-PREFIX:') -cmd_explicit_default=($cmd_default_id) -cmd_default_tag=($cmd_default_id) - -local cmd_tagging_defaults cmd_id_tagging_defaults -cmd_tagging_defaults=() -cmd_id_tagging_defaults=($cmd_tagging_defaults) - -local cmd_changeset cmd_mkpatch -cmd_changeset=( - ':ORIG:_files -/' - ':MOD:_files -/' - ':DEST:_files -/' - '*:file:_files' -) -cmd_mkpatch=("$cmd_changeset[@]") - -local cmd_dopatch cmd_do_changeset cmd_apply_changeset -cmd_dopatch=(':changeset:_files -/' ':target:_files -/') -cmd_do_changeset=($cmd_dopatch) -cmd_apply_changeset=($cmd_dopatch) - -local cmd_show_changeset -cmd_show_changeset=('::changeset:_files -/') - -local cmd_make_archive -cmd_make_archive=('::name:' ':location:_files -/') - -local cmd_archive_setup -cmd_archive_setup=('*:version:_baz_branches --trailing-dashes') - -local cmd_make_category -cmd_make_category=(':category:_baz_archives -S /') - -local cmd_make_branch -cmd_make_branch=(':branch:_baz_categories --trailing-dashes') - -local cmd_make_version -cmd_make_version=(':version:_baz_branches --trailing-dashes') - -local cmd_import cmd_imprev -cmd_import=('::version:_baz_versions') -cmd_imprev=($cmd_import) - -local cmd_commit cmd_cmtrev -cmd_commit=('*:file:_files') -cmd_cmtrev=($cmd_commit) - -local cmd_get cmd_getrev -cmd_get=(':revision:_baz_revisions' '::directory:_files -/') -cmd_getrev=($cmd_get) - -local cmd_get_patch cmd_get_changeset -cmd_get_patch=(':revision:_baz_revisions' '::dir:_files -/') -cmd_get_changeset=($cmd_get_patch) - -local cmd_lock_revision -cmd_lock_revision=(':revision:_baz_revisions') - -local cmd_push_mirror cmd_archive_mirror -cmd_push_mirror=( - '::FROM or MINE:_baz_archives' - '::TO:_baz_archives' - '::LIMIT:_baz_limit' -) -cmd_archive_mirror=($cmd_push_mirror) - -local cmd_revisions -cmd_revisions=('::version:_baz_versions') - -local cmd_ancestry -cmd_ancestry=('::revision:_baz_revisions') - -local cmd_ancestry_graph -cmd_ancestry_graph=('::revision:_baz_revisions') - -local cmd_cat_archive_log -cmd_cat_archive_log=(':revision:_baz_revisions') - -local cmd_cachedrevs -cmd_cachedrevs=(':version:_baz_versions') - -local cmd_uncacherev -cmd_uncacherev=(':revision:_baz_revisions' '::dir:_files -/') - -local cmd_archive_meta_info -cmd_archive_meta_info=(':item-name:((name\:foo mirror\:bar))') - -local cmd_archive_snapshot -cmd_archive_snapshot=(':dir:_files -/' '::limit:_baz_revisions') - -local cmd_archive_version -cmd_archive_version=() - -local cmd_archive_fixup -cmd_archive_fixup=() - -local cmd_make_log -cmd_make_log=('::version:_baz_versions') - -local cmd_add_log cmd_add_log_version -cmd_add_log=(':version:_baz_versions') -cmd_add_log_version=($cmd_add_log) - -local cmd_remove_log cmd_remove_log_version -cmd_remove_log=(':version:_baz_log_versions') -cmd_remove_log_version=($cmd_remove_log) - -local cmd_abrowse -cmd_abrowse=('::LIMIT:_baz_revisions') - -local cmd_cat_log -cmd_cat_log=(':revision-spec:_baz_local_revisions') - -local cmd_changelog -cmd_changelog=('::version:_baz_versions') - -local cmd_log_for_merge -cmd_log_for_merge=('::version:_baz_versions') - -local cmd_merges -cmd_merges=(':INTO:_baz_revisions' '::FROM:_baz_revisions') - -local cmd_new_merges -cmd_new_merges=('::version:_baz_versions') - -local cmd_branch -cmd_branch=(':SOURCE-REVISION:_baz_revisions' ':TAG-VERSION:_baz_versions') - -local cmd_merge -cmd_merge=(':FROM:_baz_revisions') - -local cmd_missing cmd_whats_missing -cmd_missing=('::revision:_baz_revisions') -cmd_whats_missing=($cmd_missing) - -local cmd_pristines cmd_ls_pristines -cmd_pristines=('::limit:_baz_revisions') -cmd_ls_pristines=($cmd_pristines) - -local cmd_lock_pristine -cmd_lock_pristine=(':revision:_baz_revisions') - -local cmd_add_pristine -cmd_add_pristine=(':revision:_baz_revisions') - -local cmd_find_pristine -cmd_find_pristine=(':revision:_baz_revisions') - -local cmd_my_revision_library -cmd_my_revision_library=(':library:_baz_my_revision_library') - -local cmd_library_find -cmd_library_find=(':revision:_baz_revisions --library') - -local cmd_library_add -cmd_library_add=(':revision:_baz_revisions --exclude-library-revisions') - -local cmd_library_remove -cmd_library_remove=(':revision:_baz_revisions --library') - -local cmd_library_archives -cmd_library_archives=() - -local cmd_library_log -cmd_library_log=(':revision:_baz_revisions --library') - -local cmd_library_file -cmd_library_file=(':file:_files' ':revision:_baz_revisions --library') - -local cmd_grab -cmd_grab=(':location:_files') - -local cmd_parse_package_name -cmd_parse_package_name=(':name:') - -local cmd_valid_package_name -cmd_valid_package_name=(':name:') - -local cmd_library_config -cmd_library_config=(':library:_baz_libraries') - -local cmd_rbrowse -cmd_rbrowse=('::regular expression:') - -local cmd_rm -cmd_rm=('*:file:_files') - -local cmd_escape -cmd_escape=(':string:') - -local cmd_switch -cmd_switch=(':revision:_baz_revisions') - -#mutually exclusive options - -local -A excludes -excludes=( -# This first line means that if --output was given, don't complete -# --no-output or --keep. The converse is not true. ---output '--no-output --keep' ---no-output --output - ---silent ' --quiet --report --verbose --debug' ---quiet '--silent --report --verbose --debug' ---report '--silent --quiet --verbose --debug' ---verbose '--silent --quiet --report --debug' ---debug '--silent --quiet --report --verbose ' - ---sparse --non-sparse ---non-sparse --sparse - ---files ' --directories --both' ---directories '--files --both' ---both '--files --directories ' - ---mirror --mirror-from ---mirror-from --mirror - ---no-cached --cached-tags ---cached-tags --no-cached - ---non-greedy --greedy ---greedy --non-greedy -) - -_baz_main () { - typeset -A opt_args - local arguments - if (( CURRENT > 2 )); then - local cmd=${words[2]} - local var_cmd=cmd_${cmd//-/_} - curcontext="${curcontext%:*:*}:baz-$cmd:" - (( CURRENT-- )) - shift words - - arguments=() - local input - input=(${${(M)${(f)"$($BAZ $cmd -h)"}:# *}# }) - - local i j=1 - local short long arg desc action - short=() - long=() - arg=() - desc=() - action=() - for (( i=1 ; i <= ${#input} ; i++ )); do - [[ "$input[i]" != *[^\ ]* ]] && continue # stupid blank lines - short[j]="${${${input[i]}[1,2]}#--}" - long[j]="${${input[i]#-?, }%% *}" - - arg[j]="${${${input[i]%% *}##* }##-*}" - [[ $long[j] == --archive ]] && arg[j]=ARCHIVE # baz doesn't mention this - - desc[j]="${input[i]##* }" - if [[ "$input[i+1]" == \ *[^\ ]* ]]; then # description continues - (( i++ )) - desc[j]="$desc[j] ${input[i]##* }" - fi - [[ "$short[j]" == -[hHV] ]] && continue - desc[j]="${${desc[j]//\[/\\[}//\]/\\]}" # escape brackets - - case $arg[j] in - DIR|PATCH-DIR|DEST|OUTPUT|PATH) - action[j]='_files -/' ;; - FILES|FILE|SNAP-FILE) - action[j]='_files' ;; - MASTER|MASTER-SOURCE|ARCHIVE) - action[j]='_baz_archives' ;; - CATEGORY) - action[j]='_baz_categories' ;; - BRANCH) - action[j]='_baz_branches' ;; - VERSION) - action[j]='_baz_versions' ;; - CFG) - action[j]='_baz_configs' ;; - LIB) - action[j]='_baz_libraries' ;; -# PATCH,FILE) # not sure how to complete this -# action[j]='_baz_patch_file' ;; - *) - action[j]='' ;; - esac - - (( j++ )) - - done - - local excluded k - for (( i = 1 ; i < j ; i++ )); do - excluded=($short[i] $long[i]) - foreach opt (${=excludes[$long[i]]}) - k=$long[(i)$opt] - excluded=($excluded $short[k] $long[k]) - #excludes matching short options too :-) - end - - - # generate arguments to _arguments ;-) - # make long and short options mutually exclusive - [ $short[i] ] && arguments=("$arguments[@]" - "${hide_short}(${excluded})${short[i]}[${desc[i]}]${arg[i]:+:$arg[i]:$action[i]}") - [ $long[i] ] && arguments=("$arguments[@]" - "(${excluded})${long[i]}[${desc[i]}]${arg[i]:+:$arg[i]:$action[i]}") - done - - arguments=("$arguments[@]" "${(@P)var_cmd-*:FILE:_files}") - else - local help - local -U cmds - help=(${(f)"$($BAZ help)"}) - cmds=(${${${${(M)help:#* :*}/ #: #/:}%% ##}## #}) - arguments=(':command:(($cmds))') - fi - _arguments -S -A '-*' \ - {"${hide_short}(: -)-V",'(: -)--version'}'[display version]' \ - {"${hide_short}(: -)-h",'(: -)--help'}'[display help]' \ - '(: -)-H[display verbose help]' \ - "$arguments[@]" -} - -_baz_main "$@" diff --git a/Completion/Unix/Command/_bittorrent b/Completion/Unix/Command/_bittorrent deleted file mode 100644 index 1fbab35ef..000000000 --- a/Completion/Unix/Command/_bittorrent +++ /dev/null @@ -1,100 +0,0 @@ -#compdef btdownloadcurses btdownloadheadless btdownloadgui btlaunchmany btlaunchmanycurses bttrack btshowmetainfo btreannounce btmakemetafile btrename - -# Bittorrent completion commands. Originally written by Jussi -# Pakkanen, 2004. Most of the command descriptions are from the Debian -# project's man pages. - -# Modified by R.Ramkumar, 2006 to conform to zsh completion standards and -# enhance completion for certain options. - -case $service in - -# Start with the clients. - - btdownloadcurses) - ;& - btdownloadheadless) - ;& - btdownloadgui) - ;& - btlaunchmany) - ;& - btlaunchmanycurses) - _arguments -s -S \ - '(--responsefile)--responsefile+[specify file for server response]:file:_files'\ - "--url+[specify URL of torrent file]:URL:_urls"\ - '(-i --ip)'{-i+,--ip+}'[specify ip address to report as]:ip address'\ - "--bind+[specify ip to bind to instead of default]:ip:_bind_addresses"\ - "--minport+[specify minimum port to listen to]:port:"\ - "--maxport+[specify maximum port to listen to]:port:"\ - "--saveas+[specify file to save to]:file:_files -/"\ - "--max_uploads+[specify maximum amount of uploads]:uploads:"\ - "--max_upload_rate+[specify maximum upload rate]:rate (kb):"\ - "--keepalive_interval+[specify pause between keepalives]:time (s):"\ - "--download_slice_size+[specify bytes to query per request]:size (b):"\ - "--request_backlog+[specify number of requests to keep in a single pipe]:requests:"\ - "--max_message_length+[specify maximum length of prefix encoding]:size (b):"\ - "--timeout+[specify timeout before closing sockets on receiving nothing]:timeout (s):"\ - "--timeout_check_interval+[specify interval to check for connection time]:time interval (s):"\ - "--max_slice_length+[specify maximum size of requests accepted from peers]:size (b):"\ - "--max_rate_recalculate_interval+[specify length of pauses leading to reduced rate]:time (s):"\ - "--max_rate_period+[specify maximum time taken to guess the current rate estimate]:time (s):"\ - "--upload_rate_fudge+[specify time equivalent of writing to kernel TCP buffer]:time (s):"\ - "--display_interval+[specify time between updates to displayed information]:time (s):"\ - "--rerequest_interval+[specify time between requests for more peers]:time (s)"\ - "--min_peers+[specify peers needed before stopping or delaying requests for peers]:peers:"\ - "--http_timeout+[specify timeout for http connections]:timeout (s):"\ - "--snub_time+[specify timeout to decide that connection is semi-permanently choked]:timeout (s):"\ - "--spew+[display diagnostic info to stdout]:enable:(0 1)"\ - "--check_hashes+[check hashes on disk]:enable:(0 1)"\ - "--max_initiate+[specify peers needed before stopping initiating new connections]:peers:"\ - "--report_hash_failures+[report hash failures to user]:enable:(0 1)"\ - "--rarest_first_priority_cutoff+[specify peers which need to have a piece before other partials take priority over rarest first]:peers:"\ - ':torrent file:_files -g "*.torrent(-.)"' - return - ;; - -# Next up are the torrent file manipulation programs. - - btshowmetainfo) - _files -g "*.torrent(-.)" && return - ;; - - btrename) - _files -g '*.torrent(-.)' && return - ;; - - btmakemetafile) - _arguments -s -S \ - '--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' - return - ;; - - btreannounce) - _files -g '*.torrent(-.)' && return - ;; - -# Lastly the tracker. - - bttrack) - _arguments -s -S \ - "--port+[specify port to listen on]:port number:" \ - "--dfile+[specify file to store recent downloader info]:file:_files" \ - "--bind+[specify ip to bind to]:bind address:_bind_addresses" \ - "--socket_timeout+[specify timeout for closing connections]:timeout (s):"\ - "--save_dfile_interval+[specify interval between saving dfile]:time (s):"\ - "--timeout_downloaders_interval+[timeout for expiring downloaders]:time (s):" \ - "--reannounce_interval+[specify interval downloaders should wait between reannouncements]:time (s):" \ - "--response_size+[specify peers to send in an info message]:peers:" \ - "--timeout_check_interval+[specify connection timeout]:timeout (s):"\ - "--nat_check=[check back and ban downloaders behind NAT]:enable:(0 1)" \ - "--min_time_between_log_flushes+[specify minimum time between log flushes]:time (s):" \ - "--allowed_dir+[specify directory having downloadable torrents]:directory:_files -/" \ - "--parse_allowed_interval+[specify interval between reloading allowed_dir]:time (min):" \ - "--show_names+[display names from allowed dir]:enable:(0 1)" - return - ;; -esac diff --git a/Completion/Unix/Command/_cat b/Completion/Unix/Command/_cat index 78c35653c..d15c5f93c 100644 --- a/Completion/Unix/Command/_cat +++ b/Completion/Unix/Command/_cat @@ -1,65 +1,73 @@ #compdef cat gcat +local ign local -a args if _pick_variant gnu='(GNU|uutils)' unix --version; then + (( $#words > 2 )) && ign='!(- : *)' args=( '(-A --show-all)'{-A,--show-all}'[equivalent to -vET]' '(-b --number-nonblank -n --number)'{-b,--number-nonblank}'[number nonempty output lines, overrides -n]' '-e[equivalent to -vE]' - '(-E --show-ends)'{-E,--show-ends}'[display $ at end of each line]' + '(-E --show-ends)'{-E,--show-ends}'[display $ or ^M$ at end of each line]' '(-n --number)'{-n,--number}'[number all output lines]' '(-s --squeeze-blank)'{-s,--squeeze-blank}'[suppress repeated empty output lines]' '-t[equivalent to -vT]' '(-T --show-tabs)'{-T,--show-tabs}'[display TAB characters as ^I]' '-u[ignored]' '(-v --show-nonprinting)'{-v,--show-nonprinting}'[use ^ and M- notation, except for LFD and TAB]' - '(- : *)--help[display help and exit]' - '(- : *)--version[output version information and exit]' + "$ign--help[display help and exit]" + "$ign--version[display version information]" '*: :_files' ) - -elif [[ "$OSTYPE" == (*bsd|dragonfly|darwin)* ]]; then - args=( - -A "-*" +else + # POSIX requires just '-u' + args=( -A "-?*" '(-n)-b[number non-blank output lines]' '(-v)-e[display $ at the end of each line (implies -v)]' - '-n[number all output lines]' - '-s[squeeze multiple blank lines into one]' - '(-v)-t[display tab as ^I (implies -v)]' - '-u[do not buffer output]' '-v[display non-printing chars as ^X or M-a]' - '*: :_files' - ) - [[ $OSTYPE = (free|net)bsd* ]] && args+=( - '-l[set a lock on the stdout file descriptor]' - ) - [[ $OSTYPE = netbsd* ]] && args+=( - '-B+[read with buffer of specified size]:size (bytes)' - '-f[only attempt to display regular files]' - ) - [[ $OSTYPE = darwin* ]] && args+=( - '-l[set an exclusive advisory lock on standard output]' - ) -elif [[ $OSTYPE = solaris* ]]; then - args=( - -A "-*" - '(-b)-n[number all output lines]' - '(-n)-b[number non-blank output lines]' - "-u[don't buffer output]" - '-s[be silent about non-existent files]' - '-v[display non-printing chars as ^X or M-a]' - '-e[display $ at the end of each line (requires -v)]' - '-t[display tab as ^I and formfeeds and ^L (requires -v)]' - '*: :_files' - ) -else - # POSIX requires '-u', and most OSes may support '-n' - args=( '-n[number all output lines]' - '-u[do not buffer output]' + "-u[don't buffer output]" '*: :_files' ) + case $OSTYPE in + (*bsd|dragonfly|darwin)*) + args+=( + '-s[squeeze multiple blank lines into one]' + '(-v)-t[display tab as ^I (implies -v)]' + ) + ;| + (free|net)bsd*) + args+=( + '-l[set a lock on the stdout file descriptor]' + ) + ;| + aix*|solaris*) + args+=( + '(-q)-s[be silent about non-existent files]' + '-t[display tab as ^I and formfeeds and ^L (requires -v)]' + ) + ;| + + aix*) + args+=( + '(-s)-q[be silent about non-existent files]' + '(-r -S)'{-r,-S}'[condense consecutive blank lines to one line]' + '-Z[dump encrypted files in encrypted format]' + ) + ;; + netbsd*) + args+=( + '-B+[read with buffer of specified size]:size (bytes)' + '-f[only attempt to display regular files]' + ) + ;; + darwin*) + args+=( + '-l[set an exclusive advisory lock on standard output]' + ) + ;; + esac fi _arguments -s -S $args diff --git a/Completion/Unix/Command/_cdrecord b/Completion/Unix/Command/_cdrecord index 602cd5e8e..e429d7bfa 100644 --- a/Completion/Unix/Command/_cdrecord +++ b/Completion/Unix/Command/_cdrecord @@ -80,8 +80,8 @@ if [[ -n $state ]]; then 'mcn[set media catalog number for this CD]:text' \ 'isrc[set isrc number for the next track]:text' \ 'index[set the index list for the next track]:list' \ - 'textfile[set the file with CD-Text data]:name:_files -g "*.inf(-.)"' \ - 'cuefile[set the file with CDRWIN CUE data]:name:_files -g "*.cue(-.)"' && ret=0 + 'textfile[set the file with CD-Text data]:name:_tilde_files -g "*.inf(-.)"' \ + 'cuefile[set the file with CDRWIN CUE data]:name:_tilde_files -g "*.cue(-.)"' && ret=0 fi _requested files expl track _files && ret=0 (( ret )) || break diff --git a/Completion/Unix/Command/_chdman b/Completion/Unix/Command/_chdman new file mode 100644 index 000000000..c1fea7d42 --- /dev/null +++ b/Completion/Unix/Command/_chdman @@ -0,0 +1,195 @@ +#compdef chdman + +local ret=1 words1=$words[1] +local -a opts args context state state_descr line expl +local -a create_common_opts extract_common_opts ld_common_opts +local -a meta_common_opts input_bytes_hunks_opts +local -A opt_args + +opts=( + '(--input -i)'{--input,-i}'[specify input file]:input file:_files' + '(--inputparent -ip)'{--inputparent,-ip}'[specify parent file for input CHD]:input parent file:_files' + '(--output -o)'{--output,-o}'[specify output file]:output file:_files' + '(--outputbin -ob)'{--outputbin,-ob}'[specify output file for binary data]:output binary file:_files' + '(--splitbin -sb)'{--splitbin,-sb}'[output one binary file per track]' + '(--force -f)'{--force,-f}'[overwrite existing file]' # note same short option as --fix + '(--outputparent -op)'{--outputparent,-op}'[specify parent file for output CHD]:output parent file:_files' + '(--inputstartbyte -isb)'{--inputstartbyte,-isb}'[specify starting byte offset within input]: :\ + _numbers -u bytes "start byte" k m g' + '(--inputstarthunk -ish)'{--inputstarthunk,-ish}'[specify starting hunk offset within input]: :\ + _numbers -u hunks "start hunk" k m g' + '(--inputstartframe -isf)'{--inputstartframe,-isf}'[specify starting frame within input]: :\ + _numbers -u frames "start frame" k m g' + '(--inputbytes -ib)'{--inputbytes,-ib}'[specify effective length of input in bytes]: :\ + _numbers -u bytes "input length" k m g' + '(--inputhunks -ih)'{--inputhunks,-ih}'[specify effective length of input in hunks]: :\ + _numbers -u hunks "input length" k m g' + '(--inputframes -if)'{--inputframes,-if}'[specify effective length of input in frames]: :\ + _numbers -u frames "input length" k m g' + '(--hunksize -hs)'{--hunksize,-hs}'[specify size of each hunk in bytes]: :\ + _numbers -u bytes -l 16 -m $((1024*1024)) "hunk size" k m g' + '(--unitsize -us)'{--unitsize,-us}'[specify size of each unit in bytes]: :\ + _numbers -u bytes "unit size" k m g' + '(--compression -c)'{--compression,-c}'[specify compression codecs to use]: :->codecs' + '(--ident -id)'{--ident,-id}'[specify ident file to provide CHS information]:ident file:_files' + '(--chs -chs)'{--chs,-chs}'[specify CHS information directly]:cylinders,heads,sectors:' + '(--sectorsize -ss)'{--sectorsize,-ss}'[specfiy size of each hard disk sector]: :\ + _numbers -u bytes "sector size" k m g' + '(--tag -t)'{--tag,-t}'[specify metadata tag]:4-character metadata tag:' + '(--index -ix)'{--index,-ix}'[specify indexed instance of metadata tag]:index:' + '(--valuetext -vt)'{--valuetext,-vt}'[specify metadata value as text]:metadata value:' + '(--valuefile -vf)'{--valuefile,-vf}'[specify file containing metadata value]:metadata value file:_files' + '(--numprocessors -np)'{--numprocessors,-np}'[specify max number of processors to use during compression]: :\ + _numbers -u processors -l1 "processor limit"' + '(--nochecksum -nocs)'{--nochecksum,-nocs}'[excluded added metadata from SHA-1]' + '(--fix -f)'{--fix,-f}'[fix SHA-1 if incorrect]' # note same short option as --force + '(--verbose -v)'{--verbose,-v}'[output additional information]' + '(--size -s)'{--size,-s}'[specify size of output file]: :\ + _numbers -u bytes "output file size" k m g' + '(--template -tp)'{--template,-tp}'[specify hard disk template]: :->templates' +) +create_common_opts=( + ${(M)opts:#(|*\))--(output|outputparent|force|input|hunksize|compression|numprocessors)\[*} + ${(M)opts:#(|*\))-(o|op|f|i|hs|c|np)\[*~*-f*fix*} +) +extract_common_opts=( + ${(M)opts:#(|*\))--(output|force|input|inputparent)\[*} + ${(M)opts:#(|*\))-(o|f|i|ip)\[*~*-f*fix*} +) +ld_common_opts=( + ${(M)opts:#(|*\))--(inputstartframe|inputframes)\[*} + ${(M)opts:#(|*\))-(isf|if)\[*} +) +meta_common_opts=( + ${(M)opts:#(|*\))--(input|tag|index)\[*} + ${(M)opts:#(|*\))-(i|t|ix)\[*} +) +input_bytes_hunks_opts=( + ${(M)opts:#(|*\))--(inputstartbyte|inputstarthunk|inputbytes|inputhunks)\[*} + ${(M)opts:#(|*\))-(isb|ish|ib|ih)\[*} +) + +if (( CURRENT < 3 )); then + args=( ': :->commands' ) +else + case $words[2] in + help) args=( ': :->commands' ) ;; + info) args=( + ${(M)opts:#(|*\))--(input|verbose)\[*} + ${(M)opts:#(|*\))-(i|v)\[*} + ) ;; + verify) args=( + ${(M)opts:#(|*\))--(input|inputparent)\[*} + ${(M)opts:#(|*\))-(i|ip)\[*} + ) ;; + createraw|createdvd) args=( + $create_common_opts + $input_bytes_hunks_opts + ${(M)opts:#(|*\))--(unitsize)\[*} + ${(M)opts:#(|*\))-(us)\[*} + ) ;; + createhd) args=( + $create_common_opts + $input_bytes_hunks_opts + ${(M)opts:#(|*\))--(unitsize|chs|sectorsize|template|ident)\[*} + ${(M)opts:#(|*\))-(us|chs|ss|tp|id)\[*} + ) ;; + createcd) args=( $create_common_opts ) ;; + createld) args=( $create_common_opts $ld_common_opts ) ;; + extractraw|extractdvd|extracthd) args=( + $extract_common_opts + $input_bytes_hunks_opts + ) ;; + extractcd) args=( + $extract_common_opts + ${(M)opts:#(|*\))--(outputbin)\[*} + ${(M)opts:#(|*\))-(ob)\[*} + ) ;; + extractld) args=( $extract_common_opts $ld_common_opts ) ;; + copy) args=( + $create_common_opts + $input_bytes_hunks_opts + ${(M)opts:#(|*\))--(inputparent)\[*} + ${(M)opts:#(|*\))-(ip)\[*} + ) ;; + addmeta) args=( + $meta_common_opts + ${(M)opts:#(|*\))--(valuetext|valuefile|nochecksum)\[*} + ${(M)opts:#(|*\))-(vt|vf|nocs)\[*} + ) ;; + delmeta) args=( $meta_common_opts ) ;; + dumpmeta) args=( + $meta_common_opts + ${(M)opts:#(|*\))--(output|force)\[*} + ${(M)opts:#(|*\))-(o|f)\[*~*-f*fix*} + ) ;; + esac + shift words + (( CURRENT-- )) +fi + +_arguments : $args && ret=0 + +case $state in + commands) + _describe -t commands command '( + "help:display usage information" + "info:display CHD information" + "verify:verify CHD integrity" + "createraw:create raw CHD" + "createhd:create hard disk CHD" + "createcd:create CD CHD" + "createdvd:create DVD CHD" + "createld:create LaserDisc CHD" + "extractraw:extract raw file from CHD" + "extracthd:extract hard disk file from CHD" + "extractcd:extract CD file from CHD" + "extractdvd:extract DVD file from CHD" + "extractld:extract LaserDisc AVI from CHD" + "copy:copy data from one CHD to another" + "addmeta:add metadata to CHD" + "delmeta:remove metadata from CHD" + "dumpmeta:dump metadata from CHD" + "listtemplates:list hard disk templates" + )' && ret=0 + ;; + + codecs) + local -a codecs + + case $words[1] in # was $words[2] + *ld) codecs=( + 'avhu[A/V Huffman]' + ) ;; + *cd) codecs=( + 'cdfl[CD FLAC]' 'cdlz[CD LZMA]' 'cdzl[CD Deflate]' 'cdzs[CD Zstandard]' + ) ;; + *) codecs=( + 'flac[FLAC]' 'huff[Huffman]' 'lzma[LZMA]' 'zlib[Deflate]' 'zstd[Zstandard]' + ) ;; + esac + + _alternative \ + 'codecs-none:no codec:(( none\:uncompressed ))' \ + "codecs: :_values -s, 'compression codec' ${(j< >)${(@q+)codecs}}" \ + && ret=0 + ;; + + templates) + local -a tpls tmp=( ${(f)"$( + _call_program templates $words1 listtemplates + )"} ) + tmp=( ${(@)${(@)tmp//[[:space:]]##/ }# } ) + tmp=( ${(@M)tmp:#<-> *} ) + + for 1 in $tmp; do + tmp=( ${(z)1} ) + # id : mfg model (c,h,s) + tpls+=( "${tmp[1]}:$tmp[2] $tmp[3] (${(j<,>)${(@)tmp[4,6]}})" ) + done + + _describe -2V -t templates 'hard disk template' tpls && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown index dae0de86c..36db9c4d2 100644 --- a/Completion/Unix/Command/_chown +++ b/Completion/Unix/Command/_chown @@ -74,19 +74,13 @@ _arguments -C -s -S -0 $aopts "$args[@]" '*: :->files' && ret=0 case $state in owner) - if [[ $service = chgrp ]] || compset -P '*[:.]'; then + if [[ $service = chgrp ]] || compset -P '*:'; then if (( EGID && $+commands[groups] && ! $+_comp_priv_prefix )); then # except for sudo _wanted groups expl 'group' compadd -- $(groups) && return 0 fi _groups && ret=0 else - if compset -S '[.:]*'; then - suf=() - elif [[ $OSTYPE = irix* ]]; then - suf=( -qS '.' ) - else - suf=( -qS ':' ) - fi + compset -S ':*' || suf=( -qS: ) _users "$suf[@]" && ret=0 fi ;; @@ -102,9 +96,9 @@ case $state in if [[ $service = chgrp ]]; then grp=${line[1]} else - usr=${line[1]%%[.:]*} + usr=${line[1]%%:*} usr=${${(M)usr:#[0-9]#}:-${userdirs[$usr]:+.$usr.}} - grp=${${(M)line[1]%%[.:]*}#?} + grp=${${(M)line[1]%%:*}#?} fi [[ -n $grp ]] && grp="${${(M)grp:#[0-9]#}:-.$grp.}" req=( ${usr:+\^u$usr} ${grp:+\^g$grp} ) diff --git a/Completion/Unix/Command/_clay b/Completion/Unix/Command/_clay deleted file mode 100644 index 581338b8b..000000000 --- a/Completion/Unix/Command/_clay +++ /dev/null @@ -1,42 +0,0 @@ -#compdef clay - -# Completion for the Clay Programming Language -# http://claylabs.com/clay/ - -_arguments -C \ - "-o:specify output file:_files" \ - "-target:set target platform for code generation" \ - "-shared[create a dynamically linkable library]" \ - "-emit-llvm[emit llvm code]" \ - "-S[emit assembler code]" \ - "-c[emit object code]" \ - "-D-:set flag value" \ - "-O-:set optimization level:(0 1 2 3)" \ - "-g[keep debug symbol information]" \ - "-exceptions[enable exception handling]" \ - "-no-exceptions[disable exception handling]" \ - "-inline[inline procedures marked 'forceinline']" \ - "-no-inline[ignore 'inline' and 'forceinline' keyword]" \ - "-import-externals[include externals from imported modules]" \ - "-no-import-externals[don't include externals from imported modules]" \ - "-pic[generate position independent code]" \ - "-abort[abort on error (to get stacktrace in gdb)]" \ - "-run[execute the program without writing to disk]" \ - "-timing[show timing information]" \ - "-full-match-errors[show universal patterns in match failure errors]" \ - "-log-match:log overload matching behavior for calls" \ - "-arch:build for Darwin architecture <arch>" \ - "-F-:add <dir> to framework search path:_files -/" \ - "-framework:link with framework <name>" \ - "-L:add <dir> to library search path:_files -/" \ - "-Wl,-:pass flags to linker" \ - "-l-:link with library <lib>" \ - "-I+:add <path> to clay module search path:_files -/" \ - "-deps[keep track of the dependencies of the currently]" \ - "-no-deps[don't generate dependencies file]" \ - "-o-deps:write the dependencies to this file" \ - "-e:compile and run <source> (implies -run)" \ - "-M-:import <module>.*; for -e" \ - "-v[display version info]" \ - ":program file:_files -g '*.clay(-.)'" - diff --git a/Completion/Unix/Command/_column b/Completion/Unix/Command/_column index 687d7620f..d9f397f23 100644 --- a/Completion/Unix/Command/_column +++ b/Completion/Unix/Command/_column @@ -18,6 +18,12 @@ _pick_variant -r variant \ --version case $variant in + freebsd*) + args=( + '-l+[specify maximum number of input columns]:columns' + ) + ;| + util-linux) aopts=() args=( @@ -26,10 +32,11 @@ case $variant in + fill '(info table text json -x --fillrows)'{-x,--fillrows}'[print across before down]' + table - '(info fill -t --table)'{-t,--table}'[create a table]' + '(info fill -t --table -S --use-spaces)'{-t,--table}'[create a table]' '(info fill -o --output-separator)'{-o+,--output-separator=}'[specify column separator for table output]:separator [two spaces]' - '(info fill -s --separator)'{-s+,--separator=}'[specify column delimiters in input data]:delimiters' + '(info fill -s --input-separator --separator)'{-s+,--input-separator=,--separator=}'[specify column delimiters in input data]:delimiters' '(info fill -O --table-order)'{-O+,--table-order=}'[specify order of output columns]: :->columns' + '(info)--table-colorscheme=[specify color scheme name]:name [column]' '(info fill -N --table-columns)*'{-C+,--table-column=}'[specify column properties]: :_values -s, -S= property "name[column name]\:name" "trunc[truncate text in the columns when necessary]" @@ -48,13 +55,16 @@ case $variant in '(info fill json -d --table-noheadings)'{-d,--table-noheadings}"[don't print header]" '(info fill json -E --table-noextreme)'{-E+,--table-noextreme}"[specify columns where length can be ignored]: :->columns" '(info fill json -e --table-header-repeat)'{-e,--table-header-repeat}'[repeat header for each page]' + '(info fill json -K --table-header-as-columns)'{-K,--table-header-as-columns}'[use first row as table header]' '(info fill json -H --table-hide)'{-H+,--table-hide=}"[don't print specified columns]: :->columns" '(info fill json -R --table-right)'{-R+,--table-right=}'[right align text in these columns]: :->columns' '(info fill json -T --table-truncate)'{-T+,--table-truncate=}'[truncate text in the columns when necessary]: :->columns' '(info fill json -W --table-wrap)'{-W+,--table-wrap=}'[wrap text in the columns when necessary]: :->columns' + '(info fill json)--wrap-separator=[wrap at specified separator]:string' '(info fill json -r --tree)'{-r+,--tree=}'[specify column to format tree-like]: :->columns' '(info fill json -i --tree-id)'{-i+,--tree-id=}'[specify column containing ID for child-parent relations]: :->columns' '(info fill json -p --tree-parent)'{-p+,--tree-parent=}'[specify column containing reference to parent]: :->columns' + '(info table json -S --use-spaces)'{-S+,--use-spaces=}'[minimal whitespace between columns (no tabs)]:spaces' + json '(info fill text -n --table-name -c --output-width)'{-n+,--table-name=}'[specify table name for JSON output]:name' '(info fill text -J --json -c --output-width)'{-J,--json}'[use JSON output format for table]' diff --git a/Completion/Unix/Command/_configure b/Completion/Unix/Command/_configure index 3b22b53db..9911b78ec 100644 --- a/Completion/Unix/Command/_configure +++ b/Completion/Unix/Command/_configure @@ -1,6 +1,11 @@ #compdef configure config.status -_arguments -- -i '(--(disable|enable)-FEATURE* --(with|without)-PACKAGE*)' \ +local ret=1 +local -a expl suf + +[[ -prefix - ]] || + ! zstyle -T ":completion:${curcontext}:options" prefix-needed && + _arguments -- -i '(--(disable|enable)-FEATURE* --(with|without)-PACKAGE*)' \ -s '((#s)--disable- --enable- (#s)--enable- --disable- (#s)--with- --without- @@ -8,4 +13,19 @@ _arguments -- -i '(--(disable|enable)-FEATURE* --(with|without)-PACKAGE*)' \ '*=(E|)PREFIX*:prefix directory:_files -/' \ '*=PROGRAM*:program:_command_names -e' \ '*=NAME*executable*:program:_command_names -e' \ - '*=NAME*:file:_files' + '*=NAME*:file:_files' && ret=0 + +if [[ ! -prefix - ]]; then + if [[ "$PREFIX" = *\=* ]]; then + compstate[parameter]="${PREFIX%%\=*}" + compset -P 1 '*=' + _value && ret=0 + else + compset -S '=*' || suf=( -r = -S = ) + _wanted -x variables expl variable compadd $suf \ + CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS DEFS ERLCFLAGS FCFLAGS \ + FFLAGS GOFLAGS LDFLAGS LIBS OBJCFLAGS OBJCXXFLAGS && ret=0 + fi +fi + +return ret diff --git a/Completion/Unix/Command/_cpio b/Completion/Unix/Command/_cpio index 20f8c712d..6db4994d8 100644 --- a/Completion/Unix/Command/_cpio +++ b/Completion/Unix/Command/_cpio @@ -120,13 +120,12 @@ if [[ $state = afile ]]; then 'users:user name:_users -qS@' && ret=0 fi elif [[ $state = user ]]; then - if compset -P '*[:.]'; then + if compset -P '*:'; then _groups && ret=0 else - local suf=. - [[ $OSTYPE = (solaris|hpux)* ]] && suf=: - compset -S '.*' && unset suf - _users -S "$suf" -q && ret=0 + local suf + compset -S ':*' || suf=( -qS: ) + _users $suf && ret=0 fi fi diff --git a/Completion/Unix/Command/_cplay b/Completion/Unix/Command/_cplay deleted file mode 100644 index f1755c1a1..000000000 --- a/Completion/Unix/Command/_cplay +++ /dev/null @@ -1,8 +0,0 @@ -#compdef cplay - -_arguments -s \ - '-n[enable restricted mode]' \ - '-r[toggle playlist repeat mode]' \ - '-R[toggle playlist random mode]' \ - '-v[toggle PCM and MASTER volume control]' \ - '*:playlist or directory or audio file:_files -g "*.(mp3|mp2|ogg|669|amf|ams|dsm|far|it|med|mod|mt2|mtm|okt|s3m|stm|ult|gdm|xm|m3u|pls|spx|wav|au)(-.)"' diff --git a/Completion/Unix/Command/_csplit b/Completion/Unix/Command/_csplit index b0ba1d7f4..eb354bd83 100644 --- a/Completion/Unix/Command/_csplit +++ b/Completion/Unix/Command/_csplit @@ -17,7 +17,7 @@ specs=( if _pick_variant gnu='(GNU|uutils)' unix --version; then # GNU coreutils 8.32 specs+=( - '(hv -b --suffix-format -n --digits)'{-b+,--suffix-format=}'[specify format for numbers in output file names]:format [%%02d]: ' + '(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 @@ -44,7 +44,7 @@ case $state in 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 + _message "line_number, '/regex/[offset]', '%regex%[offset]', or '{count}'" && ret=0 fi esac diff --git a/Completion/Unix/Command/_darcs b/Completion/Unix/Command/_darcs deleted file mode 100644 index 74734711d..000000000 --- a/Completion/Unix/Command/_darcs +++ /dev/null @@ -1,38 +0,0 @@ -#compdef darcs -## Darcs completion snippet for zsh. -## -## Copyright (C) 2009 Nicolas Pouillard -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. - -local expl - -if (($CURRENT == 2)); then - # We're completing the first word after "darcs" -- the command. - _wanted command expl 'darcs command' \ - compadd -- $( darcs --commands ) -else - case "${words[$CURRENT]}"; in - # If it looks like an URL... - ht*|ft*) - _arguments '*:URL:_urls' - ;; - # If it looks like an explicit path... - /*|./*|\~*|../*) - _arguments '*:file:_files' - ;; - # Otherwise, let's ask darcs for all possible options - *) - _wanted args expl 'arg for darcs command' \ - compadd -- $( darcs ${words[2]} --list-option ) - ;; - esac -fi diff --git a/Completion/Unix/Command/_df b/Completion/Unix/Command/_df index dae833dfa..ebfe96186 100644 --- a/Completion/Unix/Command/_df +++ b/Completion/Unix/Command/_df @@ -88,7 +88,7 @@ elif [[ "$OSTYPE" == (darwin|dragonfly|freebsd|netbsd*|openbsd)* ]]; then '(-P -G -N)-f[display only the available free]' '(-G -i -P)-G[display all fields in statvfs]' '(-G -P)-N[suppress the header line normally output]' - '-W[print widge name instead of the device]' + '-W[print wedge name instead of the device]' ) ;; esac diff --git a/Completion/Unix/Command/_diffstat b/Completion/Unix/Command/_diffstat index 9e7bf779b..068ec4c1e 100644 --- a/Completion/Unix/Command/_diffstat +++ b/Completion/Unix/Command/_diffstat @@ -17,6 +17,7 @@ _arguments -s -S \ '-n+[specify minimum width for filenames]:width [auto]' \ '-N+[specify maximum width for filenames]:width [auto]' \ '-o+[redirect standard output to specified file]:output file:_files' \ + '-O[inspect only files listed in diff for -S/-D options]' \ '-p+[specify number of path separators to strip]:path components [common]' \ '-q[suppress "0 files changed" message for empty diffs]' \ '-r+[specify rounding for histogram]:rounding:((0\:none 1\:simple 2\:simple+adjustment))' \ diff --git a/Completion/Unix/Command/_dig b/Completion/Unix/Command/_dig index 440c5de90..893f187d6 100644 --- a/Completion/Unix/Command/_dig +++ b/Completion/Unix/Command/_dig @@ -17,15 +17,16 @@ local -a alts args '*+'{no,}'badcookie[retry BADCOOKIE responses]' '*+'{no,}'cdflag[set the CD (checking disabled) bit in the query]' '*+'{no,}'class[display the CLASS whening printing the record]' + '*+'{no,}'coflag[set compact denial of existence ok flag in query]' '*+'{no,}'cookie[add a COOKIE option to the request]' '*+'{no,}'crypto[display cryptographic fields in DNSSEC records]' '*+'{no,}'dns64prefix[get the DNS64 prefixes from ipv4only.arpa]' - '*+edns=-[specify EDNS version for query]:version (0-255)' + '*+edns=-[specify EDNS version for query]:version (0-255) [0]' '*+noedns[clear EDNS version to be sent]' - '*+ednsflags=-[set EDNS flags bits]:flags' + '*+ednsflags=-[set undefined EDNS flags bits]:flags' '*+'{no,}'ednsnegotiation[set EDNS version negotiation]' '*+ednsopt=-[specify EDNS option]:code point' - '*+noedns[clear EDNS options to be sent]' + '*+noednsopt[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]' @@ -45,6 +46,7 @@ local -a alts args '*+'{no,}'cmd[print initial comment in output]' '*+'{no,}'short[print terse output]' '*+'{no,}'showbadcookie[show BADCOOKIE message]' + '*+'{no,}'showbadvers[show BADVERS message]' '*+'{no,}'identify[print IP and port of responder]' '*+'{no,}'comments[print comment lines in output]' '*+'{no,}'stats[print statistics]' diff --git a/Completion/Unix/Command/_drill b/Completion/Unix/Command/_drill index 68fa7917b..6ce634874 100644 --- a/Completion/Unix/Command/_drill +++ b/Completion/Unix/Command/_drill @@ -20,7 +20,7 @@ _arguments -s -S -C \ '(-4)-6[stay on ipv6]' \ '-a[fallback to EDNS0 and TCP if the answer is truncated]' \ '-b+[specify buffer size (defaults to 512 b)]:size (bytes) [512]' \ - '-c+[use specified file for rescursive nameserver configuration]:file [/etc/resolv.conf]:_files' \ + '-c+[use specified file for recursive nameserver configuration]:file [/etc/resolv.conf]:_files' \ '-k+[specify a file that contains a trusted DNSSEC key]:file:_files' \ '*-o+[set/unset header bits]:mnemonic (uppercase sets, lower unsets):_sequence compadd - QR qr AA aa TC tc RD rd CD cd RA ra AD ad' \ '-p+[use specified remote port number]:port:_ports' \ diff --git a/Completion/Unix/Command/_du b/Completion/Unix/Command/_du index 038811eb8..be2cbdfce 100644 --- a/Completion/Unix/Command/_du +++ b/Completion/Unix/Command/_du @@ -5,7 +5,7 @@ if _pick_variant gnu='(Free Soft|uutils)' unix --version /dummy/no-such-file; th _arguments -s \ '(-a --all -s --summarize)'{-a,--all}'[write counts for all files]' \ - '--apparent-size[print apparent sizes rather than disc usage]' \ + '(-A --apparent-size)'{-A,--apparent-size}'[print apparent sizes rather than disc usage]' \ '(-B --block-size -k)'{-B+,--block-size=}'[specify block size]:size (bytes)' \ '(-B --block-size -k --apparent-size -b --bytes)'{-b,--bytes}'[equivalent to --apparent-size --block-size=1]' \ '(-c --total)'{-c,--total}'[produce a grand total]' \ @@ -56,22 +56,22 @@ else local xdev='[skip directories on different filesystems]' for pattern arg in \ '(freebsd|darwin)*' '-A[apparent size instead of usage]' \ - '(darwin*|*bsd*|dragonfly*|solaris2.<10->)' '(-H -L -P)-H[follow symlinks on the command line]' \ + '(aix*|darwin*|*bsd*|dragonfly*|solaris2.<10->)' '(-H -L -P)-H[follow symlinks on the command line]' \ '(darwin|*bsd|dragonfly)*' '(-H -L -P)-P[do not follow symlinks (default)]' \ '(darwin|dragonfly|freebsd)*' '*-I+[ignore files/directories matching specified mask]:mask' \ '(darwin|*bsd|dragonfly)*' '(-a -s -d)-d+[display entry for directories up to specified depth]:depth' \ '(darwin*|*bsd*|dragonfly*|solaris2.<10->)' '(-k -m -g -B)-h[human readable output]' \ 'netbsd*' '-i[output inode usage instead of blocks]' \ - '(darwin*|freebsd*|netbsd*|solaris2.<11->)' '(-h -k -g -B)-m[use block size of 1M-byte]' \ - '(darwin|freebsd<8->.|netbsd)*' '(-h -k -m -B)-g[use block size of 1G-byte]' \ + '(aix*|darwin*|freebsd*|netbsd*|solaris2.<11->)' '(-h -k -g -B)-m[use block size of 1M-byte]' \ + '(aix|darwin|freebsd<8->.|netbsd)*' '(-h -k -m -B)-g[use block size of 1G-byte]' \ '(freebsd|darwin)*' '(-h -k -m -g)-B+[block size]:block size (bytes)' \ '(darwin|*bsd|dragonfly)*' '-c[display grand total]' \ - '(freebsd|darwin)*' '-l[count sizes many times if hard linked]' \ + '(aix|freebsd|darwin)*' '-l[count sizes many times if hard linked]' \ '(freebsd|netbsd)*' '-n[ignore files and directories with nodump flag set]' \ 'solaris*' "(-a)-o[don't add child directories' usage to parent's total]" \ '(freebsd|darwin)*' '-t+[report only entries for which size exceeds threshold]:threshold' \ 'solaris*' "-d$xdev" \ - '(darwin|*bsd|dragonfly|solaris)*' "-x$xdev" + '(aix|darwin|*bsd|dragonfly|solaris)*' "-x$xdev" do [[ $OSTYPE = $~pattern ]] && args+=( $arg ) done diff --git a/Completion/Unix/Command/_echo b/Completion/Unix/Command/_echo new file mode 100644 index 000000000..e835847c2 --- /dev/null +++ b/Completion/Unix/Command/_echo @@ -0,0 +1,32 @@ +#compdef echo gecho + +local variant +local -a args + +_pick_variant -r variant -b zsh gnu='Free Soft' $OSTYPE --version + +args=( + # these are only interpreted as options when they're the only arg + + gnu-hv + '(-)--help[display help information]' + '(-)--version[display version information]' + + other + '(gnu-hv -E)-e[interpret escape sequences]' + "(gnu-hv -e)-E[don't interpret escape sequences]" + "(gnu-hv)-n[don't output trailing newline]" +) + +case $variant in + gnu) ;; # pass + zsh|openbsd*) + args=( ${args:#(|\(*\))--*} ) + ;; + darwin*|dragonfly*|netbsd*|freebsd*) + args=( ${args:#(|\(*\))(--|-[eE]\[)*} ) + ;; + *) + args=( ) + ;; +esac + +_arguments -s -A '' : $args '*:string:_default' diff --git a/Completion/Unix/Command/_entr b/Completion/Unix/Command/_entr index 438ab179a..ebd66ab72 100644 --- a/Completion/Unix/Command/_entr +++ b/Completion/Unix/Command/_entr @@ -11,7 +11,9 @@ _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]' \ + '*-x[format custom exit status messages using a persistent awk(1) process]' \ '-z[exit after the utility completes]' \ + '(- *)-h[display usage information]' \ '(-): :->command' \ '*::arguments:_normal' && ret=0 diff --git a/Completion/Unix/Command/_env b/Completion/Unix/Command/_env index b9094339e..6173394e0 100644 --- a/Completion/Unix/Command/_env +++ b/Completion/Unix/Command/_env @@ -69,7 +69,9 @@ if [[ -n $state ]]; then shift words (( CURRENT-- )) done - _normal -p env && ret=0 + _alternative \ + 'parameters:environment variable:_parameters -g "*export*" -qS=' \ + 'normal:: _normal -p env' && ret=0 ;; user-class) if compset -P 1 '*/'; then diff --git a/Completion/Unix/Command/_ffmpeg b/Completion/Unix/Command/_ffmpeg index e5afdac4f..33eb9c5f6 100644 --- a/Completion/Unix/Command/_ffmpeg +++ b/Completion/Unix/Command/_ffmpeg @@ -1,200 +1,1525 @@ #compdef ffmpeg -local curcontext="$curcontext" state line expl -typeset -A opt_args +# notes: +# - stream/file options modify the input/output file argument that follows, so +# ideally their arguments would be limited accordingly (e.g. -c would only +# show encoders before an output file). but it seemed like being too 'smart' +# about this could be very confusing/annoying. so we don't do that -(( $+functions[_ffmpeg_presets] )) || _ffmpeg_presets() { - local presets - presets=(~/.ffmpeg/*.ffpreset(:t:r) "$FFMPEG_DATADIR"/*.ffpreset(:t:r)) - _wanted ffmpeg-presets expl 'preset' compadd -a presets +# complete numeric argument +(( $+functions[_ffmpeg_numbers] )) || +_ffmpeg_numbers() { + # most numeric args support these suffixes, even when it's nonsensical, e.g. + # -framerate 1KiB specifies 8192 fps. and most options that only accept + # integer args nonetheless need -f here because of this + _numbers -f "$@" {K,M,G}{,i}{,B} } -(( $+functions[_ffmpeg_acodecs] )) || _ffmpeg_acodecs() { - local acodecs - acodecs=(copy ${${(M)${(f)"$(_call_program audio-codecs $words[1] -codecs 2>/dev/null)"}:#[[:space:]][D[:space:]][E[:space:]]A[S[:space:]][D[:space:]][T[:space:]][[:space:]][^[:space:]]##*}//(#b)????????([^[:space:]]##)*/$match[1]}) - _wanted ffmpeg-audio-codecs expl 'force audio codec (''copy'' to copy stream)' compadd -a acodecs +# `compadd -R` helper for _ffmpeg_flags +(( $+functions[_ffmpeg_flags_remf] )) || +_ffmpeg_flags_remf() { + [[ $1 == 0 ]] || return + # swallow last char of inserted match if it was typed again + [[ $LBUFFER[-1] == $KEYS ]] && LBUFFER=${LBUFFER%?} } -(( $+functions[_ffmpeg_vcodecs] )) || _ffmpeg_vcodecs() { - local vcodecs - vcodecs=(copy ${${(M)${(f)"$(_call_program video-codecs $words[1] -codecs 2>/dev/null)"}:#[[:space:]][D[:space:]][E[:space:]]V[S[:space:]][D[:space:]][T[:space:]][[:space:]][^[:space:]]##*}//(#b)????????([^[:space:]]##)*/$match[1]}) - _wanted ffmpeg-video-codecs expl 'force video codec (''copy'' to copy stream)' compadd -a vcodecs +# complete flag argument (flag1+flag2-flag3) +# $1 ... => flag +(( $+functions[_ffmpeg_flags] )) || +_ffmpeg_flags() { + local ret=1 tag=${curtag:-flags} + local -a expl ca_opts ca_x_opts flags + local -A opth + + zparseopts -A opth -D -F - \ + M+:=ca_opts {x+:,X+:}=ca_x_opts 1 2 F: J: n o: q r: R: s: S: V: \ + || return + + flags=( ${@:#${PREFIX//:/\\:}(|:*)} ) + + compset -S '[+-]*' + compset -P '*[+-]' + + _describe -t $tag flag flags "${(@)ca_opts}" "${(@)ca_x_opts}" -S '' && ret=0 + + [[ $IPREFIX$PREFIX == *[+-] ]] || { + compset -P '*' + _wanted operators expl operator \ + compadd "${(@)ca_opts}" -R _ffmpeg_flags_remf -S '' - + - && ret=0 + } + + return ret } -(( $+functions[_ffmpeg_scodecs] )) || _ffmpeg_scodecs() { - local scodecs - scodecs=(copy ${${(M)${(f)"$(_call_program video-codecs $words[1] -codecs 2>/dev/null)"}:#[[:space:]][D[:space:]][E[:space:]]S[S[:space:]][D[:space:]][T[:space:]][[:space:]][^[:space:]]##*}//(#b)????????([^[:space:]]##)*/$match[1]}) - _wanted ffmpeg-video-codecs expl 'force video codec (''copy'' to copy stream)' compadd -a scodecs +# helper to get stream type char from stream specifier in previous word. this +# isn't quite accurate, but probably fine for most purposes +# $1 => param to assign to +(( $+functions[_ffmpeg_prev_ss_type] )) || +_ffmpeg_prev_ss_type() { + [[ $1 == (-|--) ]] && shift + case ${9::=${(Q)words[CURRENT-1]}} in + -[adsv]codec|-[av]f) + : ${(P)1::=${(U)9[2]}} + ;; + -(c|codec):(|*:*:)[adstvV](|:*)) ;& + -filter:(|*:*:)[avV](|:*)) + 8=${(M)9##*:[adstvV](:|)} + 8=${${8%:}##*:} + : ${(P)1::=${(U)8}} + ;; + *) return 1 ;; + esac } -(( $+functions[_ffmpeg_formats] )) || _ffmpeg_formats() { - local formats - formats=(${(ou)${=${(s:,:)${${(M)${(f)"$(_call_program formats $words[1] -formats 2>/dev/null)"}:#[[:space:]][D[:space:]][E[:space:]][[:space:]][^[:space:]]##*}//(#b)????([^[:space:]]##)*/$match[1]}}}}) - _wanted ffmpeg-formats expl 'force format' compadd -a formats +# complete stream specifier, usually after a colon-option like -c: +(( $+functions[_ffmpeg_stream_specs] )) || +_ffmpeg_stream_specs() { + # does it make sense to allow e.g. -c:a:a:... ? + if compset -P '([adstvV]|g:([^i:]*|i:*)|(p|disp):*):'; then + _ffmpeg_stream_specs + elif compset -P 'g:(\#|\\\#|i:)'; then + _message 'group ID' + elif compset -P g:; then + _message 'group specifier' + elif compset -P p:; then + _message 'program ID' + elif compset -P '(\#|\\\#|i:)'; then + _message 'stream ID' + elif compset -P m:; then + _message 'metadata tag key[:value]' + elif compset -P disp:; then + _sequence -s+ _ffmpeg_dispositions -I + else + local ret=1 + local -a ca_opts + local -A opth + + zparseopts -A opth -D -F - \ + {1+,2+,F+:,M+:,n+,o+:,q+,r+:,R+:,s+:,S+:}=ca_opts J: V: x: X: \ + || return + + _describe -t stream-specifier-types 'stream-type specifier' '( + a:"audio" + d:"data" + s:"subtitle" + t:"attachment" + v:"video (all)" + V:"video (not images)" + )' -qS: "${(@)ca_opts}" && ret=0 + _describe -t stream-specifier-others 'other stream specifier' \ + '( + g:"group index or ID" + i:"stream ID" + p:"program ID" + m:"metadata tag" + disp:"dispositions" + )' -r: -S: "${(@)ca_opts}" \ + -- \ + '( + u:"usable configuration" + )' "${(@)ca_opts}" && ret=0 + + return ret + fi } -(( $+functions[_ffmpeg_pix_fmts] )) || _ffmpeg_pix_fmts() { - local pix_fmts - _wanted ffmpeg-pix-fmts expl 'pixel format' compadd "$@" - \ - ${${${(M)${(f)"$(_call_program formats $words[1] -pix_fmts 2>/dev/null)"}:#[I.][O.][H.][P.][B.] [^=[:space:]]*}#* }%% *} +# complete metadata specifier +(( $+functions[_ffmpeg_metadata_specs] )) || +_ffmpeg_metadata_specs() { + if compset -P s:; then + _ffmpeg_stream_specs + elif compset -P c:; then + _message 'chapter index' + elif compset -P p:; then + _message 'program index' + else + _describe -t metadata-specs 'metadata specifier' \ + '( + c:"per-chapter metadata" + p:"per-program metadata" + s:"per-stream metadata" + )' -r: -S: \ + -- \ + '( + g:"global metadata" + )' + fi } -(( $+functions[_ffmpeg_bsfs] )) || _ffmpeg_bsfs() { - local bsfs - bsfs=(${${(f)"$(_call_program bsfs $words[1] -bsfs 2>/dev/null)"}:#*:}) - _wanted ffmpeg-bsfs expl 'set bitstream filter' compadd -a bsfs +# complete preset name +(( $+functions[_ffmpeg_presets] )) || +_ffmpeg_presets() { + local -a presets=( + ~/.ffmpeg + $FFMPEG_DATADIR + ${${${${(Q)words[1]}:c}%/bin/*}:-/usr}/share/ffmpeg + ) + presets=( $^presets/*.ffpreset(N:t:r) ) + _wanted presets expl preset compadd "$@" -a presets } -typeset -A _ffmpeg_flags +# complete codec or encoder/decoder (-codec et al accept either) +# -D => decoders, -E => encoders, -T => type (audio, video, etc) +(( $+functions[_ffmpeg_codecs] )) || +_ffmpeg_codecs() { + local ret=1 de=DE de_desc=encoder/decoder type=ADSTV type_desc + local -a ca_opts codecs encdecs + local -A opth + + zparseopts -A opth -D -F - \ + {1+,2+,F+:,M+:,n+,o+:,q+,r+:,R+:,s+:,S+:,x+:,X+:}=ca_opts J: V: \ + D E T: \ + || return + + case ${(L)opth[-T]} in + a|aud*) type=A ;; + d|dat*) type=D ;; + s|sub*) type=S ;; + t|att*) type=T ;; + v|vid*) type=V ;; + *) _ffmpeg_prev_ss_type type ;; + esac + case $type in + A) type_desc=audio ;; + D) type_desc=data ;; + S) type_desc=subtitle ;; + T) type_desc=attachment ;; + V) type_desc=video ;; + esac + + if (( ${+opth[-D]} )); then + de=D de_desc=decoder + elif (( ${+opth[-E]} )); then + de=E de_desc=encoder + fi + + codecs=( ${(f)"$( _call_program codecs $words[1] -codecs )"} ) + codecs=( ${(M)codecs:# [ADILSTV. ](#c6) [^=]* *} ) + [[ $de == *D* ]] || codecs=( ${codecs:# D?*} ) + [[ $de == *E* ]] || codecs=( ${codecs:# ?E*} ) + codecs=( ${(M)codecs:# ??[$type]??? *} ) + codecs=( ${codecs# ?????? } ) + + # -decoders and -encoders don't include data/attachment + [[ $type == *[ASV]* ]] && { + [[ $de == *D* ]] && + encdecs+=( ${(f)"$( _call_program decoders $words[1] -decoders )"} ) + [[ $de == *E* ]] && + encdecs+=( ${(f)"$( _call_program encoders $words[1] -encoders )"} ) + + encdecs=( ${(M)encdecs:# [$type][ABDFSVX. ](#c5) [^=]* *} ) + encdecs=( ${encdecs# ?????? } ) + } + + if zstyle -t ":completion:$curcontext:$tag" verbose; then + codecs=( ${codecs%%[[:space:]]##\((decoders#|encoders#):*} ) + codecs=( ${${(@)codecs//:/\\:}/[[:space:]]##/:} ) + # _describe doesn't remove duplicates when there are descriptions + encdecs=( ${(u)encdecs} ) + encdecs=( ${${(@)encdecs//:/\\:}/[[:space:]]##/:} ) + else + codecs=( ${codecs%%[[:space:]]*} ) + encdecs=( ${encdecs%%[[:space:]]*} ) + fi -(( $+functions[_ffmpeg_flag_options] )) || _ffmpeg_flag_options() { - local expl - _wanted options expl 'flag' compadd -S '' -- {-,+}${^flag_options} + _describe -t codecs "${type_desc:+$type_desc }codec" \ + codecs "${(@)ca_opts}" && ret=0 + _describe -t encoders-decoders "${type_desc:+$type_desc }$de_desc" \ + encdecs "${(@)ca_opts}" && ret=0 + [[ $de == *E* && ${(Q)words[CURRENT-1]} == -(c|[adsv]#codec)(|:*) ]] && + _describe -t codecs-special 'copy option' '( copy:"copy stream" )' && ret=0 + + return ret } -(( $+functions[_ffmpeg_more_flag_options] )) || _ffmpeg_more_flag_options() { - compset -p $1 && _ffmpeg_flag_options +# complete format/muxer/demuxer/device +# -D => demuxer, -E => muxer, -v => device +(( $+functions[_ffmpeg_formats] )) || +_ffmpeg_formats() { + local dde=dDE tag=formats desc=format + local -a ca_opts tmp formats + local -A opth + + zparseopts -A opth -D -F - \ + {1+,2+,F+:,J+:,M+:,n+,o+:,q+,r+:,R+:,s+:,S+:,V+:,x+:,X+:}=ca_opts \ + D E v \ + || return + + if (( ${+opth[-D]} )); then + dde=D tag=demuxers desc=demuxer + elif (( ${+opth[-E]} )); then + dde=E tag=muxers desc=muxer + elif (( ${+opth[-v]} )); then + dde=d tag=devices desc=device + fi + + tmp=( ${(f)"$( _call_program formats $words[1] -formats )"} ) + tmp=( ${(M)tmp:# [dDE. ](#c3) [^=]* *} ) + [[ $dde == *D* ]] && formats+=( ${(M)tmp:# D?? *} ) + [[ $dde == *E* ]] && formats+=( ${(M)tmp:# ?E? *} ) + [[ $dde == *d* ]] && formats+=( ${(M)tmp:# ??d *} ) + formats=( ${formats# ??? } ) + + # some formats have multiple descriptions, e.g. 'matroska:Matroska' and + # 'matroska:Matroska / WebM'. ideally we would merge these together somehow + if zstyle -t ":completion:$curcontext:$tag" verbose; then + local f d + tmp=( ${${(@)formats//:/\\:}/[[:space:]]##/:} ) + formats=( ) + for f in $tmp; do + d=${f#*:} f=${f%%:*} + formats+=( ${^${(@s<,>)f}}:$d ) + done + formats=( ${(u)formats} ) + + else + formats=( ${(@s<,>)${(@)formats%%[[:space:]]*}} ) + fi + + _describe -t $tag $desc formats "${(@)ca_opts}" } -(( $+functions[_ffmpeg_new_flag_options] )) || _ffmpeg_new_flag_options() { - compset -P '*' && _ffmpeg_flag_options +# complete bitstream filter +# -I => single bsf +(( $+functions[_ffmpeg_bsfs] )) || +_ffmpeg_bsfs() { + local tag=bsfs desc='bitstream filter' + local -a ca_opts expl bsfs + local -A opth + + zparseopts -A opth -D -F - \ + {1+,2+,F+:,J+:,M+:,n+,o+:,q+,r+:,R+:,s+:,S+:,V+:,x+:,X+:}=ca_opts \ + I \ + || return + + bsfs=( ${(f)"$( _call_program $tag $words[1] -bsfs )"} ) + bsfs=( ${bsfs##[[:space:]]##} ) + bsfs=( ${bsfs:#*:} ) + + if (( ${+opth[-I]} )); then + _describe -t $tag $desc bsfs "${(@)ca_opts}" + else + _wanted $tag expl '' _values -s, -S= $desc \ + $^bsfs':bsf option (opt1=val1\:opt2=val2\:...):' + fi } -(( $+functions[_ffmpeg_flags] )) || _ffmpeg_flags() { - local -a flag_options - eval "flag_options=(\${=_ffmpeg_flags[$1]})" +# complete pixel format / hwaccel output format +# -H => hwaccel formats only +(( $+functions[_ffmpeg_pix_fmts] )) || +_ffmpeg_pix_fmts() { + local tag=pixel-formats desc='pixel format' + local -a ca_opts pixfmts + local -A opth - local match mbegin mend - integer ret=1 + zparseopts -A opth -D -F - \ + {1+,2+,F+:,J+:,M+:,n+,o+:,q+,r+:,R+:,s+:,S+:,V+:,x+:,X+:}=ca_opts \ + H \ + || return - if [[ $PREFIX = (#b)(*)[-+]([^-+]#) ]]; then - if [[ -n ${flag_options[(R)$match[2]]} ]]; then - _ffmpeg_new_flag_options && ret=0 - fi - if [[ -n ${flag_options[(R)$match[2]?*]} ]]; then - _ffmpeg_more_flag_options ${#match[1]} && ret=0 - fi - else - _ffmpeg_flag_options && ret=0 - fi + pixfmts=( ${(f)"$( _call_program $tag $words[1] -pix_fmts )"} ) + pixfmts=( ${(M)pixfmts:#[BHIOP. ](#c5) [^=]* *} ) - return ret + (( ${+opth[-H]} )) && { + tag=hwaccel-formats desc='output format' + pixfmts=( ${(M)pixfmts:#??H?? *} ) + } + + pixfmts=( ${pixfmts#????? *} ) + pixfmts=( ${pixfmts%%[[:space:]]*} ) + + (( ${+opth[-H]} )) || { + compset -P + || pixfmts+=( + ) + } + + _describe -t $tag $desc pixfmts "${(@)ca_opts}" } -(( $+functions[_ffmpeg_register_lastopt_values] )) || _ffmpeg_register_lastopt_values() { - if (( lastopt_takesargs )); then - lastopt+=":$lastopt_description:" - if (( $#lastopt_values )); then - if [[ $lastopt_type == flags ]]; then - lastopt="*$lastopt" - flagtype=${${lastopt%%:*}#-} - lastopt+="->$flagtype" - _ffmpeg_flags[$flagtype]="${lastopt_values[*]}" - else - lastopt+="(${lastopt_values[*]})" - fi - fi - fi - _ffmpeg_argspecs+=$lastopt +# complete filter +(( $+functions[_ffmpeg_filters] )) || +_ffmpeg_filters() { + local MATCH MBEGIN MEND x y z tag=filters desc=filter type=AV + local -a ca_opts tmp filters + local -A opth + + zparseopts -A opth -D -F - \ + {1+,2+,F+:,J+:,M+:,n+,o+:,q+,r+:,R+:,s+:,S+:,V+:,x+:,X+:}=ca_opts \ + T: \ + || return + + case ${(L)opth[-T]} in + a|aud*) type=A ;; + v|vid*) type=V ;; + *) _ffmpeg_prev_ss_type type ;; + esac + case $type in + A) tag=audio-$tag desc="audio $desc" ;; + V) tag=video-$tag desc="video $desc" ;; + esac + + tmp=( ${(f)"$( _call_program filters $words[1] -filters )"} ) + tmp=( ${(M)tmp:#*-\>*} ) + tmp=( ${tmp# ?? } ) + tmp=( ${tmp/[ ]##/$'\t'} ) + tmp=( ${tmp/[ ]##/$'\t'} ) + + for x y z in "${(@ps<\t>)tmp}"; do + [[ ${y//[N$type]/} == $y ]] || + filters+=( $x:${z//:/\\:} ) + done + + if zstyle -t ":completion:$curcontext:$tag" verbose; then + # undo sentence case/punctuation + filters=( ${filters%.} ) + filters=( ${filters/(#m):[A-Z][a-z]/${(L)MATCH}} ) + else + filters=( ${filters%%:*} ) + fi + + _describe -t $tag $desc filters "${(@)ca_opts}" +} + +# complete filtergraph spec +(( $+functions[_ffmpeg_filtergraphs] )) || +_ffmpeg_filtergraphs() { + # [link][link] fltr@id=val:key=val:val, fltr@id [link]; fltr=val; ... + compset -P '*[];,]' + compset -P '[[:space:]]##' + compset -S '[;,[]*' + compset -S '[[:space:]]##' + + if compset -P '*\['; then + _message 'link label' + elif compset -P '*='; then + _message 'filter arguments ([key=]val:[key=]val:...)' + elif compset -P '*@'; then + _message 'filter ID' + else + _ffmpeg_filters -r$'@=,[; \t\n\-' -S, + fi +} + +# complete protocol +(( $+functions[_ffmpeg_protocols] )) || +_ffmpeg_protocols() { + local tag=protocols desc=protocol + local -a protocols + + protocols=( ${(f)"$( _call_program $tag $words[1] -protocols )"} ) + protocols=( ${protocols:#*:*} ) + protocols=( ${protocols##[[:space:]]##} ) + + _describe -t $tag $desc protocols "$@" +} + +# complete standard or custom channel layout +(( $+functions[_ffmpeg_layouts] )) || +_ffmpeg_layouts() { + local ret=1 + local -a tmp names layouts + + tmp=( ${(f)"$( _call_program layouts $words[1] -layouts )"} ) + tmp=( ${tmp##[[:space:]]##} ) + + names=( ${tmp[1,(R)*(#i)layouts*:*]} ) + names=( ${names:#(#i)*(NAME[[:space:]]##D|(channel|layout)*:)*} ) + names=( ${^${names/[[:space:]]##/\[}}\] ) + names=( $^names':custom name' ) + + layouts=( ${tmp[(R)*(#i)layouts*:*,-1]} ) + layouts=( ${layouts:#(#i)*(NAME[[:space:]]##D|layouts*:)*} ) + layouts=( ${layouts//:/\\:} ) + layouts=( ${layouts/[[:space:]]##/:} ) + + [[ $PREFIX == *[@+]* ]] || { + _describe -t channel-layouts 'standard channel layout' layouts && ret=0 + } + _values -s+ -S@ 'channel name' $names && ret=0 + + return ret } -local -a _ffmpeg_argspecs -{ - local lastopt REPLY - local lastopt_description - local lastopt_takesargs - local lastopt_type - local -a lastopt_values +# complete sample format +(( $+functions[_ffmpeg_sample_fmts] )) || +_ffmpeg_sample_fmts() { + local tag=sample-formats desc='sample format' + local -a sample_fmts + + sample_fmts=( ${(f)"$( _call_program $tag $words[1] -sample_fmts )"} ) + sample_fmts=( ${sample_fmts:#*(:|name[[:space:]]##desc)*} ) + sample_fmts=( ${sample_fmts##[[:space:]]##} ) + sample_fmts=( ${sample_fmts%%[[:space:]]*} ) + + _describe -t $tag $desc sample_fmts "$@" +} + +# complete hardware acceleration method +# -T => types only +(( $+functions[_ffmpeg_hwaccels] )) || +_ffmpeg_hwaccels() { + local tag=hwaccels desc='hardware acceleration method' + local -a ca_opts hwaccels + local -A opth + + zparseopts -A opth -D -F - \ + {1+,2+,F+:,J+:,M+:,n+,o+:,q+,r+:,R+:,s+:,S+:,V+:,x+:,X+:}=ca_opts \ + T \ + || return + + hwaccels=( ${(f)"$( _call_program $tag $words[1] -hwaccels )"} ) + hwaccels=( ${hwaccels##[[:space:]]##} ) + hwaccels=( ${hwaccels:#*:*} ) + + (( ${+opth[-T]} )) || hwaccels+=( none auto ) + + _describe -t $tag $desc hwaccels "${(@)ca_opts}" +} + +# complete hardware devices +(( $+functions[_ffmpeg_hw_devices] )) || +_ffmpeg_hw_devices() { + local i tag=hardware-devices desc='hardware device' + local -a ca_opts devices + local -A opth + + zparseopts -A opth -D -F - \ + {1+,2+,F+:,M+:,n+,o+:,q+,r+:,R+:,s+:,S+:,x+:,X+:}=ca_opts J: V: \ + || return + + for (( i = 2; i <= CURRENT; i++ )); do + [[ ${(Q)words[i]} == -init_hw_device ]] || continue + devices+=( ${${${(Q)words[i+1]}#*=}%@*} ) + (( i++ )) + done + + # exclude name in current arg + [[ ${(Q)words[CURRENT-1]} == -init_hw_device ]] && + [[ ${i::=$IPREFIX$PREFIX} == *=* ]] && + devices=( ${devices:#${${i%%[@:,]*}#*=}} ) - _call_program options $words[1] -h 2>/dev/null | while IFS=$'\n' read -r; do - if [[ $REPLY == -* ]]; then - [[ -n $lastopt ]] && _ffmpeg_register_lastopt_values - lastopt=${REPLY%%[[:space:]]*} - lastopt_description=${REPLY##-[^[:space:]]##[[:space:]]##} - if [[ $lastopt_description == (#b)'<'(?##)'>'* ]]; then - lastopt_type=$match[1] - lastopt_description=${lastopt_description##<[^[:space:]]##>[[:space:]]##[^[:space:]]##[[:space:]]#} - if [[ -z $lastopt_description ]]; then - lastopt_description=$lastopt - fi - lastopt_description=${lastopt_description//:/\\:} - elif [[ $lastopt_description == [^[:space:]]##[[:space:]][[:space:]]* ]]; then - local example=${lastopt_description%% *} - example=${example//:/\\:} - lastopt_description=${lastopt_description##[^[:space:]]##[[:space:]]##} - lastopt_description=${lastopt_description//:/\\:} - if [[ $example == filename ]]; then - lastopt_takesargs=0 - lastopt+=":${lastopt_description}:_files" - elif [[ $lastopt == -[asv]pre ]]; then - lastopt_takesargs=0 - lastopt="*$lastopt" - lastopt+=": :_ffmpeg_presets" - elif [[ $lastopt == -acodec ]]; then - lastopt_takesargs=0 - lastopt+=": :_ffmpeg_acodecs" - elif [[ $lastopt == -vcodec ]]; then - lastopt_takesargs=0 - lastopt+=": :_ffmpeg_vcodecs" - elif [[ $lastopt == -scodec ]]; then - lastopt_takesargs=0 - lastopt+=": :_ffmpeg_scodecs" - elif [[ $lastopt == -f ]]; then - lastopt_takesargs=0 - lastopt="*$lastopt" - lastopt+=": :_ffmpeg_formats" - elif [[ $lastopt == -pix_fmt ]]; then - lastopt_takesargs=0 - lastopt="*$lastopt" - lastopt+=":set pixel format:_ffmpeg_pix_fmts" - elif [[ $example == bitstream_filter ]]; then - lastopt_takesargs=0 - lastopt+=": :_ffmpeg_bsfs" - else - lastopt_takesargs=1 - lastopt_description+=" ($example)" - fi - else - lastopt_takesargs=0 - if [[ $lastopt == -vfilters ]]; then - lastopt+=": :->vfilters" - fi - fi - lastopt_values=() - elif [[ $REPLY == ' '* ]]; then - REPLY=${REPLY##[[:space:]]##} - REPLY=${REPLY%%[[:space:]]##*} - lastopt_takesargs=1 - lastopt_values+=$REPLY - fi + _alternative -O ca_opts \ + "$tag:$desc:( ${(j< >)${(@q+)devices}} )" \ + "$tag:$desc:_ffmpeg_hwaccels -T" +} + +# complete hardware devices init spec +(( $+functions[_ffmpeg_hw_device_inits] )) || +_ffmpeg_hw_device_inits() { + local -a expl + if compset -P '*,*=' && [[ $PREFIX != *,* ]]; then + _wanted values expl 'device parameter value' _files -qS, + elif compset -P '*,'; then + _message 'device parameter (key=val)' + elif compset -P '*@'; then + _ffmpeg_hw_devices + elif compset -P '*:'; then + _wanted devices expl device _files -qS, + elif compset -P '*='; then + _message 'hardware device name' + else + _ffmpeg_hwaccels -T -qS= + fi +} + +# complete input/output devices +(( $+functions[_ffmpeg_devices] )) || +_ffmpeg_devices() { + local de=DE tag=devices desc=device + local -a ca_opts tmp devices + local -A opth + + zparseopts -A opth -D -F - \ + {1+,2+,F+:,J+:,M+:,n+,o+:,q+,r+:,R+:,s+:,S+:,V+:,x+:,X+:}=ca_opts \ + D E \ + || return + + if (( ${+opth[-D]} )); then + de=D tag=input-$tag desc="input $desc" + elif (( ${+opth[-E]} )); then + de=E tag=output-$tag desc="output $desc" + fi + + tmp=( ${(f)"$( _call_program devices $words[1] -devices )"} ) + tmp=( ${(M)tmp:# [DE. ](#c2) [^=]* *} ) + + [[ $de == *D* ]] && devices+=( ${(M)tmp:# D? *} ) + [[ $de == *E* ]] && devices+=( ${(M)tmp:# ?E *} ) + devices=( ${devices# ?? } ) + + if zstyle -t ":completion:$curcontext:$tag" verbose; then + local f d + tmp=( ${${(@)devices//:/\\:}/[[:space:]]##/:} ) + devices=( ) + for f in $tmp; do + d=${f#*:} f=${f%%:*} + devices+=( ${^${(@s<,>)f}}:$d ) done - [[ -n $lastopt ]] && _ffmpeg_register_lastopt_values + devices=( ${(u)devices} ) + + else + devices=( ${(@s<,>)${(@)devices%%[[:space:]]*}} ) + fi + + _describe -t $tag $desc devices "${(@)ca_opts}" +} + +# complete disposition flags +# -I => single disposition +(( $+functions[_ffmpeg_dispositions] )) || +_ffmpeg_dispositions() { + local tag=dispositions desc='disposition flag' + local -a ca_opts expl dispositions + local -A opth + + zparseopts -A opth -D -F - \ + {1+,2+,F+:,J+:,M+:,n+,o+:,q+,r+:,R+:,s+:,S+:,V+:,x+:,X+:}=ca_opts \ + I \ + || return + + dispositions=( ${(f)"$( _call_program $tag $words[1] -dispositions )"} ) + dispositions=( ${dispositions:#*:*} ) + dispositions=( ${dispositions##[[:space:]]##} ) + + if (( ${+opth[-I]} )); then + _describe -t $tag $desc dispositions "${(@)ca_opts}" + else + _wanted $tag expl $desc _ffmpeg_flags "${(@)ca_opts}" - $dispositions + fi +} + +# complete stats format spec +(( $+functions[_ffmpeg_stats_fmt_specs] )) || +_ffmpeg_stats_fmt_specs() { + local bs + + compset -S '[{[[:space:]]*' + compset -P '*[}[[:space:]]' + + [[ -n $compstate[quote] ]] || bs=\\ + + argv=( -r'}\-' -S"$bs}" "$@" ) + compset -P '*{' || argv=( -P"$bs{" "$@" ) + + _describe -t stats-format-spec-directives 'stats format spec directive' '( + fidx:"index of output file" + sidx:"index of output stream in file" + n:"frame number" + ni:"input frame number" + tb:"time base for time stamps of frame/packet" + tbi:"timebase for ptsi" + pts:"presentation time stamp of frame/packet" + ptsi:"presentation time stamp of input frame (ni)" + t:"presentation time of frame/packet" + ti:"presentation time of input frame (ni)" + dts:"decoding time stamp of packet" + dt:"decoding time of frame/packet (dts*tb)" + sn:"number of audio samples sent to encoder" + samp:"number of audio samples in frame" + size:"size of packet (bytes)" + br:"current bit rate (bps)" + abr:"average bit rate of whole stream (bps)" + key:"K if packet contains key frame, N otherwise" + )' "$@" +} + +# complete vsync method / frame-rate mode +(( $+functions[_ffmpeg_fps_modes] )) || +_ffmpeg_fps_modes() { + _describe -t fps-modes 'frame-rate mode [auto]' '( + passthrough:"pass through frames unmodified" + cfr:"duplicate or drop frames to achieve constant frame rate" + vfr:"pass through or drop frames to achieve variable frame rate" + auto:"choose cfr or vfr based on muxer capabilities" + )' "$@" +} + +# complete video-size abbreviation +(( $+functions[_ffmpeg_video_sizes] )) || +_ffmpeg_video_sizes() { + _describe -t video-sizes 'video size abbreviation (or WxH)' '( + ntsc:720x480 pal:720x576 qntsc:352x240 qpal:352x288 + sntsc:640x480 spal:768x576 film:352x240 ntsc-film:352x240 + sqcif:128x96 qcif:176x144 cif:352x288 4cif:704x576 + 16cif:1408x1152 qqvga:160x120 qvga:320x240 vga:640x480 + svga:800x600 xga:1024x768 uxga:1600x1200 qxga:2048x1536 + sxga:1280x1024 qsxga:2560x2048 hsxga:5120x4096 wvga:852x480 + wxga:1366x768 wsxga:1600x1024 wuxga:1920x1200 woxga:2560x1600 + wqsxga:3200x2048 wquxga:3840x2400 whsxga:6400x4096 + whuxga:7680x4800 cga:320x200 ega:640x350 hd480:852x480 + hd720:1280x720 hd1080:1920x1080 2k:2048x1080 2kflat:1998x1080 + 2kscope:2048x858 4k:4096x2160 4kflat:3996x2160 + 4kscope:4096x1716 nhd:640x360 hqvga:240x160 wqvga:400x240 + fwqvga:432x240 hvga:480x320 qhd:960x540 2kdci:2048x1080 + 4kdci:4096x2160 uhd2160:3840x2160 uhd4320:7680x4320 + )' "$@" } -_arguments -C -S \ - "${_ffmpeg_argspecs[@]}" \ - '*:output file:_files' \ - && return +# complete map data source +(( $+functions[_ffmpeg_map_sources] )) || +_ffmpeg_map_sources() { + compset -P - + + if compset -P '*:view:'; then + _message 'view ID' + elif compset -P '*:vidx:'; then + _message 'view index' + elif compset -P '*:vpos:'; then + _describe -t view-positions 'view position' '(left right)' + elif compset -P 1 '*:'; then + local ret=1 + # this isn't quite right + compset -P '<->:' || + compset -P '[astvV](:(?|[\\#]##[^:]##))#:' || + compset -P 'g:(i:|)[\\#]#[^:]##:' || + compset -P 'p:[^:]##(|:(?|[\\#]##[^:]##))#:' || + compset -P '([\\#]##|i:)[^:]##:' || + compset -P 'm:[^:]##:' || # how can this have a value here? + compset -P 'disp:[^:]##:' || + compset -P u: + _ffmpeg_stream_specs -qS: && ret=0 + _describe -t view-specifiers 'view specifier' '( + view:"view ID" + vidx:"view index" + vpos:"view position" + )' -qS: && ret=0 + return ret + else + _message \ + 'map source ([-]input_file_id[:stream_specifier][:view_specifier][:?])' + fi +} + +# complete program spec +(( $+functions[_ffmpeg_program_specs] )) || +_ffmpeg_program_specs() { + local x + local -a kvs keys=( + 'title:program title' + 'program_num:program number' + 'st:stream index' + ) + for x in $keys; do + kvs+=( "${x%%:*}[${${x#*:}%%:*}]:${x#*:}" ) + done + + # it doesn't seem like these need to be given in order + compset -P '*:' + _values -s: -S= 'program specifier (key=val:key=val:...)' $kvs +} + +# complete stream-group spec +(( $+functions[_ffmpeg_stream_group_specs] )) || +_ffmpeg_stream_group_specs() { + local x + local -a kvs keys=( + 'map:input-group mapping' + 'type:stream-group type:( iamf_audio_element iamf_mix_presentation )' + 'st:stream index' + 'stg:stream group' + 'id:stream-group ID' + ) + for x in $keys; do + kvs+=( "${x%%:*}[${${x#*:}%%:*}]:${x#*:}" ) + done + + # @todo we should complete these. it's annoying because some use ':' for their + # own values + compset -P '*,' && { + _message 'type option' + return + } + + # it doesn't seem like these need to be given in order. except maybe the type + # options? + compset -P '*:' + _values -s: -S= 'stream-group specifier (key=val:key=val:...)' $kvs +} + +# complete key-frame force condition +(( $+functions[_ffmpeg_kf_force_conds] )) || +_ffmpeg_kf_force_conds() { + if compset -P expr:; then + _message expression + elif compset -P '*[0-9,]*'; then + _message 'time stamps (time[,time...])' + else + _describe -t kf-force-conditions 'when to force key frame (or time stamps)' \ + '( + source:"when source frame is marked as key frame" + scd_metadata:"when frame has metadata entry lavfi.scd.time" + )' \ + -- \ + '( expr:"when evaluated expression is non-zero" )' -r: -S: + fi +} + +# complete log-level flag +(( $+functions[_ffmpeg_loglevels] )) || +_ffmpeg_loglevels() { + local -a levels=( + quiet panic fatal error warning info verbose debug trace + ) + compset -P "(|*+)(${(j<|>)${(@b)levels}})" && return + _alternative \ + "levels:logging level:_ffmpeg_flags - ${(j< >)${(@q+)levels}}" \ + 'flags: :_ffmpeg_flags - repeat level time datetime' +} + +# complete date spec +(( $+functions[_ffmpeg_dates] )) || +_ffmpeg_dates() { + _message -e dates \ + 'date ([(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m]]])|(HHMMSS[.m]]]))[Z]) (or now)' +} + +# complete duration spec +(( $+functions[_ffmpeg_durations] )) || +_ffmpeg_durations() { + _message -e durations 'duration ([-][HH:]MM:SS[.m] or [-]S+[.m][s|ms|us])' +} + +# complete compare functions +(( $+functions[_ffmpeg_cmp_functions] )) || +_ffmpeg_cmp_functions() { + _describe -t compare-functions 'compare function' '( + sad sse satd dct psnr bit rd zero vsad vsse nsse w53 w97 dctmax + chroma msad + )' "$@" +} + +# complete frame discard methods +(( $+functions[_ffmpeg_discard_methods] )) || +_ffmpeg_discard_methods() { + _describe -t discard-methods 'frame discard method' '( + none:"no frames" + default:"useless frames" + noref:"non-reference frames" + bidir:"bi-directional frames" + nointra:"all except I frames" + nokey:"all except key frames" + all:"all frames" + )' "$@" +} + +# complete -help topic +(( $+functions[_ffmpeg_help_topics] )) || +_ffmpeg_help_topics() { + if compset -P decoder=; then + _ffmpeg_codecs -D + elif compset -P encoder=; then + _ffmpeg_codecs -E + elif compset -P demuxer=; then + _ffmpeg_formats -D + elif compset -P muxer=; then + _ffmpeg_formats -E + elif compset -P filter=; then + _ffmpeg_filters + elif compset -P bsf=; then + _ffmpeg_bsfs -I + elif compset -P protocol=; then + _ffmpeg_protocols + else + _describe -t help-topics 'help topic' \ + '( + long:"basic and advanced tool options" + full:"all options" + )' \ + -- \ + '( + decoder:"specified decoder" + encoder:"specified encoder" + demuxer:"specified demuxer" + muxer:"specified muxer" + filter:"specified filter" + bsf:"specified bitstream filter" + protocol:"specified protocol" + )' -r= -S= + fi +} + +local MATCH MBEGIN MEND x y z no +local -a ss_opts ms_opts basic_opts expert_opts gen_avo_opts opts tmp + +# names of options that support optional :stream_specifier form +ss_opts=( + ac apad apply_cropping ar aspect autorotate autoscale b + bits_per_raw_sample bsf c canvas_size ch_layout channel_layout + chroma_intra_matrix codec copyinkf copypriorss discard + display_hflip display_rotation display_vflip disposition + drop_changed dump_attachment enc_time_base filter filter_script + fix_sub_duration fix_sub_duration_heartbeat force_fps + force_key_frames fps_mode fpsmax frames guess_layout_max hwaccel + hwaccel_device hwaccel_output_format inter_matrix intra_matrix + itsscale max_muxing_queue_size muxing_queue_data_threshold pass + passlogfile pix_fmt pre q qscale r rc_override reinit_filter s + sample_fmt stats_enc_post stats_enc_post_fmt stats_enc_pre + stats_enc_pre_fmt stats_mux_pre stats_mux_pre_fmt tag threads + time_base top +) + +# names of options that support optional :metadata_specifier form +ms_opts=( metadata map_metadata ) + +# option specs are grouped and ordered per `ffmpeg -help full` output. the +# separate arrays probably aren't necessary, but i was keeping track of it +# anyway, and maybe it'll be useful in the future + +# note: in order for the replacements below to work reliably, all specs must +# have descriptions ('-o[desc]'), and colons must not be omitted after optarg +# descriptions: '-o[desc]:argdesc:', NOT '-o[desc]:argdesc' + +# basic information/capability options +basic_opts+=( + '(- : *)'{-L,-license}'[display licence information]' + '(- : *)'{-h,-help,--help}'[display help information]:: :_ffmpeg_help_topics' + '!(- : *)-?[]:: :_ffmpeg_help_topics' # annoying + '(- : *)-version[display version information]' + '(- : *)-muxers[display available muxers]' + '(- : *)-demuxers[display available demuxers]' + '(- : *)-devices[display available devices]' + '(- : *)-decoders[display available decoders]' + '(- : *)-encoders[display available encoders]' + '(- : *)-filters[display available filters]' + '(- : *)-pix_fmts[display available pixel formats]' + '(- : *)-layouts[display channel names and standard channel layouts]' + '(- : *)-sample_fmts[display available sample formats]' +) +# advanced information/capability options +expert_opts+=( + '(- : *)-buildconf[display build configuration]' + '(- : *)-formats[display available formats]' + '(- : *)-codecs[display available codecs]' + '(- : *)-bsfs[display available bitstream filters]' + '(- : *)-protocols[display available protocols]' + '(- : *)-dispositions[display stream dispositions]' + '(- : *)-colors[display recognised colours]' + '(- : *)-sources[display input sources (specify device)]:: :{ + compset -S ",*" + if compset -P "*,"; then + _message "input device option (opt1=val1,opt2=val2,...)" + else + _ffmpeg_devices -D -qS, + fi + }' + '(- : *)-sinks[display output sinks (specify device)]:: :{ + compset -S ",*" + if compset -P "*,"; then + _message "output device option (opt1=val1,opt2=val2,...)" + else + _ffmpeg_devices -E -qS, + fi + }' + '(- : *)-hwaccels[display available hardware-acceleration methods]' +) +# basic global options +basic_opts+=( + '(-v -loglevel)'{-v,-loglevel}'[set logging level]: :_ffmpeg_loglevels' + '(-n)-y[overwrite output files without asking]' + '(-y)-n[never overwrite output files]' + '-print_graphs[print execution graph data to stderr]' + '-print_graphs_file[write execution graph data to specified file]:execution graph file:_files' + '-print_graphs_format[specify execution graph format]:execution graph format:( + default compact csv flat ini json xml mermaid mermaidhtml + )' + '-stats[print encoding progress and statistics]' +) +# advanced global options +expert_opts+=( + '-report[generate report]' + '-max_alloc[specify heap allocation size limit]: :\ + _ffmpeg_numbers -u bytes "max heap allocation block size" + ' + # we could check these against $MACHTYPE but i don't think it matters + '-cpuflags[specify CPU flags]:CPU flag:_ffmpeg_flags - \ + mmx mmxext \ + sse sse2 sse2slow sse3 sse3slow ssse3 sse4.1 sse4.2 \ + atom \ + avx avx2 \ + xop \ + fma3 fma4 \ + 3dnow 3dnowext \ + bmi1 bmi2 \ + cmov \ + pentium2 pentium3 pentium4 k6 k62 athlon athlonxp k8 \ + armv5te armv6 armv6t2 vfp vfpv3 neon setend \ + armv8 vfp neon \ + altivec + ' + '-cpucount[specify CPU count]: :_ffmpeg_numbers "CPU count"' + '-hide_banner[suppress banner]' + '(-copy_unknown)-ignore_unknown[ignore unknown stream types]' + '(-ignore_unknown)-copy_unknown[copy unknown stream types]' + '-recast_media[allow forcing decoder of different media type]' + '-benchmark[show benchmark information at end of encode]' + '-benchmark_all[show benchmark information during encode]' + '-progress[write progress information to specified URL]: :{ + if compset -P pipe\:; then + _describe "file descriptor" "(0 1 2)" + else + _alternative "urls\: \:_urls" "files\: \:_files" + fi + }' + '-stdin[enable interaction on standard input]' + '-timelimit[specify max run time]: :\ + _ffmpeg_numbers -u seconds "max CPU user time" + ' + '-dump[dump each input packet to stderr]' + '-hex[also dump payload (with -dump)]' + '-frame_drop_threshold[specify frame-drop threshold]: :\ + _ffmpeg_numbers -u frames -N -d-1.1 "frame-drop threshold" + ' + '-copyts[copy timestamps]' + '-start_at_zero[shift input timestamps to start at 0 (with -copyts)]' + '-copytb[specify how to set encoder time base when copying stream]:mode:(( + -1\:"decide automatically" + 0\:"use decoder time base" + 1\:"use demuxer time base" + ))' + '-dts_delta_threshold[specify timestamp discontinuity delta threshold]: :\ + _ffmpeg_numbers -u seconds -d10 "timestamp discontinuity delta threshold" + ' + '-dts_error_threshold[specify timestamp error delta threshold]: :\ + _ffmpeg_numbers -u seconds -d108000 "timestamp error delta threshold" + ' + '-xerror[exit on error]' + '-abort_on[abort on specified condition flags]:condition flag:\ + _ffmpeg_flags - empty_output empty_output_stream + ' + '-filter_threads[specify number of threads used for each filter pipeline]: :\ + _ffmpeg_numbers threads + ' + '-filter_buffered_frames[specify max buffered frames in a filtergraph]: :\ + _ffmpeg_numbers -d0 "max buffered frames" + ' + '*'{-filter_complex,-lavfi}'[define specified complex filtergraph]: :_ffmpeg_filtergraphs' + '-filter_complex_threads[specify number of threads used for each complex filtergraph]: :\ + _ffmpeg_numbers threads + ' + '!*-filter_complex_script[]:-filter_complex script:_files' # deprecated + '-auto_conversion_filters[enable automatic conversion filters globally]' + '-stats_period[specify progress/statistics update interval]: :\ + _ffmpeg_numbers -u seconds -d0.5 "update interval" + ' + '-debug_ts[print timestamp/latency information]' + '-max_error_rate[specify max decoding error ratio]: :\ + _ffmpeg_numbers -l0 -m1 -d0.67 "max decoding error ratio" + ' + '-sdp_file[write sdp information to specified file]:sdp file:_files' + '*-init_hw_device[initialise specified hardware device]: :_ffmpeg_hw_device_inits' + '-filter_hw_device[specify hardware device for filtering]: :_ffmpeg_hw_devices' + '!-adrift_threshold[]:threshold:' # deprecated + '!-qphist[]' # deprecated + # deprecated in favour of -fps_mode, but still used in documentation, so no ! + '-vsync[specify video sync method globally]: :_ffmpeg_fps_modes' +) +# basic per-file options (input and output) +basic_opts+=( + '*-f[force specified container format]: :_ffmpeg_formats' + '*-t[stop after specified duration]: :_ffmpeg_durations' + '*-to[stop at specified time]: :_ffmpeg_durations' + '*-ss[start at specified time]: :_ffmpeg_durations' +) +# advanced per-file options (input and output) +expert_opts+=( + '*-bitexact[enable bitexact mode]' + '*-thread_queue_size[specified max queued packets for demuxer]: :\ + _ffmpeg_numbers "max queued packets" + ' +) +# advanced per-file options (input only) +expert_opts+=( + '*-sseof[start at specified time relative to EOF]: :_ffmpeg_durations' + '*-seek_timestamp[seek by timestamp (with -ss/-sseof)]' + '*-accurate_seek[enable accurate seeking (with -ss/-sseof)]' + '*-isync[specify input index for sync reference]: :\ + _ffmpeg_numbers -N -d-1 "input index" + ' + '*-itsoffset[specify input time offset]: :_ffmpeg_durations' + '*-re[read input at native frame rate (like -readrate 1)]' + '*-readrate[specify input read speed limit]: :\ + _ffmpeg_numbers -u seconds -l0 -d0 "max input read duration per 1s of wall time" + ' + '*-readrate_initial_burst[specify initial read burst time (with -readrate)]: :\ + _ffmpeg_numbers -u seconds "initial read burst time" + ' + '*-readrate_catchup[specify catch-up read speed limit if blocked (with -readrate)]: :\ + _ffmpeg_numbers -u seconds "max input read duration per 1s of wall time" + ' + '*-dump_attachment[extract matching attachment into specified file]:attachment output file:_files' + '*-stream_loop[specify number of times to loop input stream]: :\ + _ffmpeg_numbers -N -d0 "input-stream loops" + ' + '*-find_stream_info[decode streams to fill missing info with heuristics]' +) +# basic per-file options (output only) +basic_opts+=( + '*-metadata[add specified metadata to output]:metadata key=value:' +) +# advanced per-file options (output only) +expert_opts+=( + '*-map[specify stream mapping from input to output]: :_ffmpeg_map_sources' + '*-map_metadata[set metadata mapping from input to output]: :{ + if compset -P 1 "*\:"; then + _ffmpeg_metadata_specs + else + _message "input file index[\:metadata specifier]" + fi + }' + '*-map_chapters[specify chapter mapping from input to output]: :\ + _ffmpeg_numbers -N "input index" + ' + '*-fs[specify output file size limit]: :\ + _ffmpeg_numbers -u bytes "output file size limit" + ' + '*-timestamp[specify recording timestamp]: :_ffmpeg_dates' + '*-program[add program with specified streams]: :_ffmpeg_program_specs' + '*-stream_group[add stream group with specified streams]: :_ffmpeg_stream_group_specs' + '*-dframes[specify max data frames to output (-like -frames\:d)]: :\ + _ffmpeg_numbers "max data frames" + ' + '*-target[specify target file type]:file type:( + {film-,ntsc-,pal-,}{vcd,svcd,dvd,dv,dv50} + )' + '*-shortest[finish encoding when shortest output stream ends]' + '*-shortest_buf_duration[specify buffer duration for -shortest]: :\ + _ffmpeg_numbers -u seconds -d10 "max duration of buffered frames" + ' + '*'{-q,-qscale}'[specify VBR quality]: :\ + _ffmpeg_numbers "quality scale value" + ' + # this is codec-specific, but here are some we know about + '*-profile[specify codec profile]:codec profile:( + # avcodeccontext + unknown main10 + # dnxhd + dnxhd dnxhr_444 dnxhr_hqx dnxhr_hq dnxhr_sq dnxhr_lb + # prores + auto proxy lt standard hq 4444 4444xq + # x264 + baseline main high high10 high422 high444 + # h264 videotoolbox + baseline constrained_baseline main high constrained_high extended + # hevc videotoolbox + main main10 main42210 rext + # prores videotoolbox + auto proxy lt standard hq 4444 xq + )' + '*-attach[add attachment]:file to attach:_files' + '*-muxdelay[specify max demux-decode delay]: :\ + _ffmpeg_numbers -u seconds "max demux-decode delay" + ' + '*-muxpreload[specify initial demux-decode delay]: :\ + _ffmpeg_numbers -u seconds "demux-decode delay" + ' + '*-fpre[set options from specified preset file]:preset file:_files' \ +) +# basic per-stream options +basic_opts+=( + '*'{-c,-codec}'[specify encoder or decoder]: :_ffmpeg_codecs' + '*-filter[apply specified filtergraph]: :_ffmpeg_filtergraphs' +) +# advanced per-stream options +expert_opts+=( + '*-pre[specify preset]: :_ffmpeg_presets' + '*-itsscale[specify input timestamp scale]: :_ffmpeg_numbers scale' + '*-copyinkf[copy initial non-key frames]' + '*-copypriorss[copy or discard frames before start time]' + '*-frames[specify max frames to output]: :\ + _ffmpeg_numbers "max frames" + ' + # there are hundreds of these so i'm not sure it makes sense to complete them + '*-tag[force specified codec tag/fourcc]:codec fourcc:' + '!*-filter_script[]:-filter script:_files' # deprecated + '*-reinit_filter[specify whether to re-initialise filtergraph on input parameter change]:re-initialise mode:(( + 0\:disabled + 1\:enabled + ))' + '*-drop_changed[specify whether to drop frame on input parameter change]:drop mode:(( + 0\:disabled + 1\:enabled + ))' + '*-discard[specify frames to discard]: :_ffmpeg_discard_methods' + '*-disposition[specify disposition flags]: :_ffmpeg_dispositions' + '*-bits_per_raw_sample[specify bits per raw sample]: :\ + _ffmpeg_numbers "bits per raw sample" + ' + '*-stats_enc_pre[write pre-encoding frame stats to specified file]:stats file:_files' + '*-stats_enc_post[write post-encoding frame stats to specified file]:stats file:_files' + '*-stats_mux_pre[write pre-muxing frame stats to specified file]:stats file:_files' + '*-stats_enc_pre_fmt[specify format for -stats_enc_pre]: :_ffmpeg_stats_fmt_specs' + '*-stats_enc_post_fmt[specify format for -stats_enc_post]: :_ffmpeg_stats_fmt_specs' + '*-stats_mux_pre_fmt[specify format for -stats_mux_pre]: :_ffmpeg_stats_fmt_specs' + '*-time_base[specify time base for output stream]:time base (num\:den or float):' + '*-enc_time_base[specify time base for encoder]:encoder time base (or num\:den or float):(( + 0\:"assign default value according to media type" + demux\:"use time base from demuxer" + filter\:"use time base from filtergraph" + ))' + '*-bsf[specify bitstream filters]: :_ffmpeg_bsfs' + '*-max_muxing_queue_size[specify max packets in muxing queue]: :\ + _ffmpeg_numbers "max packets in muxing queue" + ' + '*-muxing_queue_data_threshold[specify minimum threshold for -max_muxing_queue_size]: :\ + _ffmpeg_numbers -u bytes -d50M "minimum threshold for muxing queue size" + ' +) +# basic video options +basic_opts+=( + '*-r[specify frame rate]: :\ + _ffmpeg_numbers -u "Hz, fraction, or abbreviation" "frame rate" + ' + '*-aspect[specify aspect ratio]: :\ + _ffmpeg_numbers -u "float or num:den" "aspect ratio" + ' + '*-vn[disable video]' + '*-vcodec[force specified video codec (like -c\:v)]: :_ffmpeg_codecs -Tv' + '*-vf[apply specified filtergraph to video (like -filter\:v)]: :_ffmpeg_filtergraphs' + # this is actually not a video option, it has to be used like -b:a or -b:v. + # but this is where it's listed in the help output + '*-b[specify bit rate]: :_ffmpeg_numbers -u bps "bit rate"' + # this isn't in the help output for some reason + '*-s[specify video frame size]: :_ffmpeg_video_sizes' +) +# advanced video options +expert_opts+=( + '*-vframes[specify max video frames to output (like -frames\:v)]: :\ + _ffmpeg_numbers "max video frames" + ' + '*-fpsmax[specify max video frame rate]: :\ + _ffmpeg_numbers -u "Hz, fraction, or abbreviation" "frame rate" + ' + '*-pix_fmt[specify pixel format]: :_ffmpeg_pix_fmts' + '*-display_rotation[specify video rotation]: :\ + _ffmpeg_numbers -u degrees "anti-clockwise video rotation" + ' + '*-display_hflip[flip video horizontally]' + '*-display_vflip[flip video vertically]' + '*-rc_override[specify rate-control override]:rate control (beg,end,quant):' + '*-timecode[specify timecode]:timecode (hh\:mm\:ss[\:;.]ff)' + '*-pass[specify pass number for two-pass video encoding]:pass:(1 2)' + '*-passlogfile[specify two-pass log-file prefix]:log-file prefix [ffmpeg2pass]:' + '*-intra_matrix[specify intra quantisation matrix]:intra quantisation matrix:' + '*-inter_matrix[specify inter quantisation matrix]:inter quantisation matrix:' + '*-chroma_intra_matrix[specify chroma intra quantisation matrix]:intra quantisation matrix:' + '*-vtag[force specified video codec tag/fourcc (like -tag\:v)]:video codec fourcc:' + '*-fps_mode[specify frame-rate mode]: :_ffmpeg_fps_modes' + '*-force_fps[force selected frame rate]' + '*-streamid[specify stream identifier]:output-stream-index\:new-value:' + '*-force_key_frames[force key frames at specified timestamps]: :_ffmpeg_kf_force_conds' + '*-hwaccel[specify hardware acceleration for decoding]: :_ffmpeg_hwaccels' + '*-hwaccel_device[specify hardware-acceleration device (with -hwaccel)]: :_ffmpeg_hw_devices' + '*-hwaccel_output_format[specify hardware-acceleration output format (with -hwaccel)]: :_ffmpeg_pix_fmts -H' + '*-autorotate[automatically rotate video]' + '*-autoscale[automatically scale video]' + '*-apply_cropping[automatically crop video using specified method]:crop method [all]:(( + none\:"don'\''t apply cropping" + all\:"apply codec- and container-level cropping" + codec\:"apply codec-level cropping" + container\:"apply container-level cropping" + ))' + '*-fix_sub_duration_heartbeat[set stream as heartbeat stream (with -fix_sub_duration)]' + '*-vpre[specify video preset]: :_ffmpeg_presets' + '!*-top[]:top:' # deprecated +) +# basic audio options +basic_opts+=( + '*-aq[specify audio VBR quality (like -q\:a)]: :\ + _ffmpeg_numbers "quality scale value" + ' + '*-ar[specify audio sampling rate]: :\ + _ffmpeg_numbers -u Hz "audio sampling rate" + ' + '*-ac[specify number of audio channels]: :\ + _ffmpeg_numbers "audio channels" + ' + '*-an[disable audio]' + '*-acodec[force specified audio codec (like -c\:a)]: :_ffmpeg_codecs -Ta' + '*-ab[specify audio bit rate]: :_ffmpeg_numbers -u bps "audio bit rate"' + '*-af[apply specified filtergraph to audio (like -filter\:a)]: :_ffmpeg_filtergraphs' +) +# advanced audio options +expert_opts+=( + '*-aframes[specify max audio frames to output (like -frames\:a)]: :\ + _ffmpeg_numbers "max audio frames" + ' + '*-apad[pad audio stream with specified parameters (like -af apad) (with -shortest)]:apad filter parameters ([key=]val\:[key=]val\:...):' + '*-atag[force specified audio codec tag/fourcc (like -tag\:a)]:audio codec fourcc:' + '*-sample_fmt[specify audio sample format]: :_ffmpeg_sample_fmts' + '*'{-channel_layout,-ch_layout}'[specify audio channel layout]: :_ffmpeg_layouts' + '*-guess_layout_max[specify max channels for guessing channel layout]: :\ + _ffmpeg_numbers "max audio channels" + ' + '*-apre[specify audio preset]: :_ffmpeg_presets' +) +# basic subtitle options +basic_opts+=( + '*-sn[disable subtitles]' + '*-scodec[force specified subtitle codec (like -c\:s)]: :_ffmpeg_codecs -Ts' +) +# advanced subtitle options +expert_opts+=( + '*-stag[force specified subtitle codec tag/fourcc (like -tag\:s)]:subtitle codec fourcc:' + '*-fix_sub_duration[fix subtitle durations]' + '*-canvas_size[specify size of canvas for rendering subtitles]: :_ffmpeg_video_sizes' + '*-spre[specify subtitle preset]: :_ffmpeg_presets' +) +# basic data-stream options +basic_opts+=( + '*-dcodec[force specified data codec (like -c\:d)]: :_ffmpeg_codecs -Td' + '*-dn[disable data]' +) +# generic codec AVOptions. my assumption is that these are rarely used, so i +# haven't put much effort into them +gen_avo_opts+=( + '!*-bt[]: :_ffmpeg_numbers -u bps "bit-rate tolerance"' + '!*-flags[]: :_ffmpeg_flags - \ + unaligned mv4qpel loop gray psnr ildct low_delay global_header \ + bitexact aic ilme cgop output_corrupt + ' + '!*-flags2[]: :_ffmpeg_flags - \ + fast noout ignorecrop local_header chunks showall export_mvs \ + skip_manual ass_ro_flush_noop icc_profiles + ' + '!*-export_side_data[]: :_ffmpeg_flags - \ + mvs prft venc_params film_grain enhancements + ' + '*-g[specify GOP (group of pictures) length]: :\ + _ffmpeg_numbers -u frames "GOP length" + ' + '*-cutoff[specify audio cut-off frequency]: :\ + _ffmpeg_numbers -u Hz "cut-off frequency" + ' + '*-frame_size[specify audio frame size]: :\ + _ffmpeg_numbers -u samples/channel "frame size" + ' + '!*-qcomp[]:float:' + '!*-qblur[]:float:' + '!*-qmin[]:int:' + '!*-qmax[]:int:' + '!*-qdiff[]:int:' + '!*-bf[]:int:' + '!*-b_qfactor[]:float:' + '!*-bug[]: :_ffmpeg_flags - \ + autodetect xvid_ilace ump4 no_padding amv qpel_chroma std_qpel \ + qpel_chroma2 direct_blocksize edge hpel_chroma dc_clip ms trunc \ + iedge + ' + '*-strict[specify how strictly to follow standards]:strictness level:( + very strict normal unofficial experimental + )' + '!*-b_qoffset[]:float:' + '!*-err_detect[]: :_ffmpeg_flags - \ + crccheck bitstream buffer explode ignore_err careful compliant + aggressive + ' + '!*-maxrate[]:int64:' + '!*-minrate[]:int64:' + '!*-bufsize[]:int:' + '!*-i_qfactor[]:float:' + '!*-i_qoffset[]:float:' + '!*-lumi_mask[]:float:' + '!*-tcplx_mask[]:float:' + '!*-scplx_mask[]:float:' + '!*-p_mask[]:float:' + '!*-dark_mask[]:float:' + '!*-dct[]:algorithm:(auto fastint int mmx altivec faan neon)' + '!*-idct[]:algorithm:( + auto int simple simplemmx arm altivec simplearm simplearmv5te + simplearmv6 simpleneon xvid xvidmmx faani simpleauto + )' + '!*-ec[]: :_ffmpeg_flags - guess_mvs deblock favor_inter' + '!*-sar[]:rational:' + '!*-debug[]: :_ffmpeg_flags - \ + pict rc bitstream mb_type qp dct_coeff green_metadata skip \ + startcode er mmco bugs buffers thread_ops nomc + ' + '!*-dia_size[]:int:' + '!*-last_pred[]:int:' + '!*-pre_dia_size[]:int:' + '!*-subq[]:int:' + '!*-me_range[]:int:' + '!*-global_quality[]:int:' + '!*-mdb[]:macroblock decision algorithm [simple]:(simple bits rd)' + '!*-rc_init_occupancy[]:int:' + '*-threads[specify number of threads to use]: :\ + _ffmpeg_numbers -d1 "threads (or auto)" + ' + '!*-dc[]:int:' + '!*-nssew[]:int:' + '!*-skip_top[]:int:' + '!*-skip_bottom[]:int:' + '!*-level[]:int:' + '!*-lowres[]:int:' + '!*-cmp[]: :_ffmpeg_cmp_functions' + '!*-subcmp[]: :_ffmpeg_cmp_functions' + '!*-mbcmp[]: :_ffmpeg_cmp_functions' + '!*-ildctcmp[]: :_ffmpeg_cmp_functions' + '!*-precmp[]: :_ffmpeg_cmp_functions' + '!*-mblmin[]:int:' + '!*-mblmax[]:int:' + '!*-skip_loop_filter[]: :_ffmpeg_discard_methods' + '!*-skip_idct[]: :_ffmpeg_discard_methods' + '!*-skip_frame[]: :_ffmpeg_discard_methods' + '!*-bidir_refine[]:int:' + '!*-keyint_min[]:int:' + '!*-refs[]:int:' + '!*-trellis[]:int:' + '!*-mv0_threshold[]:int:' + '!*-compression_level[]:int:' + '!*-rc_max_vbv_use[]:float:' + '!*-rc_min_vbv_use[]:float:' + '!*-color_primaries[]:colour primary [unknown]:( + bt709 unknown bt470m bt470bg smpte170m smpte240m film bt2020 + smpte428 smpte428_1 smpte431 smpte432 jedec-p22 ebu3213 + unspecified + )' + '!*-color_trc[]:colour transfer characteristic [unknown]:( + bt709 unknown gamma22 gamma28 smpte170m smpte240m linear log100 + log316 iec61966-2-4 bt1361e iec61966-2-1 bt2020-10 bt2020-12 + smpte2084 smpte428 arib-std-b67 unspecified log log_sqrt + iec61966_2_4 bt1361 iec61966_2_1 bt2020_10bit bt2020_12bit + smpte428_1 + )' + '!*-colorspace[]:colour space [unknown]:( + rgb bt709 unknown fcc bt470bg smpte170m smpte240m ycgco bt2020nc + bt2020c smpte2085 chroma-derived-nc chroma-derived-c ictcp ipt-c2 + unspecified ycocg ycgco-re ycgco-ro bt2020_ncl bt2020_cl + )' + '!*-color_range[]:colour range [unknown]:( + unknown tv pc unspecified mpeg jpeg limited full + )' + '!*-chroma_sample_location[]:sample location [unknown]:( + unknown left center topleft top bottomleft bottom unspecified + )' + '!*-alpha_mode[]:alpha mode [unknown]:( + unknown unspecified premultiplied straight + )' + '!*-slices[]:int:' + '!*-thread_type[]:thread-type flag [slice+frame]:_ffmpeg_flags - slice frame' + '!*-audio_service_type[]:audio service type [ma]:(ma ef vi hi di co em vo ka)' + '!*-request_sample_fmt[]: :_ffmpeg_sample_fmts' + '!*-sub_charenc[specify subtitle character encoding]:subtitle character encoding:' + '!*-sub_charenc_mode[]:subtitle character encoding mode flag [0]:\ + _ffmpeg_flags - do_nothing auto pre_decoder ignore + ' + '!*-skip_alpha[]' + '!*-field_order[]:field order [0]:(progressive tt bb tb bt)' + '!*-dump_separator[specify information dump field separator]:field separator:' + '!*-codec_whitelist[]: :_sequence -s, _ffmpeg_codecs -D' + '!*-max_pixels[]:int64:' + '!*-max_samples[]:int64:' + '!*-hwaccel_flags[]:hardware-acceleration flag [ignore_level]:\ + _ffmpeg_flags - \ + ignore_level allow_high_depth allow_profile_mismatch \ + unsafe_output + ' + '!*-extra_hw_frames[]:int:' + '!*-discard_damaged_percentage[]:int:' + '!*-side_data_prefer_packet[]: : _values -s, "side data type" \ + replaygain displaymatrix spherical stereo3d audio_service_type \ + mastering_display_metadata content_light_level icc_profile exif + ' +) +# generic format AVOptions. see above +gen_avo_opts+=( + '!*-avioflags[]: :_ffmpeg_flags - direct' + '!*-probesize[]:int64:' + '!*-formatprobesize[]:int:' + '!*-packetsize[]:int:' + '!*-fflags[]: :_ffmpeg_flags - \ + flush_packets ignidx genpts nofillin noparse igndts \ + discardcorrupt sortdts fastseek nobuffer bitexact autobsf + ' + '!*-seek2any[]' + '!*-analyzeduration[]:int64:' + '!*-cryptokey[]:binary:' + '!*-indexmem[]:int:' + '!*-rtbufsize[]:int:' + '!*-fdebug[]: :_ffmpeg_flags - ts' + '!*-max_delay[]:int:' + '!*-start_time_realtime[]:int64:' + '!*-fsprobesize[]:int:' + '!*-audio_preload[]:int:' + '!*-chunk_duration[]:int:' + '!*-chunk_size[]:int:' + '!*'{-f_err_detect,-err_detect}'[]: :_ffmpeg_flags - \ + crccheck bitstream buffer explode ignore_err careful compliant \ + aggressive + ' # -f_err_detect is deprecated + '!*-use_wallclock_as_timestamps[]' + '!*-skip_initial_bytes[]:int64:' + '!*-correct_ts_overflow[]' + '!*-flush_packets[]:int:' + '!*-metadata_header_padding[]:int:' + '!*-output_ts_offset[]: :_ffmpeg_durations' + '!*-max_interleave_delta[]:int64:' + # deprecated. see -strict + '!*-f_strict[]:strictness level:(very strict normal unofficial experimental)' + '!*-max_ts_probe[]:int:' + '!*-avoid_negative_ts[]:time-stamp shift method:( + auto disabled make_non_negative make_zero + )' + '!*-format_whitelist[]: :_sequence -s, _ffmpeg_formats -D' + '!*-protocol_whitelist[]: :_sequence -s, _ffmpeg_protocols' + '!*-protocol_blacklist[]: :_sequence -s, _ffmpeg_protocols' + '!*-max_streams[]:int:' + '!*-skip_estimate_duration_from_pts[]' + '!*-max_probe_packets[]:int:' + '!*-duration_probesize[]:int64:' +) +# and... this +basic_opts+=( + '*-i[input file or URL]:input file:_files' +) + +# previous iterations of this function only completed basic options. not sure if +# that's specifically desirable, but we can support it +opts=( $basic_opts ) +if zstyle -t ":completion:$curcontext:$curtag" basic; then + opts+=( ${expert_opts/#(#m)[^!]/!$MATCH} ${gen_avo_opts/#(#m)[^!]/!$MATCH} ) +else + opts+=( $expert_opts $gen_avo_opts ) +fi + +# --help looks annoying in the list +[[ -n $words[(r)--*] ]] || opts=( ${opts:#(|\(*\))\*#--*} ) + +# support -no variants of boolean options +[[ $PREFIX == -no* ]] && +for x in ${opts:#*\]:*}; do + [[ $x == \([' *:-']##\)* ]] && continue # skip -version etc + # skip some others that are stupid + [[ $x == (|\(*\))-(hide_banner|n|y)\[* ]] && continue + # turn '-foo[do bar]' into "-nofoo[don't do bar]" + [[ $x == \(* ]] && x=${x/\)-/\)-no} || x=${x/-/-no} + x=${x/\[/\[don\'t } + opts+=( $x ) +done -[[ "$state" == "vfilters" ]] && - _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' \ - 'noformat: :_sequence -s : _ffmpeg_pix_fmts' \ - 'null' \ - 'pad:add pads to the input image (width\:height\:x\:y\:color_string):' \ - 'pixelaspect:set pixel aspect ratio (rational number X\:Y or decimal number):' \ - 'scale:scale input video (width\:height):' \ - 'slicify:output slice height ("random" or a number of pixels):' \ - 'unsharp:luma_x\:luma_y\:luma_amount\:chroma_x\:chroma_y\:chroma_amount:' \ - 'vflip' \ - 'buffer' \ - 'nullsrc' \ - 'nullsink' \ - && return +# support optional stream/metadata spec, e.g. -codec:a or -metadata:s:a +[[ $words[CURRENT] == -/#*:* || $words[CURRENT-1] == -/#*:* ]] && +for x y in ss_opts _ffmpeg_stream_specs ms_opts _ffmpeg_metadata_specs; do + for z in ${(P)x}; do + [[ $words[CURRENT] == -/#$z:* || $words[CURRENT-1] == -/#$z:* ]] || continue + tmp=( ${(M)opts:#(|\(*\))\*#-$z\[*} ) + opts=( ${opts:#$tmp} ) + # turn '-c:x:y' into '-c\:-: :_ffmpeg_stream_specs:x:y' + tmp=( ${tmp/\[/\\:-\[} ) + tmp=( ${tmp/%(#m):([^:]|\\:)##(|:([^:]|\\:)#)/: :$y$MATCH} ) + opts+=( $tmp ) + break + done +done -[[ -n $state && -n $_ffmpeg_flags[$state] ]] && - _ffmpeg_flags $state && return +# support -/ variant (-/filter:v filter.script) of options with args +[[ $words[CURRENT] == -/* || $words[CURRENT-1] == -/?* ]] && +for (( x = 1; x <= $#opts; x++ )); do + [[ $opts[x] == *\]:* ]] || continue + [[ $opts[x] == \([' *:-']##\)* ]] && continue # skip -help etc + y=${${${${opts[x]#\!}#\(*\)}#\*}%%(\\:|)(-|)\[*} # option name for desc + # turn '-c:x:y' into '-/c:...:_files' + [[ $opts[x] == \(* ]] && opts[x]=${opts[x]/\)-/\)-/} || opts[x]=${opts[x]/-/-/} + opts[x]=${opts[x]/%:([^:]|\\:)##(|:([^:]|\\:)#)/:$y argument value file:_files} +done -return 1 +_arguments -S : $opts '*:output file:_files' diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find index 4908cabbc..2afb46e34 100644 --- a/Completion/Unix/Command/_find +++ b/Completion/Unix/Command/_find @@ -12,17 +12,21 @@ case $variant in '*-local' ) ;| - solaris*|darwin*) + solaris*|darwin*|freebsd<15->.*) args+=( '*-xattr' ) ;| solaris2.<10->|freebsd*|darwin*) args+=( '*-acl' ) ;| - solaris2.<11->|freebsd*|dragonfly*|darwin*|openbsd*|gnu) + aix*|solaris2.<11->|freebsd*|dragonfly*|darwin*|openbsd*|gnu) args+=( '*-amin:access time (minutes)' '*-cmin:inode change time (minutes)' '*-mmin:modification time (minutes)' + ) + ;| + solaris2.<11->|freebsd*|dragonfly*|darwin*|openbsd*|gnu) + args+=( '*-iname:name pattern to match (case insensitive)' '*-print0' ) @@ -36,7 +40,7 @@ case $variant in darwin*|freebsd*|gnu) args+=( '*-Bmin:birth time (minutes)' - '*-Bnewer:file to compare (birth time):_files' + '!*-Bnewer:reference file:_files' '*-newer'{a,B,c,m}{a,B,c,m}'[if [aBcm\]time is newer than [aBcm\]time of given file]:reference file:_files' '*-newerat[if access time is newer than given timestamp]:timestamp: ' '*-newerBt[if birth time is newer than given timestamp]:timestamp: ' @@ -98,7 +102,7 @@ case $variant in ) ;| freebsd*|dragonfly*) args+=( '*-sparse' ) ;| - darwin*) args+=( '*-xattrname:name' ) ;| + darwin*|freebsd<15->.*) args+=( '*-xattrname:name' ) ;| gnu) args+=( '(- *)-help' '(-)--help' @@ -162,7 +166,7 @@ if [[ $state = times ]]; then zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=-- default=" [default exactly]" disp=( "+ $sep before (older files)" "- $sep since (newer files)" ) - smatch=( - + ) + smatch=( + - ) else disp=( before exactly since ) smatch=( + '' - ) diff --git a/Completion/Unix/Command/_fish b/Completion/Unix/Command/_fish new file mode 100644 index 000000000..08541bc83 --- /dev/null +++ b/Completion/Unix/Command/_fish @@ -0,0 +1,78 @@ +#compdef fish + +local MATCH MBEGIN MEND ret=1 +local -a args context line state state_descr +local -A opt_args + +args=( + # unlike most shells, fish's -c is a normal option-with-optarg which can be + # interleaved with other options and can even be given multiple times. + # obviously we can't complete command strings reliably here but we'll try + '(1)*'{-c+,--command=}'[execute specified command string]: :_cmdstring' + '*'{-C+,--init-command=}'[execute specified command before other input]: :_cmdstring' + '(-d --debug)'{-d+,--debug=}'[enable debug output for specified categories]: :->debug' + '(-o --debug-output)'{-o+,--debug-output=}'[specify debug output file]:debug output file:_files' + '(-f --features)'{-f+,--features=}'[enable specified feature flags]: :->feature' + '(-i --interactive)'{-i,--interactive}'[act as interactive shell]' + '(-l --login)'{-l,--login}'[act as login shell]' + '(-N --no-config)'{-N,--no-config}'[do not read configuration files]' + '(-n --no-execute)'{-n,--no-execute}'[check syntax only (do not execute commands)]' + '(-p --profile)'{-p+,--profile=}'[specify profile output file]:profile output file:_files' + '--profile-startup=[specify start-up profile output file]:profile output file:_files' + '(-P --private)'{-P,--private}'[enable private mode (no history)]' + '--print-rusage-self[output getrusage() stats on exit]' + '(- : *)--print-debug-categories[display debug categories]' + '(- : *)'{-v,--version}'[display version information]' + '(- : *)'{-h,--help}'[display usage information]' + '(-)1:script file:_files' + '(-)*:argument:_files' +) + +_arguments -s -S -A '-*' : $args && ret=0 + +case $state in + debug) + local -a tmp=( ${(f)"$( + _call_program debug-categories $words[1] --print-debug-categories + )"} ) + tmp=( ${${tmp/[[:space:]]##/\[}/%/\]} ) + tmp=( ${tmp/(#m)\[[A-Z][^A-Z]/${(L)MATCH}} ) + tmp=( ${tmp/.\]/\]} ) + _values -s, 'debug category' $tmp && ret=0 + ;; + + feature) + local name def ver desc + local -a flags_on flags_off versions flags tmp + + while IFS=$'\t ' read -r name def ver desc; do + desc=${${desc/#(#m)[A-Z][^A-Z]/${(L)MATCH}}//(#m)[]\\]/\\$MATCH} + if [[ $def == on ]]; then + flags_on+=( $name"[$desc ($ver, defaults on)]" ) + else + flags_off+=( $name"[$desc ($ver, defaults off)]" ) + fi + versions+=( $ver"[all features introduced in fish $ver]" ) + done < <( + _call_program feature-flags $words[1] -NPc '"status features"' + ) + + # if an individual flag is already on, show the no- variant, and vice versa + flags+=( no-$^flags_on $flags_off ) + # always show both for these 'groups' + flags+=( {no-,}all'[all features]' {no-,}${(u)versions} ) + + # only show redundant variants of individual flags when necessary + tmp=( no-$^flags_off ) + [[ ${PREFIX##*,} == n* ]] || tmp=( '!'$^tmp ) + flags+=( $tmp ) + + tmp=( ${(M)flags_on:#${${PREFIX##*,}[1]:----}*} ) + (( $#tmp )) || tmp=( '!'$^flags_on ) + flags+=( $tmp ) + + _values -s, 'feature flag' $flags && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_flac b/Completion/Unix/Command/_flac index 0197aaf92..d7f3e801c 100644 --- a/Completion/Unix/Command/_flac +++ b/Completion/Unix/Command/_flac @@ -67,7 +67,6 @@ case $service in - 'H' \ '(-)'{-v,--version}'[display version information]' \ '(-)'{-h,--help}'[display help information]' \ - '(-)'{-H,--explain}'[display detailed explanation of usage and options]' \ - encode \ '(-V --verify)'{-V,--verify}'[verify a correct encoding]' \ --lax --ignore-chunk-sizes '!--sector-align' --replay-gain \ @@ -88,6 +87,7 @@ case $service in '(-p --qlp-coeff-precision-search -q --qlp-coeff-precision)'{-q,--qlp-coeff-precision=}'[specify precision]:precision (bits)' \ '(-r --rice-partition-order)'{-r,--rice-partition-order=}'[set min/max residual partition order]:order' \ "--limit-min-bitrate[don't allow frames consisting of only constant subframes]" \ + '(-j --threads)'{-j+,--threads=}'[set number of encoding threads]:threads' \ '--endian=:byte order:(big little)' \ '--channels=:channels' \ '--bps=:bits per sample' \ @@ -102,6 +102,7 @@ case $service in '(-F --decode-through-errors)'{-F,--decode-through-errors}'[continue decoding through stream errors]' \ '--apply-replaygain-which-is-not-lossless=:specification' \ '--cue=[set the beginning and ending cuepoints to decode]:cue point' \ + '--decode-chained-stream[decode all links in a chained Ogg stream, not just the first one]' \ '(--force-raw-format --force-rf64-format --force-wave64-format --force-legacy-wave-format --force-extensible-wave-format --force-aiff-c-none-format --force-aiff-c-sowt-format)--force-aiff-format' \ '(--force-raw-format --force-aiff-format --force-wave64-format --force-legacy-wave-format --force-extensible-wave-format --force-aiff-c-none-format --force-aiff-c-sowt-format)--force-rf64-format' \ '(--force-raw-format --force-aiff-format --force-rf64-format --force-legacy-wave-format --force-extensible-wave-format --force-aiff-c-none-format --force-aiff-c-sowt-format)--force-wave64-format' \ @@ -112,6 +113,7 @@ case $service in ;; metaflac) _arguments -S $shared \ + '(-o --output-name)'{-o+,--output-name=}'[write changes to a new file]:file:_files' \ '(--no-filename)--with-filename[prefix output with filename]' \ '(--with-filename)--no-filename' \ '--dont-use-padding[always rewrite the file]' \ diff --git a/Completion/Unix/Command/_fsh b/Completion/Unix/Command/_fsh deleted file mode 100644 index c39373117..000000000 --- a/Completion/Unix/Command/_fsh +++ /dev/null @@ -1,22 +0,0 @@ -#compdef fsh - -local curcontext="$curcontext" state line ret=1 -local -a _comp_priv_prefix - -_arguments -C \ - '(- : *)'{-h,--help}'[display help information]' \ - '(- : *)'{-V,--version}'[display version information]' \ - '-r[specify method]:method:(rsh ssh)' \ - '-l[specify login id]:login:_users' \ - '(-T --timeout)'{-T,--timeout}':idle timeout:' \ - ':remote host name:_hosts' \ - '(-):command: _command_names -e' \ - '*::args:->command' && ret=0 - -if [[ -n "$state" ]]; then - shift 1 words - (( CURRENT-- )) - _normal && ret=0 -fi - -return ret diff --git a/Completion/Unix/Command/_fuser b/Completion/Unix/Command/_fuser index 05de1c529..90124ea30 100644 --- a/Completion/Unix/Command/_fuser +++ b/Completion/Unix/Command/_fuser @@ -69,9 +69,12 @@ case $variant in args+=( '-n[list only processes with non-blocking mandatory locks]' ) - ;; + ;| solaris2.<10->) args+=( '-d[report device usage for all minor nodes bound to same device]' ) + ;| + solaris2.<11->) + args+=( "-l[don't resolve symlinks to target file]" ) ;; sysv4 ) (( $+words[(r)-k] )) && argf=( ':name: _alternative signals\:signal\:_signals\ -p files:file:_files' ) diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc index d81f31cf5..cf1cf7efa 100644 --- a/Completion/Unix/Command/_gcc +++ b/Completion/Unix/Command/_gcc @@ -1,10 +1,18 @@ -#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++-* +#compdef gcc g++ cc c++ llvm-gcc llvm-g++ clang clang++ -value-,LDFLAGS,-default- -value-,CFLAGS,-default- -value-,CXXFLAGS,-default- -value-,CPPFLAGS,-default- -value-,CC,-default- -value-,CXX,-default- -P gcc-* -P g++-* -P c++-* local curcontext="$curcontext" state line ret=1 expl i local -a args args2 warnings arch typeset -A opt_args -if [[ "$service" = -value-* ]]; then +if [[ "$service" = -value-,CC,* ]]; then + _description compilers expl compiler + compadd "$expl[@]" -M 'r:|-=* r:|=*' -k 'commands[(I)(clang|([ig]|sun|open)cc(|<->|-devel)|icx)]' + return +elif [[ "$service" = -value-,CXX,* ]]; then + _description compilers expl compiler + compadd "$expl[@]" -M 'r:|-=* r:|=*' -k 'commands[(I)((clang|g)++(|<->|-devel)|(sun|open|)CC|icpx)]' + return +elif [[ "$service" = -value-* ]]; then compset -q words=( fake "$words[@]" ) (( CURRENT++ )) @@ -158,7 +166,7 @@ mips*) '-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]' + '-mips16[mips16]' '-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]' @@ -212,20 +220,20 @@ i[3456]86|x86_64) '-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]' + '-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]' + '-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]' + '-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]' + '-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]' @@ -337,7 +345,7 @@ i[3456]86|x86_64) '-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)' + '-mstringop-strategy=-[choose 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]' @@ -469,7 +477,7 @@ webassembly*) '-mexception-handling[exception handling]' '-mmultivalue[multivalue]' '-mmutable-globals[mutable globals]' - '-mnontrapping-fptoint[no ntrapping fptoint]' + '-mnontrapping-fptoint[nontrapping float-to-int conversion]' '-mreference-types[reference types]' '-msign-ext[sign ext]' '-msimd128[simd128]' @@ -528,11 +536,11 @@ if [[ "$service" = clang* ]]; then '-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-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=[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' @@ -577,9 +585,9 @@ if [[ "$service" = clang* ]]; then '-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]' + '-fast[fast]' + '-fastcp[fastcp]' + '-fastf[fastf]' '-fautolink[autolink]' '-fautomatic[automatic]' '-fauto-profile-accurate[auto profile accurate]' @@ -616,7 +624,6 @@ if [[ "$service" = clang* ]]; then '-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' @@ -654,7 +661,7 @@ if [[ "$service" = clang* ]]; then '-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-fixit-info[supply fixit info 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]' @@ -721,12 +728,12 @@ if [[ "$service" = clang* ]]; then '-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]' + '-fhip-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' + '-filelist[filelist]:arg' '-fimplicit-module-maps[implicit module maps]' '-fimplicit-modules[implicit modules]' '-fimplicit-none[no implicit typing allowed unless overridden by IMPLICIT statements]' @@ -931,7 +938,6 @@ if [[ "$service" = clang* ]]; then '-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' @@ -1016,7 +1022,7 @@ if [[ "$service" = clang* ]]; then '-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=[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]' @@ -1089,7 +1095,7 @@ if [[ "$service" = clang* ]]; then '-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-dir[module 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]' @@ -1225,13 +1231,13 @@ if [[ "$service" = clang* ]]; then '--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' + '--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]' + '-r[produce a relocatable object as output]' '--rtlib=[compiler runtime library to use]:arg' '-rtlib=[rtlib]:arg' '--save-stats=[save llvm statistics]:arg' @@ -1247,7 +1253,6 @@ if [[ "$service" = clang* ]]; then '-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' @@ -1302,9 +1307,9 @@ if [[ "$service" = clang* ]]; then '-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' + '-Xcuda-ptxas[pass arg to the ptxas assembler]:argument' '-Xflang[pass <arg> to the flang compiler]:arg' - '-Xopenmp-target[pass arg to the the target offloading toolchain]:argument' + '-Xopenmp-target[pass arg to the target offloading toolchain]:argument' '-y[the action to perform on the input]:arg' '-Z-[undocumented option]:argument' ) @@ -1390,7 +1395,7 @@ warnings+=( '-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]' + '-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]' @@ -1418,7 +1423,7 @@ warnings+=( '-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]' '-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]' @@ -1516,7 +1521,7 @@ warnings+=( '-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]' + '-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]' @@ -1553,7 +1558,7 @@ warnings+=( '-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-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]' @@ -1584,7 +1589,7 @@ warnings+=( '-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[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]' @@ -1697,6 +1702,7 @@ args+=( '-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]' + '-fcoroutines[enable support for C++ Coroutines]' '-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]' @@ -1750,7 +1756,7 @@ args+=( '-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]' + '-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]' @@ -1800,7 +1806,6 @@ args+=( '-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: ' @@ -1840,6 +1845,8 @@ args+=( '-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]' + '-foffload=[specify offloading targets]:target list' + '-foffload-options=:option list' '-fomit-frame-pointer[when possible do not generate stack frames]' '-fopenacc[enable OpenACC]' '-fopenmp[enable OpenMP (implies -frecursive in Fortran)]' @@ -1862,7 +1869,7 @@ args+=( '-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)]' + '-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]' @@ -1907,11 +1914,7 @@ args+=( '-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]' @@ -1942,14 +1945,13 @@ args+=( '-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-check=-[insert stack checking code into the program]: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]' @@ -1989,10 +1991,9 @@ args+=( '-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-lrs[perform live range splitting during the SSA->normal pass]' '-ftree-parallelize-loops=-[enable automatic parallelization of loops]:threads: ' - '-ftree-partial-pre[in SSA-PRE optimization on trees, enable partial- partial redundancy elimination]' + '-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]' @@ -2083,7 +2084,7 @@ args+=( '(-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,--no-line-commands}'[inhibit generation of linemarkers 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' @@ -2128,7 +2129,6 @@ args+=( '-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:' diff --git a/Completion/Unix/Command/_gcore b/Completion/Unix/Command/_gcore index ef3afd919..4e5041f3b 100644 --- a/Completion/Unix/Command/_gcore +++ b/Completion/Unix/Command/_gcore @@ -56,7 +56,7 @@ case $OSTYPE in '-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)' \ + '(-o)-c+[specify format of core file name]:format (%N\:program name, %U\:uid, %P\:pid, %T\:time stamp)' \ '1:pid:_pids' ;; *) diff --git a/Completion/Unix/Command/_ghostscript b/Completion/Unix/Command/_ghostscript index 2c6f40a35..021668c60 100644 --- a/Completion/Unix/Command/_ghostscript +++ b/Completion/Unix/Command/_ghostscript @@ -1,4 +1,4 @@ -#compdef gs ghostscript +#compdef gs ghostscript gsnd local -a specs names device diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index e9f72799c..c4ed3c3e9 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -70,6 +70,7 @@ _git-add () { '(-f --force)'{-f,--force}'[allow adding otherwise ignored files]' \ '(-i --interactive : -)'{-i,--interactive}'[add contents interactively to index]' \ '(-p --patch)'{-p,--patch}'[like -i but go directly into patch mode for specified files]' \ + "--no-auto-advance[don't advance to next file when selecting hunks interactively]" \ '(-U --unified)'{-U+,--unified=}'[generate diff with given lines of context]:number of lines' \ '--inter-hunk-context=[combine patch hunks closer than specified number of lines]:number of lines' \ '(-e --edit)'{-e,--edit}'[open diff against index in editor]' \ @@ -206,7 +207,8 @@ _git-archive () { _git-backfill() { _arguments -S \ '--min-batch-size=[specify minimum number of objects to request at a time]:number of objects' \ - '--sparse[only download objects at a path matching current sparse-checkout]' + '--sparse[only download objects at a path matching current sparse-checkout]' \ + '--no-include-edges[exclude blobs from boundary commits in the backfill]' } (( $+functions[_git-bisect] )) || @@ -515,6 +517,7 @@ _git-checkout () { "--ignore-other-worktrees[don't check if another worktree is using this branch]" \ '--recurse-submodules=-[control recursive updating of submodules]::checkout:__git_commits' \ '--no-overlay[remove files from index or working tree that are not in the tree-ish]' \ + "--no-auto-advance[don't advance to next file when selecting hunks interactively]" \ '(-q --quiet --progress)--no-progress[suppress progress reporting]' \ '--progress[force progress reporting]' \ '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \ @@ -555,7 +558,7 @@ _git-checkout () { elif [[ -n ${opt_args[(I)-b|-B|-t|--track|--orphan|--detach]} ]]; then _nothing - elif [[ -n $line[1] ]] && __git_is_treeish ${(Q)line[1]}; then + elif [[ -n $line[1] && $line[1] != (@|HEAD) ]] && __git_is_treeish ${(Q)line[1]}; then __git_ignore_line __git_tree_files ${PREFIX:-.} ${(Q)line[1]} && ret=0 else __git_ignore_line __git_modified_files && ret=0 @@ -696,7 +699,7 @@ _git-clone () { '(--single-branch)--no-single-branch[clone history leading up to each branch]' \ "--no-tags[don't clone any tags and make later fetches not follow them]" \ '--shallow-submodules[any cloned submodules will be shallow]' \ - '(--recursive --recurse-submodules)'{--recursive,--recurse-submodules}'=-[initialize submodules in the clone]::file:__git_files' \ + '(--recursive --recurse-submodules)'{--recursive,--recurse-submodules}'=-[initialize submodules in the clone]::file:_files' \ '--separate-git-dir[place .git dir outside worktree]:path to .git dir:_path_files -/' \ '--ref-format=[specify reference format to use]:format:(files reftable)' \ \*--server-option='[send specified string to the server when using protocol version 2]:option' \ @@ -1011,6 +1014,7 @@ _git-format-patch () { '--from=[add From: header to email headers]: :_email_addresses' \ '*--add-header=[add an arbitrary header to email headers]:header' \ '--cover-letter[generate a cover letter template]' \ + '(--cover-letter)--commit-list-format=[format commit list in the cover letter]:format:(short-log modern)' \ '--notes=[append notes for the commit after the three-dash line]:: :__git_notes_refs' \ '( --no-signature --signature-file)--signature=[add a signature]:signature' \ '(--signature --signature-file)--no-signature[do not add a signature]' \ @@ -1219,6 +1223,49 @@ _git-gui () { return ret } +(( $+functions[_git-history] )) || +_git-history() { + local curcontext=$curcontext ret=1 + local -a state line common + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*:: :->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + + commands=( + 'reword:rewrite commit message of specified commit' + 'split:interactively split up commit' + ) + + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + common=( + "--dry-run[don't update any references]" + '--update-refs=[control which references will be updates]:references [branches]:(branches head)' + ':commit:__git_commits' + ) + + case $line[1] in + reword) _arguments -S -s $endopt $common && ret=0 ;; + split) + _arguments -S -s $endopt $common \ + '*: :__git_ignore_line_inside_arguments __git_tree_files ${PREFIX:-.} ${(Q)line[1]}' && ret=0 + ;; + *) _default && ret=0 ;; + esac + ;; + esac + + return ret +} + (( $+functions[_git-init] )) || _git-init () { _arguments -S -s $endopt \ @@ -1300,7 +1347,8 @@ _git-log () { (( $+functions[_git-maintenance] )) || _git-maintenance() { - local curcontext="$curcontext" state state_descr line ret=1 + local curcontext="$curcontext" ret=1 + local -a state state_descr line args local -A opt_args _arguments -C \ @@ -1324,16 +1372,27 @@ _git-maintenance() { (option-or-argument) curcontext=${curcontext%:*}-$line[1]: case $line[1] in - (run) + run) _arguments -S $endopt \ '--auto[run tasks based on the state of the repository]' \ + '--detach[perform maintenance in the background]' \ '--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) + start) _arguments \ - '--scheduler=:scheduler:(auto crontab systemd-timer launchctl schtasks)' + '--scheduler=:scheduler:(auto crontab systemd-timer launchctl schtasks)' && ret=0 + ;; + unregister) + args=( '(-f --force)'{-f,--force}'[return success even if repository was not registered]' ) + ;& + register) + _arguments -S $endopt $args \ + '--config-file=[use given config file]:config file:_files' && ret=0 + ;; + stop) _message 'no more arguments' ;; + *) _default && ret=0 ;; esac ;; esac @@ -1591,6 +1650,7 @@ _git-range-diff () { '(--right-only)--left-only[only emit output related to the first range]' \ '(--left-only)--right-only[only emit output related to the second range]' \ '(--remerge-diff)--diff-merges=[specify diff format to be used for merge commits]:format [m]:(off none 1 first-parent separate c combined cc dense-combined r remerge m on)' \ + '--max-memory=[specify maximum memory for cost matrix]:memory [4G]' \ '(--diff-merges -p --patch -u)--remerge-diff[produce remerge-diff output for merge commits]' \ $diff_options \ '1:range 1:__git_commit_ranges' \ @@ -1638,6 +1698,7 @@ _git-rebase () { "(--autostash --no-autostash)--no-autostash[don't stash uncommitted changes before rebasing and apply them afterwards]" \ '(--root)--fork-point[use merge-base --fork-point to refine upstream]' \ '--signoff[add Signed-off-by: trailer to the commit message]' \ + '(--force-rebase)*--trailer=[add custom trailer to every rebased commit]:trailer:__git_trailers_tokens' \ '--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' \ "(--apply --whitespace -C)--reschedule-failed-exec[automatically re-schedule any 'exec' that fails]" \ @@ -1661,6 +1722,7 @@ _git-reset () { '(--soft --mixed --hard --merge -p --patch -U --unified --inter-hunk-context -- *)--keep[like --hard, but keep local working tree changes]' \ '--recurse-submodules=-[control recursive updating of submodules]::reset:__git_commits' \ '(-p --patch --soft --mixed -N --intent-to-add --hard --merge --keep)'{-p,--patch}'[select diff hunks to remove from the index]' \ + "--no-auto-advance[don't advance to next file when selecting hunks interactively]" \ '(-U --unified --soft --mixed -N --intent-to-add --hard --merge --keep)'{-U+,--unified=}'[generate diff with given lines of context]:number of lines' \ '(--soft --mixed -N --intent-to-add --hard --merge --keep)--inter-hunk-context=[combine patch hunks closer than specified number of lines]:number of lines' \ '(-N --intent-to-add --soft --mixed --hard --merge --keep -p --patch -U --unified --inter-hunk-context -- *)'{-N,--intent-to-add}'[record only the fact that removed paths will be added later]' \ @@ -1903,6 +1965,7 @@ _git-sparse-checkout() { 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' check-rules:'check whether sparsity rules match one or more paths' + clean:'remove files outside of the sparse-checkout definition' ) _describe -t commands command commands && ret=0 @@ -1910,7 +1973,7 @@ _git-sparse-checkout() { (option-or-argument) curcontext=${curcontext%:*}-$line[1]: case $line[1] in - init) + init|reapply) _arguments \ '--cone[allow for better performance with a limited set of patterns]' \ '--no-sparse-index[rewrite index to not be sparse]' && ret=0 @@ -1929,6 +1992,12 @@ _git-sparse-checkout() { '--cone[interpret rules file patterns as cone mode patterns]' \ '--rules-file=[use patterns in specified file]:file:_files' && ret=0 ;; + clean) + _arguments \ + '(-f --force)'{-f,--force}'[remove files]' \ + '--dry-run[list the directories that would be removed without deleting them]' \ + '--verbose[list every file considered for removal]' + ;; esac ;; esac @@ -1940,7 +2009,7 @@ _git-sparse-checkout() { _git-stash () { local curcontext=$curcontext state line ret=1 declare -A opt_args - local -a save_arguments + local -a save_arguments args save_arguments=( '(-p --patch -a --all -u --include-untracked)'{-p,--patch}'[interactively select hunks from diff between HEAD and working tree to stash]' @@ -2017,8 +2086,9 @@ _git-stash () { '(-u --include-untracked)--only-untracked[show only the untracked files in the stash entry as part of the diff]' \ ':: :__git_stashes' && ret=0 ;; - (pop|apply) - _arguments -S $endopt \ + apply) args=( '--label-'{ours,theirs,base}'=:label' ) ;& + pop) + _arguments -S $endopt $args \ '--index[try to reinstate the changes added to the index as well]' \ '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ ':: :__git_stashes' && ret=0 @@ -2237,12 +2307,16 @@ _git-submodule () { _git-subtree () { local curcontext="$curcontext" state state_descr line ret=1 declare -A opt_args + local -a common=( + '(-q --quiet)'{-q,--quiet}'[suppress progress output]' + '(-d --debug)'{-d,--debug}'[show debug messages]' + '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' + '(-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]" + ) # TODO: -P should only complete paths inside the current repository. - _arguments -C \ - '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ - '(-d --debug)'{-d,--debug}'[show debug messages]' \ + _arguments -C $common \ ': :->command' \ '*::: := ->option-or-argument' && ret=0 @@ -2263,7 +2337,7 @@ _git-subtree () { curcontext=${curcontext%:*}-$line[1]: case $line[1] in (add) - _arguments \ + _arguments $common \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ @@ -2276,35 +2350,27 @@ _git-subtree () { # __git_ref_specs. ;; (merge) - _arguments -S \ - '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + _arguments -S $common \ '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ '--squash[import only a single commit from the subproject]' \ ': :__git_references' && ret=0 ;; (pull) - _arguments -S \ - '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + _arguments -S $common \ '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ '--squash[import only a single commit from the subproject]' \ ': :__git_any_repositories' \ ':: :__git_ref_specs' && ret=0 ;; (push) - _arguments -S \ - '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + _arguments -S $common \ '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ ': :__git_any_repositories' \ ':: :__git_ref_specs' && ret=0 ;; (split) - _arguments -S \ + _arguments -S $common \ '--annotate[add a prefix to commit message of new commits]:prefix' \ - '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P+,--prefix=}'[specify path to the subtree in the repository to manipulate]: :_directories' \ '(-b --branch)'{-b,--branch=}'[create a new branch]' \ '--onto=[try connecting new tree to an existing one]: :__git_ref_specs' \ '(-m --message)'{-m+,--message=}'[specify commit message for the merge]:message' \ @@ -2472,12 +2538,12 @@ _git-worktree() { _arguments -s -S $endopt \ '(-n --dry-run)'{-n,--dry-run}"[don't remove, show only]" \ '(-v --verbose)'{-v,--verbose}'[report pruned objects]' \ - '--expire=[expire objects older than specified time]: :_git_approxidates' && ret=0 + '--expire=[prune missing working trees older than specified time]: :_git_approxidates' && ret=0 ;; (list) _arguments -S $endopt \ '(-v --verbose --porcelain -z)'{-v,--verbose}'[output additional information about worktrees]' \ - "--expire=[add 'prunable' annotation to worktrees older than specified time]: :_git_approxidates" \ + "--expire=[add 'prunable' annotation to missing worktrees older than specified time]: :_git_approxidates" \ '(-v)--porcelain[machine-readable output]' \ '(-v)-z[terminate each line with a NUL rather than a newline]' && ret=0 ;; @@ -2527,56 +2593,71 @@ _tig () { (( $+functions[_git-config] )) || _git-config () { + local curcontext="$curcontext" ret=1 + local -a state state_descr line + local -a location filter display type include default comment + local -A opt_args local name_arg value_arg - local curcontext=$curcontext state line ret=1 - declare -A opt_args if (( words[(I)--get-regexp] )); then name_arg=':name regex' - elif (( words[(I)--get-colorbool] )); then - name_arg=':: :->is-a-tty' elif (( words[(I)--get-color] )); then name_arg='::default' elif (( words[(I)--remove-section|--rename-section] )); then - name_arg=': :->section' + name_arg=': : __git_config_sections -b "(|)" "^" section-names "section name"' elif (( words[(I)--get|--get-all] )); then - name_arg=': :->gettable-option' + name_arg=': :->gettable-options' else - name_arg=': :->option' + name_arg=': :->commands-options' fi if (( words[(I)--rename-section] )); then - value_arg=': :->section' + value_arg=': : __git_config_sections -b "(|)" "^" section-names "section name"' else - value_arg=': :->value' + value_arg='*::: := ->values' fi - _arguments -C -S -s $endopt \ - '( --system --local --worktree -f --file --blob)--global[use user-global config file]' \ - '(--global --local --worktree -f --file --blob)--system[use system-wide config file]' \ - '(--global --system --worktree -f --file --blob)--local[use local config file]' \ - '(--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 --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-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' \ - '--comment=[specify human-readable comment string]:comment' \ + location=( + '(--system --local --worktree -f --file --blob)--global[use user-global config file]' + '(--global --local --worktree -f --file --blob)--system[use system-wide config file]' + '(--global --system --worktree -f --file --blob)--local[use local config file]' + '(--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' + ) + filter=( + '--fixed-value[use string equality when comparing values]' + ) + display=( + '(-z --null)'{-z,--null}'[end values with NUL and newline between key and value]' + '(--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]' + '(--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)]' + '--show-names[show config keys in addition to their values]' + ) + type=( + '(-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]' + ) + include=( + '(--includes)'--no-includes"[don't respect \"include.*\" directives]" + '(--no-includes)'--includes'[respect "include.*" directives in config files when looking up values]' + ) + default=( + '(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' + ) + comment=( + '--comment=[specify human-readable comment string]:comment' + ) + + _arguments -C -S -s $endopt $location $filter $display $type $include $default \ $name_arg \ $value_arg \ - '::value regex' \ - '(actions)' \ '(2 --name-only)--get[get the first matching value of the key]' \ '(2 --name-only)--get-all[get all matching values of the key]' \ @@ -2590,25 +2671,79 @@ _git-config () { '(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 + '(2 3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--get-color[find color setting]: :->gettable-color-options' \ + '(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-options:stdout is tty:(true false auto)' && ret=0 + + filter+=( + '--all[return all values for multi-valued config options]' + '--value=[show config with values matching the pattern]:pattern' + ) + + case $state/$line[1] in + values/(list|get|set|unset|re(name|move)-section|edit)) + curcontext=${curcontext%:*}-$line[1]: + ;| + values/list) + _arguments $location $display $type $include && ret=0 + ;; + values/get) + _arguments $location $display $type $filter $include $default \ + '--regexp[interpret the name as a regular expression]' \ + '--url=[show config matching the given URL]:url:_urls' && ret=0 + ;; + values/set) + _arguments $location $type $filter $comment \ + '--append[add a new line without altering any existing values]' && ret=0 + ;; + values/unset) + _arguments $location $type $filter && ret=0 + ;; + values/rename-section) + _arguments $location \ + ': : __git_config_sections -b "(|)" "^" section-names "old section name"' \ + ': : __git_config_sections -b "(|)" "^" section-names "new name"' && ret=0 + ;; + values/remove-section) + _arguments $location \ + ': : __git_config_sections -b "(|)" "^" section-names "section"' && ret=0 + ;; + values/edit) + _arguments $location && ret=0 + ;; + commands-options/*) + _alternative \ + 'commands:command:(( + list:"list variables along with their values" + get:"emit the value for the specified key" + set:"set value for one or more config options" + unset:"remove value for one or more config options" + rename-section:"rename given section to a new name" + remove-section:"remove given section from the configuration file" + edit:"open editor to modify specified config file" + ))' \ + 'option-names: : __git_config_option-or-value' && ret=0 + ;; + *) + __git_config_option-or-value "$@" && ret=0 + ;; + esac + return ret } (( $+functions[__git_config_option] )) || __git_config_option () { - local -A opt_args=() + local -A opt_args local -a line=( ${words[CURRENT]%%=*} ) - local state=option + local state=options __git_config_option-or-value "$@" } (( $+functions[__git_config_value] )) || __git_config_value () { - local -A opt_args=() + local -A opt_args local -a line=( ${words[CURRENT]%%=*} ${words[CURRENT]#*=} ) - local state=value + local state=values __git_config_option-or-value "$@" } @@ -2810,7 +2945,7 @@ __git_config_option-or-value () { 'diff.*.textconv:command to generate the text-converted version of a file::_cmdstring' 'diff.*.wordregex:regular expression that the diff driver should use to split words in a line:regular expression:->string' '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.algorithm:"default diff algorithm::_git_diff_algorithms" 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" @@ -3292,18 +3427,7 @@ __git_config_option-or-value () { } case $state in - (section) - __git_config_sections -b '(|)' '^' section-names 'section name' $* && ret=0 - ;; - (is-a-tty) - declare -a values - values=( - true - false - auto) - _describe -t values 'stdout is a tty' values && ret=0 - ;; - (option) + (commands-|)options) local label=option declare -a sections sections_and_options options @@ -3522,16 +3646,16 @@ __git_config_option-or-value () { sections_and_options -M 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' -qS . -- \ options -M 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' "$@" && ret=0 ;; - (gettable-option) + (gettable-options) _wanted git-options expl option compadd -M 'r:|.=* r:|=*' -a - git_present_options && ret=0 ;; - (gettable-colorbool-option) + (gettable-colorbool-options) __git_config_sections -b '(|)' -a '(|)' '^color\.[^.]+$' gettable-colorbool-options option && ret=0 ;; - (gettable-color-option) + (gettable-color-options) __git_config_sections -b '(|)' -a '(|)' '^color\.[^.]+\..*$' gettable-color-options option && ret=0 ;; - (value) + (values) local current=${${(0)"$(_call_program current "git config $opt_args[(I)--system|--global|--local]" ${(kv)opt_args[(I)-f|--file]} "-z --get ${(q)line[1]}")"}#*$'\n'} case $line[1] in (alias.*) @@ -3689,14 +3813,6 @@ __git_config_option-or-value () { __git_guard_number 'number of days' fi ;; - (diff.algorithm) - __git_config_values -- "$current" "$parts[5]" \ - default:'basic greedy diff algorithm' \ - myers:'basic greedy diff algorithm' \ - minimal:'spend extra time to make sure the smallest possible diff is produced' \ - patience:'generate diffs with patience algorithm' \ - histogram:'generate diffs with histogram algorithm' && ret=0 - ;; (diff.renames) __git_config_booleans "$current" "$parts[5]" "$parts[2]" \ {copies,copy}:'try to detect both renames and copies' && ret=0 @@ -4072,6 +4188,7 @@ _git-reflog () { 'show:show log of ref' 'drop:remove reflog for specified references' 'exists:check whether a ref has a reflog' + 'write:write reflog entry for a reference' ) _alternative \ @@ -4114,7 +4231,10 @@ _git-reflog () { ;; (exists) __git_references && ret=0 - ;; + ;; + write) + _arguments ': :__git_references' ':old oid' ':new oid' ':message' && ret=0 + ;; esac esac @@ -4138,6 +4258,9 @@ _git-refs() { commands=( 'migrate:migrate ref store between different formats' 'verify:verify reference database consistency' + 'list:list references in the repository, alias for git-for-each-ref' + 'exists:check whether given reference exists' + 'optimize:optimize references to improve repository performance, alias for git-pack-refs' ) _describe -t commands command commands && ret=0 @@ -4157,6 +4280,9 @@ _git-refs() { '--strict[enable stricter error checking]' \ '--verbose[when verifying the reference database consistency, be chatty]' && ret=0 ;; + list) _git-for-each-ref && ret=0 ;; + exists) __git_references && ret=0 ;; + optimize) _git-pack-refs && ret=0 ;; *) _default && ret=0 ;; esac ;; @@ -4303,7 +4429,8 @@ _git-repack () { '--pack-kept-objects[repack objects in packs marked with .keep]' \ '--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]' \ + '(--write-midx)-m[write a multi-pack index of the resulting packs]' \ + '(-m)--write-midx=-[write a multi-pack index of the resulting packs]:mode:(default incremental)' \ '--expire-to=[pack prefix to store a pack containing pruned objects]:directory:_directories' \ '--filter-to=[pack prefix to store a pack containing filtered out objects]:directory:_directories' } @@ -4363,6 +4490,7 @@ _git-blame () { '(-n --show-number)'{-n,--show-number}'[show the line number in the original commit]' \ '-s[suppress author name and timestamp]' \ '-w[ignore whitespace when finding lines]' \ + '--diff-algorithm=[choose a diff algorithm to use when computing blame]: :_git_diff_algorithms' \ '--ignore-rev=[ignore specified revision when blaming]:revision:__git_revisions' \ '--ignore-revs-file=[ignore revisions from file]:file:_files' \ '(--color-by-age)--color-lines[color redundant metadata from previous line differently]' \ @@ -4461,11 +4589,34 @@ _git-fsck () { '*: :__git_objects' } +(( $+functions[_git-format-rev] )) || +_git-format-rev() { + _arguments -S $endopt \ + '--format=[specify format]:format:__git_format_placeholders' \ + '--stdin-mode=[specify stdin mode]:mode:(revs text)' \ + '--notes=[display notes for pretty format]:reference' \ + '(-z --null --null-input --null-output)'{-z,--null}'[use NUL for input and output termination]' \ + '(-z --null)--null-input[use NUL for input termination]' \ + '(-z --null)--null-output[use NUL for output termination]' +} + (( $+functions[_git-get-tar-commit-id] )) || _git-get-tar-commit-id () { _message 'no arguments allowed; accepts tar-file on standard input' } +(( $+functions[_git-last-modified] )) || +_git-last-modified() { + _arguments -s \ + '(-r --recursive)'{-r,--recursive}'[recurse into subtrees]' \ + '(-t --show-trees)'{-t,--show-trees}'[show tree entries when recursing into subtrees]' \ + '--max-depth=[specify maximum tree depth to recurse]:depth [0]' \ + '-z[separate lines with NUL character]' \ + '1: :__git_commit_ranges' \ + \!--{,end-of-options}':*: :__git_tree_files ${PREFIX:-.} HEAD' \ + '*: :__git_tree_files ${PREFIX:-.} $line[1]' +} + (( $+functions[_git-help] )) || _git-help () { _arguments -S -s \ @@ -4841,10 +4992,14 @@ _git-send-email () { '--smtp-server-port=[specify port to connect to SMTP server on]:smtp port:_ports' \ '--smtp-server-option=[specify the outgoing SMTP server option to use]:SMTP server option' \ '--smtp-ssl-cert-path=[path to ca-certificates (directory or file)]:ca certificates path:_files' \ + '--smtp-ssl-client-cert=[path to client certificate file]: :_files' \ + '--smtp-ssl-client-key=[path to the private key file for the client certificate]: :_files' \ '--smtp-user=[specify user to use for SMTP-AUTH]:smtp user:_users' \ '(--no-smtp-auth)--smtp-auth=[specify allowed AUTH mechanisms]:space-separated list of mechanisms' \ '(--smtp-auth)--no-smtp-auth[disable SMTP authentication]' \ '--smtp-debug=[enable or disable debug output]:smtp debug:((0\:"disable" 1\:"enable"))' \ + '--imap-sent-folder=[IMAP folder where a copy of the emails should be sent]:IMAP folder' \ + '--use-imap-only[only copy emails instead of actually sending them]' \ '--batch-size=[specify maximum number of messages per connection]:number' \ '--relogin-delay=[specify delay between successive logins]:delay (seconds)' \ '--cc-cmd=[specify command to generate Cc\: header with]:Cc\: command:_cmdstring' \ @@ -5328,11 +5483,7 @@ _git-merge-file () { '( --theirs --union)--ours[resolve conflicts favoring our side of the lines]' \ '(--ours --union)--theirs[resolve conflicts favoring their side of the lines]' \ '(--ours --theirs )--union[resolve conflicts favoring both sides of the lines]' \ - '--diff-algorithm=[choose a diff algorithm]:diff algorithm:((default\:"basic greedy diff algorithm" - myers\:"basic greedy diff algorithm" - minimal\:"spend extra time to make sure the smallest possible diff is produced" - patience\:"generate diffs with patience algorithm" - histogram\:"generate diffs with histogram algorithm"))' \ + '--diff-algorithm=[choose a diff algorithm]: :_git_diff_algorithms' \ '--marker-size[specify length of conflict markers]: :__git_guard_number "marker length"' \ '--object-id[use object IDs instead of filenames]' \ '(--zdiff3)--diff3[show conflicts in "diff3" style]' \ @@ -5374,13 +5525,20 @@ _git-mktree () { (( $+functions[_git-multi-pack-index] )) || _git-multi-pack-index() { - _arguments \ + _arguments -S \ '--object-dir=[specify location of git objects]:directory:_directories' \ '(--progress)--no-progress[turn progress off]' '!(--no-progress)--progress' \ + '--preferred-pack=[break ties in favor of specified pack]:pack' \ + '--bitmap[write a multi-pack bitmap]' \ '--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' \ + '--incremental[write an incremental MIDX file]' \ '--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)' + "--write-chain-file[write new MIDX layer but don't update multi-pack-index-chain file]" \ + '--base=[specify checksum of MIDX layer to use as base]:checksum' \ + '1:verb:(write compact verify expire repack)' \ + '2:from (checksum)' \ + '3:to (checksum)' } (( $+functions[_git-pack-objects] )) || @@ -5494,6 +5652,21 @@ _git-read-tree () { '3::third tree-ish to be read/merged:__git_tree_ishs' } +(( $+functions[_git-replay] )) || +_git-replay() { + _arguments -S $endopt \ + '(--advance --revert)--contained[update all branches that point to commits in given range]' \ + '(--advance --revert)--onto=[replay onto given commit]: :__git_revisions' \ + '(--onto --revert)--advance=[advance given branch]: :__git_branches' \ + '(--onto --advance)--revert=[revert commits onto given branch]: :__git_branches' \ + '--ref=[specify reference to update with result]: :__git_ref_specs' \ + '--ref-action=[control ref update behavior]:behavior:(( + update\:"update directly using atomic transaction" + print\:"output update-ref commands for pipeline use" + ))' \ + ':revision range:__git_commit_ranges' +} + (( $+functions[_git-symbolic-ref] )) || _git-symbolic-ref () { _arguments -S -s \ @@ -6280,7 +6453,11 @@ _git-hook() { _arguments $args \ '--ignore-missing[ignore any missing hook by quietly returning zero]' \ "--to-stdin=[specify file which will be redirected to hook's stdin]:file:_files" \ - '1:subcommand:(run)' \ + '--allow-unknown-hook-name' \ + '-z[terminate output lines with NUL instead of newlines]' \ + '--show-scope[prefix each hook name with a config scope]' \ + '(-j --jobs)'{-j+,--jobs=}'[allow specified number of simultaneous hooks]:jobs' \ + '1:subcommand:(run list)' \ '2:hook name:compadd $gitdir/hooks/*(x\:t)' } @@ -6337,6 +6514,13 @@ _git-stripspace () { '(-c --comment-lines -s --strip-comments)'{-c,--comment-lines}'[prepend comment character and blank to each line]' } +(( $+functions[_git-url-parse] )) || +_git-url-parse() { + _arguments -S $endopt \ + '(-c --component)'{-c+,--component=}'[specific URL component]:component:(scheme user password host port path)' \ + '*: :_guard "^-*" url' +} + # INTERNAL GIT COMPLETION FUNCTIONS # Generic Helpers @@ -6523,6 +6707,7 @@ _git_commands () { gc:'cleanup unnecessary files and optimize local repository' grep:'print lines matching a pattern' gui:'run portable graphical interface to git' + history:'rewrite history' init:'create empty git repository or re-initialize an existing one' log:'show commit logs' maintenance:'run tasks to optimize Git repository data' @@ -6533,7 +6718,7 @@ _git_commands () { push:'update remote refs along with associated objects' range-diff:'compare two commit ranges' rebase:'forward-port local commits to the updated upstream head' - reset:'reset current HEAD to specified state' + reset:'reset HEAD or the index to a known state' restore:'restore working tree files' revert:'revert existing commits' rm:'remove files from the working tree and from the index' @@ -6545,7 +6730,7 @@ _git_commands () { submodule:'initialize, update, or inspect submodules' subtree:'split repository into subtrees and merge them' switch:'switch branches' - tag:'create, list, delete or verify tag object signed with GPG' + tag:'create, list, delete or verify tags' worktree:'manage multiple working dirs attached to the same repository' ) ancillary_manipulator_commands=( @@ -6606,6 +6791,7 @@ _git_commands () { pack-objects:'create packed archive of objects' prune-packed:'remove extra objects that are already in pack files' read-tree:'read tree information into directory index' + replay:'replay commits on a new base, works with bare repos too' symbolic-ref:'read and modify symbolic references' unpack-objects:'unpack objects from packed archive' update-index:'register file contents in the working directory to the index' @@ -6621,13 +6807,16 @@ _git_commands () { 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' + format-rev:'pretty format revisions from stdin' get-tar-commit-id:'extract commit ID from an archive created using git archive' + last-modified:'show when files were last modified' ls-files:'information about files in index/working directory' ls-remote:'show references in a remote repository' ls-tree:'list contents of a tree object' merge-base:'find as good a common ancestor as possible for a merge' name-rev:'find symbolic names for given revisions' pack-redundant:'find redundant pack files' + repo:'retrieve information about repository' rev-list:'list commit object in reverse chronological order' rev-parse:'pick out and massage parameters for other git commands' show-index:'show packed archive index' @@ -6663,8 +6852,10 @@ _git_commands () { mailinfo:'extract patch and authorship from a single email message' mailsplit:'split mbox file into a list of files' merge-one-file:'standard helper-program to use with git merge-index' - patch-id:'compute unique ID for a patch' - stripspace:'filter out empty lines') + patch-id:'compute unique ID for patches' + stripspace:'filter out empty lines' + url-parse:'parse and extract git URL components' + ) zstyle -a :completion:$curcontext: user-commands user_commands @@ -6779,6 +6970,17 @@ __git_date_formats () { _describe -t date-formats 'date format' date_formats -- '( format\:custom\ format )' -S : } +(( $+functions[_git_diff_algorithms] )) || +_git_diff_algorithms() { + _describe -t diff-algorithms 'diff algorithm' '( + default\:"basic greedy diff algorithm" + myers\:"basic greedy diff algorithm" + minimal\:"spend extra time to produce smallest possible diff" + patience\:"generate diffs with patience algorithm" + histogram\:"generate diffs with histogram algorithm" + )' +} + (( $+functions[_git_diff_filters] )) || _git_diff_filters() { local sep @@ -6849,7 +7051,7 @@ _git_strategy_options() { renormalize no-renormalize \ 'find-renames::similarity threshold' \ subtree:path \ - 'diff-algorithm:algorithm:(patience minimal histogram myers)' + 'diff-algorithm:algorithm:_git_diff_algorithms' } (( $+functions[__git_encodings] )) || @@ -8172,11 +8374,7 @@ __git_setup_diff_options () { '(--minimal --patience --histogram --diff-algorithm)--patience[generate diffs with patience algorithm]' '(--minimal --patience --histogram --diff-algorithm)--histogram[generate diffs with histogram algorithm]' '(--minimal --patience --histogram --diff-algorithm)*--anchored=[generate diffs using the "anchored diff" algorithm]:text' - '(--minimal --patience --histogram --diff-algorithm)--diff-algorithm=[choose a diff algorithm]:diff algorithm:((default\:"basic greedy diff algorithm" - myers\:"basic greedy diff algorithm" - minimal\:"spend extra time to make sure the smallest possible diff is produced" - patience\:"generate diffs with patience algorithm" - histogram\:"generate diffs with histogram algorithm"))' + '(--minimal --patience --histogram --diff-algorithm)--diff-algorithm=[choose a diff algorithm]: :_git_diff_algorithms' \ '--stat=-[generate diffstat instead of patch]:: :__git_guard_diff-stat-width' '--stat-width=-[generate diffstat with a given width]:width' '--stat-graph-width=-[generate diffstat with a given graph width]:width' @@ -8208,6 +8406,7 @@ __git_setup_diff_options () { "(--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" + '--max-depth=[specify maximum tree depth to recurse]:depth' '--no-renames[turn off rename detection]' $exclusive_diff_options'--check[warn if changes introduce trailing whitespace or space/tab indents]' '--full-index[show full object name of pre- and post-image blob]' @@ -8225,7 +8424,7 @@ __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' - '--pickaxe-all[when -S finds a change, show all changes in that changeset]' + '--pickaxe-all[when -G or -S find 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' @@ -8301,7 +8500,7 @@ __git_format_placeholders() { _alternative \ 'formats:: _describe -t formats "built-in format" builtin_fmts' \ 'user-formats:: _describe -t user-formats "user format" user_fmts' \ - 'custom-formats:: _describe -t custom-formats "custom format" custom_fmts -qS:' \ + 'custom-formats:: _describe -t custom-formats "custom format" custom_fmts -r: -S:' \ && return # @todo: still unsupported: more complicated place-holders like %C() and @@ -8558,11 +8757,13 @@ __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 ref]:reference' \ - '--deepen[deepen history of shallow clone]:number of commits' \ + '--shallow-since=[deepen history of shallow repository based on time]:time' + '*--shallow-exclude=[deepen history of shallow clone by excluding ref]:reference' + '--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' \ + '--negotiation-restrict=[only report refs reachable from specified object to the server]:commit:__git_commits' + '!--negotiation-tip=:commit:__git_commits' + '--negotiation-include=[report given commit as "have" in negotiation]:commit:__git_commits' ) } diff --git a/Completion/Unix/Command/_gnutls b/Completion/Unix/Command/_gnutls index 4c1698857..c62269afc 100644 --- a/Completion/Unix/Command/_gnutls +++ b/Completion/Unix/Command/_gnutls @@ -182,7 +182,8 @@ case "$service" in '--cprint[prints certain information is C-friendly format]' '--null-password[enforce a NULL password]' '--empty-password[enforce an empty password]' - '--key-type=[specify the key type to use on key generation]:key type' + '--key-type=[specify key type to use on key generation]:key type' + '--key-format=[specify key format to use on key generation]:key format:(seed expanded both)' '(-i --certificate-info)'{-i,--certificate-info}'[print information on a certificate]' '(-l --crl-info)'{-l,--crl-info}'[print information on a CRL]' '--crq-info[print information on a certificate request]' diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg index ea0a452f2..d704af92f 100644 --- a/Completion/Unix/Command/_gpg +++ b/Completion/Unix/Command/_gpg @@ -95,7 +95,6 @@ fi '(--encrypt-to)--no-encrypt-to[disable the use of all --encrypt-to keys]' '--group[set up email aliases]:spec' '-z[specify compression level]:compression level:((0\:no\ compression 1\:minimum 2 3 4 5 6\:default 7 8 9\:maximum))' - '(-t --textmode)'{-t,--textmode}'[use canonical text mode]' '(-n --dry-run)'{-n,--dry-run}"[don't make any changes]" '(-i --interactive --batch)'{-i,--interactive}'[prompt before overwriting files]' '(-i --interactive --no-batch)--batch[use batch mode]' diff --git a/Completion/Unix/Command/_gphoto2 b/Completion/Unix/Command/_gphoto2 index 788c9702f..4ff5ce1c1 100644 --- a/Completion/Unix/Command/_gphoto2 +++ b/Completion/Unix/Command/_gphoto2 @@ -11,6 +11,7 @@ _arguments -s -C \ '--debug-loglevel=[set debug level]:debug level:(error debug data all)' \ '--debug-logfile=[name of file to write debug info to]:file:_files' \ '(-q --quiet)'{-q,--quiet}'[quiet output]' \ + '(-q --quiet)--parsable[simple parsable output]' \ '--hook-script=[hook script to call after downloads, captures, etc.]:file:_files' \ '--stdout[send file to stdout]' \ '--stdout-size[print filesize before data]' \ @@ -41,8 +42,8 @@ _arguments -s -C \ '--keep[keep images on camera after capturing]' \ '--keep-raw[keep the RAW images on the camera with --capture-image-and-download]' \ '--no-keep[remove images from camera after capturing]' \ - '--wait-event=-[wait for event from camera]::count' \ - '--wait-event-and-download=-[wait for event from camera and download new images]::count' \ + '--wait-event=-[wait for event from camera]:: :_numbers -u events -d forever wait\ time s\:seconds ms\:milliseconds' \ + '--wait-event-and-download=-[wait for event from camera and download new images]:: :_numbers -u events -d forever wait\ time s\:seconds ms\:milliseconds' \ '--capture-preview[capture a quick preview]' \ '--show-preview[capture a quick preview and display using ASCII art]' \ '(-B --bulb)'{-B,--bulb=}'[set bulb exposure time]:exposure time (seconds)' \ @@ -54,7 +55,7 @@ _arguments -s -C \ '--capture-image-and-download[capture an image and download it]' \ '--capture-movie=-[capture a movie]:count or seconds' \ '--capture-sound[capture an audio clip]' \ - '--capture-tethered=-[wait for shutter release on the camera and download]::count' \ + '--capture-tethered=-[wait for shutter release on the camera and download]:: :_numbers -u events wait\ time s\:seconds ms\:milliseconds' \ '(-l --list-folders)'{-l,--list-folders}'[list folders in folder]' \ '(-L --list-files)'{-L,--list-files}'[list files in folder]' \ '(-m --mkdir)'{-m,--mkdir=}'[create a directory]:directory' \ @@ -71,13 +72,17 @@ _arguments -s -C \ '--get-all-raw-data[get all raw data from folder]' \ '--get-audio-data=[get audio data given in range]:range' \ '--get-all-audio-data[get all audio data from folder]' \ + '--get-exif=[get files in given range]:range' \ + '--get-all-exif[get all files from folder]' \ '(-d --delete-file)'{-d,--delete-file=}'[delete files in given range]:range' \ '(-D --delete-all-files)'{-D,--delete-all-files}'[delete all files in folder]' \ '(-u --upload-file)'{-u,--upload-file=}'[upload a file to camera]:file:_files' \ '--filename=[specify pattern to save file as]:pattern:_date_formats' \ + '--filenumber=[specify the number %n in the filename pattern starts at]:starting number [1]' \ '(-f --folder)'{-f,--folder=}'[specify camera folder]:folder [/]' \ '(-R --recurse --no-recurse)'{-R,--recurse}'[recursion (default for download)]' \ '(-R --recurse)--no-recurse[no recursion (default for deletion)]' \ + '--reverse[reverse order of file operations]' \ '--new[process new files only]' \ '--force-overwrite[overwrite files without asking]' \ '--skip-existing[skip files that already exist on local filesystem]' && ret=0 diff --git a/Completion/Unix/Command/_hardlink b/Completion/Unix/Command/_hardlink new file mode 100644 index 000000000..8a62779aa --- /dev/null +++ b/Completion/Unix/Command/_hardlink @@ -0,0 +1,43 @@ +#compdef hardlink + +local ign +local -a args + +(( $#words > 2 )) && ign='!(- *)' + +if _pick_variant linux=util-linux jak -V; then + args=( + '(-c --content -p --ignore-mode -o --ignore-owner -t --ignore-time)'{-c,--content}'[compare only file contents, same as -pot]' + '(-b --io-size)'{-b+,--io-size=}'[specify I/O buffer size for file reading]: :_numbers "IO buffer size" K M G T P' + '(-d --respect-dir)'{-d,--respect-dir}'[directory names have to be identical]' + '(-F --prioritize-trees)'{-F,--prioritize-trees}'[keep files found in the earliest specified top-level]' + '(-l --list-duplicates)'{-l,--list-duplicates}"[just list paths of duplicates, don't link them]" + '--mount[stay within the same filesystem]' + '(-q --quiet)'{-q,--quiet}"[quiet mode - don't print anything]" + '(-r --cache-size)'{-r+,--cache-size=}'[specify memory limit for cached file content data]: :_numbers size K M G T P' + '(--skip-reflinks)--reflink=-[create clone/CoW copies]::when [auto]:(auto always never)' + '--skip-reflinks[skip already cloned files]' + '(-S --maximum-size)'{-S+,--maximum-size=}'[specify maximum size for files]: :_numbers -u bytes -d 0 size K M G T P E Z Y' + '--exclude-subtree[specify regular expression to exclude directories]:regex' + '(-X --respect-xattrs)'{-X,--respect-xattrs}'[respect extended attributes]' + '(-y --method)'{-y+,--method=}'[specify file content comparison method]:method [sha256]:(sha256 sha1 crc32c memcmp)' + '(-z --zero)'{-z,--zero}'[delimit output with NULs instead of newlines]' + ) +fi + +_arguments -S -s $args \ + '(-f --respect-name)'{-f,--respect-name}'[filenames have to be identical]' \ + '(-i --include)'{-i+,--include=}'[regular expression to include files/dirs]:regex' \ + '(-m --maximize -M --minimize)'{-m,--maximize}'[keep the file with the most links]' \ + '(-M --minimize -m --maximize)'{-M,--minimize}'[keep the file with the fewest links]' \ + '(-n --dry-run)'{-n,--dry-run}"[don't actually link anything]" \ + '(-o --ignore-owner -c --content)'{-o,--ignore-owner}'[ignore owner changes]' \ + '(-O --keep-oldest)'{-O,--keep-oldest}'[keep the oldest file of multiple equal files]' \ + '(-p --ignore-mode -c --content)'{-p,--ignore-mode}'[ignore changes of file mode]' \ + '(-s --minimum-size)'{-s+,--minimum-size=}'[specify minimum size for files]: :_numbers -u bytes -d 1 size K M G T P E Z Y' \ + '(-t --ignore-time -c --content)'{-t,--ignore-time}'[ignore timestamps (when testing for equality)]' \ + \*{-v,--verbose}'[more verbose output]' \ + '(-x --exclude)'{-x+,--exclude=}'[specify regular expression to exclude files]:regex' \ + "$ign"{-h,--help}'[display usage information]' \ + "$ign"{-V,--version}'[display version information]' \ + '*:file or directory:_files' diff --git a/Completion/Unix/Command/_htop b/Completion/Unix/Command/_htop new file mode 100644 index 000000000..73a6ea9fa --- /dev/null +++ b/Completion/Unix/Command/_htop @@ -0,0 +1,57 @@ +#compdef htop pcp-htop + +# Notes: +# - htop allows long options to be passed with a single dash; we don't account +# for this +# - htop parses optional arguments to -H and -u 'cleverly' by allowing the next +# word to be the optarg if it doesn't begin with a '-'; this should work here +# - There is a special version of htop designed to be used with PCP (Performance +# CoPilot); we don't fully account for this +# - Some of the ranges and defaults listed here had to be found in the source + +local MATCH MBEGIN MEND ret=1 +local -a context line state state_descr args tmp + +args=( + '(-d --delay)'{-d+,--delay=}'[specify update frequency]:delay (tenths of seconds) (1-100) [15]' + '(-C --no-color --no-colour)'{-C,--no-colo{,u}r}'[use monochrome colour scheme]' + '(-F --filter)'{-F+,--filter=}'[show only commands matching specified filter]:case-insensitive command-line sub-string:_process_names -a' + '(-)'{-h,--help}'[display usage information]' + '(-H --highlight-changes)'{-H+,--highlight-changes=}'[highlight new and old processes (optionally specify delay)]::delay (seconds) (1-86400) [5]' + '(-M --no-mouse)'{-M,--no-mouse}'[disable mouse]' + '--no-meters[hide meters]' + '(-n --max-iterations)'{-n+,--max-iterations=}'[exit after given number of frame updates]:number' + \*{-p+,--pid=}'[show only specified PIDs]: : _sequence _pids' + '--readonly[disable all system and process changing features]' + '(-s --sort-key)'{-s+,--sort-key=}'[sort by specified column]: :->sort-keys' + '(-t --tree)'{-t,--tree}'[show tree view of processes]' + '(-u --user)'{-u+,--user=}'[show only processes of current or specified user]:: : _users' + '(-U --no-unicode)'{-U,--no-unicode}'[disable Unicode]' + '(-)'{-V,--version}'[display version information]' +) + +[[ $OSTYPE == linux* ]] && +(( ! EUID || $+_comp_priv_prefix )) && +_pick_variant libcap=drop-capabilities $OSTYPE --help && +args+=( + '--drop-capabilities=-[drop specified capabilities]::mode [basic]:(( + off\:"do not drop capabilities" + basic\:"drop capabilities not needed for standard functionality (retains kill, renice, etc.)" + strict\:"drop capabilities not needed for core functionality" + ))' +) + +_arguments -s -S : $args && ret=0 + +case $state in + sort-keys) + tmp=( ${(f)"$(_call_program sort-keys $words[1] --sort-key help)"} ) + tmp=( ${tmp/#[[:space:]]##} ) + tmp=( ${tmp//:/\\:} ) + tmp=( ${tmp/[[:space:]]##/:} ) + tmp=( ${tmp/(#m):[A-Z]/${(L)MATCH}} ) + _describe -t sort-keys 'column' tmp -M 'b:=M_ b:=IO_' && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_id b/Completion/Unix/Command/_id index 64b8c9b37..ce18ed719 100644 --- a/Completion/Unix/Command/_id +++ b/Completion/Unix/Command/_id @@ -44,8 +44,10 @@ else freebsd*) args+=( '(-)-A[print process audit user ID]' - '(-)-M[print MAC label of the current process]' + '(- 1)-M[print MAC label of the current process]' '(-)-c[print current login class]' + '(-)-d[print home directory]' + '(-)-s[print shell]' ) ;| darwin*|dragonfly*|freebsd*|netbsd*|openbsd*) diff --git a/Completion/Unix/Command/_imagemagick b/Completion/Unix/Command/_imagemagick index 6553868d9..958b2741d 100644 --- a/Completion/Unix/Command/_imagemagick +++ b/Completion/Unix/Command/_imagemagick @@ -12,7 +12,7 @@ typeset -A opt_args # # and certainly many other things... -formats=(jpg jpeg jp2 j2k jpc jpx jpf tif tiff miff ras bmp cgm dcx ps eps fig fits fpx gif mpeg pbm pgm ppm pcd pcl pdf pcx png rad rgb rgba rle sgi html shtml tga ttf uil xcf xwd xbm xpm yuv svg webp) +formats=(jpg jpeg jp2 j2k jpc jpx jpf tif tiff miff ras bmp cgm dcx ps eps fig fits fpx gif heic mpeg pbm pgm ppm pcd pcl pdf pcx png rad rgb rgba rle sgi html shtml tga ttf uil xcf xwd xbm xpm yuv svg webp) if (( $# )); then _files "$@" -g "*.(#i)(${(j:|:)formats})(-.)" diff --git a/Completion/Unix/Command/_init_d b/Completion/Unix/Command/_init_d index cdc373297..7b3c8ee41 100644 --- a/Completion/Unix/Command/_init_d +++ b/Completion/Unix/Command/_init_d @@ -1,7 +1,7 @@ #compdef -p */(init|rc[0-9S]#).d/* -local cmds script -local -a flags +local cmds script state +local -a flags line _compskip=all @@ -122,4 +122,21 @@ cmds=( $(_init_d_get_cmds) ) || return 1 (( $#cmds )) || zstyle -a ":completion:${curcontext}:commands" commands cmds || cmds=(start stop) -_arguments -s -A "-*" $flags ':init.d command:_sub_commands $cmds' +local svcname=$words[1] ret=1 + +_arguments -C -s -A "-*" $flags \ + ':init.d command:_sub_commands $cmds' \ + '*:: :->svcargs' && ret=0 + +if [[ $state == svcargs ]]; then + case $svcname:$line[1] in + jail:(*stop|*restart|console|status)) _jails && ret=0 ;; + jail:*) _jails -c && ret=0 ;; + netif:*) _net_interfaces && ret=0 ;; + *) + _call_function ret _init_d-$svcname $line[1] + ;; + esac +fi + +return ret diff --git a/Completion/Unix/Command/_initctl b/Completion/Unix/Command/_initctl deleted file mode 100644 index b60bdbc5b..000000000 --- a/Completion/Unix/Command/_initctl +++ /dev/null @@ -1,184 +0,0 @@ -#compdef initctl start stop restart reload status -# Written by Bernhard Tittelbach -# based on completion script by Mildred - -typeset -g -a -U _initctl_events_list _initctl_eventargs_list - -# run show-config -e and if possible parse out all events and KEY= arguments -# otherwise provide some common values -_initctl_fillarray_events_args () -{ - setopt extendedglob - local showconfig="$(initctl show-config -e 2>| /dev/null)" - if [[ -n "$showconfig" ]]; then - _initctl_events_list=() - _initctl_eventargs_list=() - for cline in "${(f)showconfig}"; do - if [[ "$cline" == (#s)\ \ (stop\ on|start\ on|emit)\ (#b)([[:alpha:]-_]##)(*)(#e) ]]; then - _initctl_events_list+=($match[1]) - # this is a bit tricky, we take the string right of the matched event - # and parse for \sUPPERCASE=\S (in perl-re syntax) substrings until there are no more matches - # since we can't do multiple matches, we concatenated the remaining strings and try again - local stml="$match[2]" - while [[ "$stml" == (#b)(*)\ ([[:upper:]_]##\=)[^[:space:]](#b)(*) ]]; do - _initctl_eventargs_list+=($match[2]) - stml="$match[1] $match[3]" - done - unset stml - fi - done - else - _initctl_events_list=( socket login-session-start desktop-session-start virtual-filesystems local-filesystems remote-filesystems all-swaps filesystem mounting mounted net-device-up start-portmap runlevel unmounted-remote-filesystems ) - _initctl_eventargs_list=( PRIMARY_DEVICE_FOR_DISPLAY= EXIT_STATUS= EXIT_SIGNAL= RUNLEVEL= MOUNTPOINT= TYPE= INTERFACE= ) - fi - return 0 -} - -# list all upstart jobs, i.e. all files in /etc/init/ -_initctl_helper_jobs() -{ - _path_files -W "/etc/init/" -g "*.conf(-.:r)" -} - -# list events, generate array if necessary -_initctl_known_events() -{ - [[ ${#_initctl_events_list} -eq 0 ]] && _initctl_fillarray_events_args - _values "Event" "$_initctl_events_list[@]" -} - -# list events, allow multiple choices, generate array if necessary -_initctl_multiple_known_events() -{ - [[ ${#_initctl_events_list} -eq 0 ]] && _initctl_fillarray_events_args - _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 key" "$_initctl_eventargs_list[@]" -} - -# describe and offer commands for initctl, then call matching completion function -_initctl_command() -{ - local cmds - cmds=( - start:"Start jobs" - stop:"Stop jobs" - restart:"Restart jobs" - reload:"Send SIGHUP to process instance" - status:"Query status of jobs" - list:"List known jobs" - emit:"Emit an event" - reload-configuration:"tell init to reload config files (generally inotify is used)" - version:"Request the version of the init daemon" - log-priority:"Change the minimum priority of log messages from the init daemon" - show-config:"Show start/stop/emit for processes" - check-config:"Find jobs than can't be started" - help:"display list of commands" - ) - - if (( CURRENT == 1 )); then - _describe -t command "initctl command" cmds - fi - - local cmd=$words[1] - - local curcontext="${curcontext%:*}:initctl-${cmd}" - _call_function ret _initctl_${cmd_completion_funcs[${cmd}]-${cmd_completion_default}} -} - -# completion for start/stop/restart/reload i.e. anything that take one job and multiple KEY= arguments's -_initctl_startstop() -{ - _arguments \ - '--no-wait[do not wait for operation to complete before exiting]' \ - "${common_args[@]}" \ - ':upstart job:_initctl_helper_jobs' \ - '*::argument key:_initctl_known_eventargs' -} - -# completion for anything that takes one job -_initctl_argjob() -{ - _arguments \ - "${common_args[@]}" \ - ':upstart job:_initctl_helper_jobs' \ - '*::' -} - -# completion for emit, providing options, one event and multiple KEY= arguments's -_initctl_emit() -{ - _arguments \ - '--no-wait[do not wait for event to finish before exiting]' \ - "${common_args[@]}" \ - ':event:_initctl_known_events' \ - '*::argument key:_initctl_known_eventargs' -} - -# the fallback, just the options -_initctl_basic() -{ - _arguments \ - "${common_args[@]}" -} - -# completion for show-config, additional option and one job -_initctl_show-config() -{ - _arguments \ - "(-e --enumerate)"{-e,--enumerate}"[enumerate emit lines]" \ - "${common_args[@]}" \ - '::upstart job:_initctl_helper_jobs' \ - '*::' -} - -# completion for show-config, additional options and one job -_initctl_check-config() -{ - _arguments \ - "(-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 job:_initctl_helper_jobs' \ - '*::' -} - -# after defining above functions, overwrite _initctl function so helper-functions are loaded only once -_initctl() -{ - local -a common_args - common_args=( - '--session[use D-Bus session bus to connect to init daemon (for testing)]' - '--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=[specify D-Bus name for init]:D-Bus name [com.ubuntu.Upstart]' - '--help[display help and exit]' - '--version[output version information and exit]' - ) - - # map each initctl function to a completion function - local -A cmd_completion_funcs - cmd_completion_funcs=( start startstop stop startstop restart startstop reload startstop show-config show-config status argjob emit emit check-config check-config ) - - # define fallback completion function - local cmd_completion_default=basic - - # depending on which command was used, call different completion functions - case $service in - initctl) - _arguments "${common_args[@]}" '*::initctl command:_initctl_command' - ;; - start|stop|restart|reload|status) - _call_function ret _initctl_${cmd_completion_funcs[${service}]-${cmd_completion_default}} - ;; - *) return 1 ;; - esac -} - -_initctl "$@" diff --git a/Completion/Unix/Command/_ip b/Completion/Unix/Command/_ip deleted file mode 100644 index 9a7cbd821..000000000 --- a/Completion/Unix/Command/_ip +++ /dev/null @@ -1,577 +0,0 @@ -#compdef ip - -# This is based on iproute2-ss061214. -# The manual and help text summaries are not consistent with the main -# manual text. I have based this on the main manual text, except where -# it's obviously deficient. - -# -# Values encoding simple types -# -local -a subcmd_dev net_intf_disp net_intf_list -# subcmd_dev=(/$'[[:alnum:][:punct:][:cntrl:][:digit:]]##\0'/ ':interfaces:network interface:_net_interfaces') -_find_net_interfaces -subcmd_dev=(/"(${(j.|.)net_intf_list})"$'\0'/ - ':interfaces:network interface:_net_interfaces') - -local -a subcmd_onoff -subcmd_onoff=(/$'(on|off)\0'/ ':onoff:state (on or off):(on off)') - -local -a subcmd_string -subcmd_string=(/$'[^\0]#\0'/ ':string:arbitrary string:( )') - -local -a subcmd_number -subcmd_number=(/$'[0-9]##\0'/ ':number:decimal number:( )') - -local xp='[[:xdigit:]][[:xdigit:]]' -local -a subcmd_lladdr -subcmd_lladdr=(/"${xp}:${xp}:${xp}:${xp}:${xp}:${xp}"$'\0'/ -':lladdress:link layer (MAC) address:( )') - -local -a subcmd_ipaddr -subcmd_ipaddr=( - /$'(<->(.<->(.<->(.<->|)|)|)|[:[:xdigit]]#:[:[:xdigit:]]#)(|/<->)\0'/ - ':ipaddress:IP address (v4 or v6) with optional /<network-prefix-length>:( )' -) - -local -a subcmd_ipaddrs -local PATH=$PATH -PATH=/sbin:$PATH -subcmd_ipaddrs=( - /$'(<->(.<->(.<->(.<->|)|)|)|[:[:xdigit]]#:[:[:xdigit:]]#)(|/<->)\0'/ - ":ipaddress:IP address (v4 or v6) currently set:( $(ip addr show | sed -n 's/^ *inet6* \([0-9a-f\.:/]*\) .*$/\1/p') )" -) -local -a subcmd_prefix_label -subcmd_prefix_label=( - /$'(<->(.<->(.<->(.<->|)|)|)|[:[:xdigit]]#:[:[:xdigit:]]#)(|/<->)\0'/ - ":ipaddresslabel:IP addrlabel prefix currently set:( $(ip -6 addrlabel list 2>/dev/null | sed -n 's/^prefix \([0-9a-f\.:/]*\) .*$/\1/p') )" -) - - -local -a subcmd_scope -_regex_words scope "IP address scope" \ - 'global:address globally valid' \ - 'site:address valid for site (IPv6)' \ - 'link:address valid for single link' \ - 'host:address valid for this host' -subcmd_scope=("$reply[@]") - -local -a subcmd_nud -_regex_words nud "Neighbour Unreachability Detection state" \ - 'permanent:valid forever' \ - 'noarp:valid, not validated, removed if expired' \ - 'reachable:valid until reachability timeout' \ - 'stale:valid but suspicious' -subcmd_nud=("$reply[@]") - -local -a subcmd_rttype -_regex_words route-type "Route type" \ - 'unicast:real point-to-point route' \ - 'unreachable:generate Host Unreachable messages' \ - 'blackhole:silently discard' \ - 'prohibit:generate Communication Administratively Prohibited messages' \ - 'local:Loopback route' \ - 'broadcast:destinations are broadcast addresses' \ - 'throw:used with policy rules, generate Net Unreachable if no route' \ - 'nat:Network Address Translation route' \ - 'anycast:anycast addresses, not implemented' \ - 'multicast:multicast routing, not present in normal tables' -subcmd_rttype=("$reply[@]") - -local -a subcmd_route -# Route type is optional in route. -# There's an overall default but then the whole thing is missed -# out, and it's marked as optional anyway. -subcmd_route=("(" $subcmd_rttype "|" ")" $subcmd_ipaddr) - -local -a subcmd_tos -_regex_words tos "type of service" \ - 'lowdelay:low latency' \ - 'throughput:high bulk throughput' \ - 'reliability:high reliability' -subcmd_tos=("(" "$reply[@]" "|" - /$'(|0x)[[:xdigit:]]##\0'/ ":hex-number:8-bit hex number:( )" ")") - -local -a subcmd_lockmtu -subcmd_lockmtu=("(" /$'lock\0'/ ":lock:lock:(lock)" "|" ")" $subcmd_number ) - -local -a subcmd_nexthop -_regex_words nexthop 'nexthop route keyword' \ - 'via:specify nexthop router:$subcmd_ipaddr' \ - 'dev:specify output device:$subcmd_dev' \ - 'weight:specify relative quality of route:$subcmd_number' -subcmd_nexthop=("$reply[@]" "#") - -local -a subcmd_rtprotocol -_regex_words rtprotocol 'route protocol' \ - 'redirect:installed from ICMP redirect' \ - 'kernel:installed automatically by kernel' \ - 'boot:installed during boot sequence' \ - 'static:installed by administrator' \ - 'ra:installed by Router Discovery protocol' -subcmd_rtprotocol=("$reply[@]") - -local -a subcmd_rttable -_regex_words rttable 'routing table' \ - 'local:local routes' \ - 'main:main routing table' \ - 'default:default routing table' \ - 'unspec:unspecified routing table' -subcmd_rttable=("(" "$reply[@]" "|" $subcmd_number ")") - -local -a subcmd_rtrealm subcmd_rtrealms -_regex_words -t / rtrealm 'routing realm' \ - 'cosmos:everywhere' -subcmd_rtrealms=("(" "$reply[@]" "|" /$'[0-9]##/'/ - ':number:decimal number:( )' ")") - -_regex_words rtrealm 'routing realm' \ - 'cosmos:everywhere' -subcmd_rtrealm=("(" "$reply[@]" "|" $subcmd_number ")") -subcmd_rtrealms+=($subcmd_rtrealm) - -local -a subcmd_rtselector -_regex_words rtselmod 'routing selector modifier' \ - 'root:select minimum route prefix length to match' \ - 'match:select maximum route prefix length to match' \ - 'exact:select exact prefix length to match' -subcmd_rtselector=("(" "$reply[@]" "|" ")" $subcmd_ipaddr) - -local -a subcmd_family -_regex_words family 'protocol family' \ - 'inet:IPv4' \ - 'inet6:IPv6' \ - 'link:local, no networking protocol' -subcmd_family=("$reply[@]") - -local -a subcmd_ruletypes -_regex_words ruletype 'rule type' \ - 'unicast:rule applies to a route' \ - 'blackhole:rule silently drops packet' \ - 'unreachable:rule generates Network Unreachable messages' \ - 'prohibit:rule generates Communication Administratively Prohibited messages' \ - 'nat:rule prescribes translation of source IP address' -subcmd_ruletypes=("$reply[@]") - -local -a subcmd_tunnelmode -_regex_words tunnelmode 'tunnel mode' \ - 'ipip:IPv4 in IPv4 tunnel' \ - 'sit:Simple Internet Transition - IPv6 in IPv4 tunnel' \ - 'gre:Generic Route Encapsulation - IPv4/IPv6 in IPv4 tunnel' -subcmd_tunnelmode=("$reply[@]") - -local -a subcmd_files -subcmd_files=(/$'[^\0]##\0'/ ':file:file name:_files') - - -# -# The ip top-level commands. First link -# -local -a link_set_cmds -_regex_words \ - link-set-commands 'link set commands' \ - 'dev:specify device:$subcmd_dev' \ - 'u*p:change state to up' \ - 'do*wn:change state to down' \ - 'ar*p:change ARP flag on device:$subcmd_onoff' \ - 'mu*lticast:change MULTICAST flag on device:$subcmd_onoff' \ - 'pr*omisc:set promiscuous mode:$subcmd_onoff' \ - 'dy*namic:change DYNAMIC flag on device:$subcmd_onoff' \ - 'n*ame:change name of device:$subcmd_string' \ - 'txq*ueuelen:specify length of transmit queue:$subcmd_number' \ - 'txql*en:specify length of transmit queue:$subcmd_number' \ - 'm*tu:specify maximum transmit unit:$subcmd_number' \ - 'ad*dress:specify unicast link layer (MAC) address:$subcmd_lladdr' \ - 'br*oadcast:specify broadcast link layer (MAC) address:$subcmd_lladdr' \ - 'brd:specify broadcast link layer (MAC) address:$subcmd_lladdr' \ - 'p*eer:specify peer link layer (MAC) address:$subcmd_lladdr' -# can complete interface with no dev, subcommands can repeat... -link_set_cmds=("(" $subcmd_dev "|" ")" "$reply[@]" "#" ) - -local -a link_show_cmds -_regex_words link-show-commands 'link show commands' \ - 'dev:specify device:$subcmd_dev' \ - 'up:limit display to running devices' -link_show_cmds=("(" $subcmd_dev "|" ")" "$reply[@]" "#" ) - -local -a link_cmds -_regex_words \ - link-commands "link command" \ - 'h*elp:show help for command' \ - 'se*t:change device attributes:$link_set_cmds' \ - 'sh*ow:display device attributes:$link_show_cmds' -link_cmds=("$reply[@]") - - -# -# addr -# -local -a addr_add_cmds -# TODO: broadcast can take + or = -_regex_words addr-add-commands "addr add/remove/change/replace commands" \ - 'dev:specify device:$subcmd_dev' \ - 'lo*cal:specify local IP address:$subcmd_ipaddr' \ - 'p*eer:specify peer IP address (point-to-point):$subcmd_ipaddr' \ - 'b*roadcast:specify broadcast IP address:$subcmd_ipaddr' \ - 'la*bel:specify tag for device:$subcmd_string' \ - 's*cope:specify scope for address:$subcmd_scope' -# can complete IP address with no keyword -addr_add_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]" "#" ) - -local -a addr_del_cmds -addr_del_cmds=("(" $subcmd_ipaddrs "|" "$reply[@]" ")" "#" ) - -local -a addr_show_cmds -# TODO: broadcast can take + or = -_regex_words addr-show-commands "addr show commands" \ - 'dev:specify device:$subcmd_dev' \ - 's*cope:specify scope for address:$subcmd_scope' \ - 't*o:limit to given IP address/prefix:$subcmd_ipaddr' \ - 'la*bel:list tags matching glob patter:$subcmd_string' \ - 'dynamic:list addresses from stateless configuration (IPv6)' \ - 'permanent:list non-dynamic addresses (IPv6)' \ - 'tentative:list addresses failing duplicate address detection (IPv6)' \ - 'deprecated:list deprecated addresses (IPv6)' \ - 'primary:list only primary addresses' \ - 'secondary:list only secondary addresses' -# can complete device with no keyword -addr_show_cmds=("(" $subcmd_dev "|" ")" "$reply[@]" "#" ) - -local -a addr_cmds -_regex_words \ - addr-commands "addr command" \ - 'h*elp:show help for command' \ - 'a*dd:add new protocol address:$addr_add_cmds' \ - 'c*hange:change existing protocol address:$addr_add_cmds' \ - 'r*eplace:add or update protocol address:$addr_add_cmds' \ - 'd*elete:delete protocol address:$addr_del_cmds' \ - 's*how:show protocol address:$addr_show_cmds' \ - 'f*lush:flush protocol address:$addr_show_cmds' -addr_cmds=("$reply[@]") - -# -# addrlabel -# - -local -a addrlabel_add_cmds -_regex_words addrlabel-add-commands "addlabel add command" \ - 'p*refix: limit to given IP address/prefix' \ - 'd*ev: specify device:$subcmd_dev' \ - 'l*abel: number' -addrlabel_add_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") - -local -a addrlabel_del_cmds -_regex_words addrlabel-add-commands "addlabel del command" \ - 'p*refix: limit to given IP address/prefix:$subcmd_prefix_label' \ - 'd*ev: specify device:$subcmd_dev' \ - 'l*abel: number:$subcmd_number' -addrlabel_del_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") - - -local -a addrlabel_cmds -_regex_words \ - addrlabel-commands "addrlabel command" \ - 'h*elp: show help for command' \ - 'a*dd: add an address labels:$addrlabel_add_cmds' \ - 'd*el: delete an address labels:$addrlabel_del_cmds' \ - 'l*ist: list address labels' \ - 'f*lush: flush adderss labels' -addrlabel_cmds=("$reply[@]") - -# -# neigh -# -local -a neigh_add_cmds -_regex_words neigh-add-commands "neighbour add command" \ - 't*o:add new neighbour IP address:$subcmd_ipaddr' \ - 'dev:specify network device:$subcmd_dev' \ - 'l*laddr:specify link layer (MAC) address or null:$subcmd_lladdr' \ - 'n*ud:specify neighbour unreachability detection state:$subcmd_nud' -# to-address without keyword can appear first -neigh_add_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") - -local -a neigh_del_cmds -_regex_words neigh-add-commands "neighbour delete command" \ - 't*o:remove neighbour IP address:$subcmd_ipaddr' \ - 'dev:specify network device:$subcmd_dev' -neigh_del_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") - -local -a neigh_show_cmds -_regex_words neigh-show-commands "neighbour show command" \ - 't*o:select neighbours by prefix:$subcmd_ipaddr' \ - 'dev:select neighbours by device:$subcmd_dev' \ - 'u*nused:only list unused neighbours' \ - 'n*ud:only list neighbours in given state:$subcmd_nud' -neigh_show_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#" ) - -local -a neigh_cmds -_regex_words \ - neigh-commands "neigh command" \ - 'h*elp:show help for command' \ - 'a*dd:add new neighbour entry:$neigh_add_cmds' \ - 'c*hange:change existing neighbour entry:$neigh_add_cmds' \ - 'r*eplace:add or change neighbour entry:$neigh_add_cmds' \ - 'd*elete:delete neighbour entry:$neigh_del_cmds' \ - 's*how:list neighbour entries:$neigh_show_cmds' \ - 'f*lush:flush neighbour entries:$neigh_show_cmds' -neigh_cmds=("$reply[@]") - - -# -# route -# -local -a route_add_cmds -_regex_words route-add-commands "route add/change/replace command" \ - 'to:route destination prefix:$subcmd_route' \ - 'tos:type of service:$subcmd_tos' \ - 'ds*field:type of service:$subcmd_tos' \ - 'me*tric:preference value of route:$subcmd_number' \ - 'pre*ference:preference value of route:$subcmd_number' \ - 'ta*ble:select table by ID:$subcmd_rttable' \ - 'dev:select device:$subcmd_dev' \ - 'v*ia:select nexthop router:$subcmd_ipaddr' \ - 'sr*c:select preferred source address:$subcmd_ipaddr' \ - 're*alm:select routing realm:$subcmd_rtrealm' \ - 'mtu:select maximum transport unit:$subcmd_lockmtu' \ - 'w*indow:select maximal window in bytes:$subcmd_number' \ - 'rtt:select round trip time estimate:$subcmd_number' \ - 'rttv*ar:select initial round trip variance estimate:$subcmd_number' \ - 'ss*thresh:select initial slow start threshold estimate:$subcmd_number' \ - 'cw*nd:select clamp for congestion window (only if locked):$subcmd_number' \ - 'in*itcwnd:select max initial cwnd in MSS:$subcmd_number' \ - 'ad*vmss:select maximal segment size advertised:$subcmd_number' \ - 're*ordering:select maximal reordering for path:$subcmd_number' \ - 'ne*xthop:select nexthop of multipath route:$subcmd_nexthop' \ - 'sc*ope:select scope of destinations:$subcmd_scope' \ - 'pro*tocol:select routing protocol identifier:$subcmd_rtprotocol' \ - 'onl*ink:pretend nexthop is directly attached' \ - 'eq*ualize:allow packet by packet randomization' -# route can appear with no "to" -route_add_cmds=("(" $subcmd_route "|" ")" "$reply[@]" "#") - -local -a route_show_cmds -_regex_words route-show-commands "route show command" \ - 'to:select route via prefix:$subcmd_rtselector' \ - 'tos:type of service:$subcmd_tos' \ - 'ta*ble:select table by ID:$subcmd_rttable' \ - 'cl*oned:list only dynamically forked routes' \ - 'ca*ched:list only dynamically forked routes' \ - 'f*rom:select route via source address prefix:$subcmd_rtselector' \ - 'p*rotocol:select routing protocol identifier:$subcmd_rtprotocol' \ - 'sc*ope:select scope of destinations:$subcmd_scope' \ - 'ty*pe:route type:$subcmd_rttype' \ - 'dev:select device:$subcmd_dev' \ - 'v*ia:select nexthop router:$subcmd_ipaddr' \ - 'sr*c:select route via source prefix:$subcmd_ipaddr' \ - 'realm:select routing realm:$subcmd_rtrealm' \ - 'realms:select from/to routing realms:$subcmd_rtrealms' -# route selector can appear with no "to" -route_show_cmds=("(" $subcmd_rtselector "|" ")" "$reply[@]" "#") - -local -a route_get_cmds -_regex_words route-get-commands "route get commands" \ - 'to:route destination:$subcmd_ipaddr' \ - 'f*rom:route source:$subcmd_ipaddr' \ - 'tos:select type of service:$subcmd_tos' \ - 'ds*field:type of service:$subcmd_tos' \ - 'iif:select input interface (device):$subcmd_dev' \ - 'oif:select output interface (device):$subcmd_dev' \ - 'c*onnected:use preferred address as source' -route_get_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") - -local -a route_cmds -_regex_words \ - route-commands "route command" \ - 'h*elp:show help for command' \ - 'a*dd:add new network route:$route_add_cmds' \ - 'c*hange:change existing network route:$route_add_cmds' \ - 'r*eplace:add or change network route:$route_add_cmds' \ - 'd*elete:delete network route:$route_add_cmds' \ - 's*how:list network routes:$route_show_cmds' \ - 'f*lush:flush network routes:$route_show_cmds' \ - 'g*et:get a single network route:$route_get_cmds' -route_cmds=("$reply[@]") - - -# -# rule -# -local -a rule_add_cmds -_regex_words rule-add-commands 'ip rule add/delete commands' \ - 'ty*xpe:type of rule:$subcmd_ruletypes' \ - 'fr*om:select source prefix:$subcmd_ipaddr' \ - 'to:select destination prefix:$subcmd_ipaddr' \ - 'iif:select input interface (device):$subcmd_dev' \ - 'tos:select type of service:$subcmd_tos' \ - 'ds*field:select type of service:$subcmd_tos' \ - 'fw*mark:select fwmark:$subcmd_string' \ - 'pr*iority:select unique priority for rule:$subcmd_number' \ - 'ta*ble:select routing table by ID:$subcmd_rttable' \ - 're*alms:select from/to routing realms:$subcmd_rtrealms' \ - 'nat:select base of IP block to translate:$subcmd_ipaddr' - -rule_add_cmds=("(" $subcmd_ruletypes "|" ")" "$reply[@]" "#") - -local -a rule_cmds -_regex_words \ - rule-commands "rule command" \ - 'h*elp:show help for command' \ - 'a*dd:insert a new routing rule:$rule_add_cmds' \ - 'd*elete:delete a routing rule:$rule_add_cmds' \ - 'f*lush:flush rules and dump deleted rules' \ - 's*how:list routing rules' -rule_cmds=("$reply[@]") - - -# -# tunnel -# -local -a tunnel_add_cmds -_regex_words tunnel-add-commands 'tunnel add/change/delete commands' \ - 'na*me:select tunnel device name:$subcmd_dev' \ - 'm*ode:select tunnel mode:$subcmd_tunnelmode' \ - 'r*emote:select remote endpoint address:$subcmd_ipaddr' \ - 'l*ocal:select local address:$subcmd_ipaddr' \ - 'ttl:set fixed time to live, 1 to 255 or 0 (inherit):$subcmd_number' \ - 'tos:select type of service:$subcmd_tos' \ - 'ds*field:select type of service:$subcmd_tos' \ - 'dev:select device to bind tunnel to:$subcmd_dev' \ - 'no*pmtudisc:disable path maximum transport unit discovery' \ - 'ik*ey:set input key for GRE tunnel:$subcmd_ipaddr' \ - 'ok*ey:set output key for GRE tunnel:$subcmd_ipaddr' \ - 'k*ey:set bidirectional key for GRE tunnel:$subcmd_ipaddr' \ - 'ic*sum:enable input checksums for GRE tunnel' \ - 'oc*sum:enable output checksums for GRE tunnel' \ - 'c*sum:enable bidirectional checksums for GRE tunnel' \ - 'is*eq:serialize input packets on GRE tunnel' \ - 'os*eq:serialize output packets on GRE tunnel' \ - 's*eq:serialize packets bidirectionally on GRE tunnel' -# name is default... we always complete it as an interface, -# although that's not really right for "add". -tunnel_add_cmds=("$reply[@]" "#") - -local -a tunnel_cmds -_regex_words \ - tunnel-commands "tunnel command" \ - 'h*elp:show help for command' \ - 'a*dd:add a new IP tunnel:$tunnel_add_cmds' \ - 'c*hange:change an existing IP tunnel:$tunnel_add_cmds' \ - 'd*el:destroy an IP tunnel:$tunnel_add_cmds' \ - 's*how:list IP tunnels' -tunnel_cmds=("$reply[@]") - - -# -# maddr -# -local -a maddr_add_cmds -_regex_words maddr-add-commands "maddr add/delete command" \ - 'a*ddress:select link layer (MAC) address:$subcmd_lladdr' \ - 'dev:select device to bind multicast address to:$subcmd_dev' -maddr_add_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") - -local -a maddr_show_cmds -_regex_words maddr-show-commands 'maddr show command' \ - 'dev:select device with multicast address(es):$subcmd_dev' -# device is default argument but if given the "dev" is useless -maddr_show_cmds=("(" $subcmd_dev "|" "$reply[@]" ")") - -local -a maddr_cmds -_regex_words \ - maddr-commands "maddr command" \ - 'h*elp:show help for command' \ - 'a*dd:add multicast address:$maddr_add_cmds' \ - 'd*elete:delete multicast address:$maddr_add_cmds' \ - 's*how:list multicast addresses:$maddr_show_cmds' -maddr_cmds=("$reply[@]") - - -# -# mroute -# -local -a mroute_show_cmds -_regex_words mroute-show-commands "mroute show command" \ - 'to:select destination prefix:$subcmd_ipaddr' \ - 'iif:select input interface (device):$subcmd_dev' \ - 'from:select source prefix:$subcmd_ipaddr' -mroute_show_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]") - -local -a mroute_cmds -_regex_words \ - mroute-commands "mroute command" \ - 'h*elp:show help for command' \ - 's*how:list multicast routing cache entries:$mroute_show_cmds' -mroute_cmds=("$reply[@]") - - -# -# monitor -# -local -a monitor_cmds -_regex_words \ - monitor-commands "monitor command" \ - 'h*elp:show help for command' \ - 'all:monitor all changes' \ - 'link:monitor changes to links' \ - 'address:monitor changes to addresses' \ - 'route:monitor changes to routes' \ - 'file:read rtmon-generated log:$subcmd_files' -monitor_cmds=("$reply[@]") - - -# -# Global argument handling -# - -# Arguments to _regex_arguments, built up in array $args. -local -a args reply -args=( - # Command word. Don't care what that is. - /$'[^\0]#\0'/ -) - -# TODO: -# -b*atch <FILENAME> -# -force (for batch mode) -# -l*oops <COUNT> -# -n*etns <NETNS> -# -rc, -rcvbuf<SIZE> -_regex_words options "ip options" \ - '-h*uman:output statistics with human readable values' \ - '-i*ec:print human readable rates in IEC units (ie. 1K = 1024)' \ - '-s*tatistics:output statistics' \ - '-d*etails:output more detailed information' \ - '-c*olor:color output' \ - '-br*ief:brief output' \ - '-a*ll:executes specified command over all objects' \ - '-f*amily:select protocol family:$subcmd_family' \ - '-4:IPv4' \ - '-6:IPv6' \ - '-B:family bridge' \ - '-D:family DECnet' \ - '-I:family IPX' \ - '-M:family MPLS' \ - '-0:link protocol, no networking' \ - '-o*neline:output one record per line' \ - '-t*imestamp:display current time when using monitor option' \ - '-ts*hort:display current time in shorter format when using monitor option' \ - '-r*esolve:use system resolver for DNS names' -args+=("$reply[@]" "#") - -_regex_words \ - commands "ip command" \ - 'l*ink:configure network device:$link_cmds' \ - 'addrlabel:manage addrlabel:$addrlabel_cmds' \ - 'a*ddr:manage protocol address:$addr_cmds' \ - 'r*oute:manage routing table:$route_cmds' \ - 'ru*le:manage routing policy database:$rule_cmds' \ - 'n*eigh:manage neighbour/ARP tables:$neigh_cmds' \ - 't*unnel:configure tunnel:$tunnel_cmds' \ - 'm*addr:manage multicast addresses:$maddr_cmds' \ - 'mr*oute:manage multicast routing cache:$mroute_cmds' \ - 'mo*nitor:monitor state:$monitor_cmds' -args+=("$reply[@]") - -_regex_arguments _ip "${args[@]}" - -_ip "$@" diff --git a/Completion/Unix/Command/_jq b/Completion/Unix/Command/_jq index e8e6b0913..fb44702b2 100644 --- a/Completion/Unix/Command/_jq +++ b/Completion/Unix/Command/_jq @@ -30,7 +30,7 @@ _arguments -S -s : \ '(-r --raw-output -j --join-output)--raw-output0[like -r, with NUL after each output]' \ '(-r --raw-output --raw-output0 -j --join-output)'{-j,--join-output}"[like -r, without newlines between outputs]" \ '(-f --from-file)'{-f,--from-file}'[read filter from file]: :_files' \ - '-L+[prepend a directory to the module search path]:_directories' \ + \*{-L+,--library-path}'[prepend a directory to the module search path]:_directories' \ '(-e --exit-status)'{-e,--exit-status}'[report "false" and "null" results via exit code]' \ '*--arg[pre-set a variable to a string]:variable name: :value (string)' \ '*--argjson[pre-set a variable to an object]:variable name: :value (JSON)' \ diff --git a/Completion/Unix/Command/_ldd b/Completion/Unix/Command/_ldd index 98ac41e14..bbac09225 100644 --- a/Completion/Unix/Command/_ldd +++ b/Completion/Unix/Command/_ldd @@ -26,6 +26,17 @@ else '-s[display search path used]' '-v[displays all dependency relationships]' ) + ;| + solaris2.<11->) + args+=( + '-c[disable configuration file used]' + '-D[skip deferred dependency loading]' + '-p[display unresolved parent and external references]' + '-S+[specify system root]:directory:_directories' + '-w[display unresolved weak references]' + '(- *)'{-\?,--help}'[display usage information]' + '(- *)'{-V,--version}'[display version information]' + ) ;; freebsd*) args=( diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less index b7e658d7e..f20a50818 100644 --- a/Completion/Unix/Command/_less +++ b/Completion/Unix/Command/_less @@ -88,17 +88,25 @@ _arguments -S -s -A "[-+]*" \ '(-\" --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 of columns or fraction of screen width [.5]" \ + '--autosave=[set additional actions which cause the history file to be saved]: : _values -s "" action + "(*)m[setting or clearing a mark]" + "(*)/[searching]" + "(*)\![running a shell command]" + "(m / !)\*[any action; same as m/!]"' \ + '--emouse=[enable mouse features]:mouse feature:_sequence compadd - vscroll vdrag hscroll hdrag lclick rclick scroll drag hmove vmove move click all' \ + '--end-prompt=[specify string to be printed after erasing the prompt]:string' \ '--exit-follow-on-close[exit F command on a pipe when writer closes pipe]' \ '--file-size[automatically determine the size of the input file]' \ '--follow-name[the F command changes file if the input file is renamed]' \ '--form-feed[stop scrolling when a form feed character (^L) is reached]' \ '--header=[set header size]:lines,columns,first-line' \ + '--hilite-target=[highlight the target line]' \ '--incsearch[search file as each pattern character is typed in]' \ '--intr=[specify interrupt character instead of ^X]:char [^X]' \ '--line-num-width=[set the width of line number field]:width [7]' \ '--match-shift=[with -S, shift horizontally to make the match visible]:number of columns or fraction of screen width' \ '--modelines=[look for vim modelines]:number of lines to search' \ - '(--MOUSE)--mouse[enable mouse input]' \ + '(--MOUSE)--mouse[enable mouse clicking and vertical scrolling]' \ '(--mouse)--MOUSE[enable mouse input, wheel down moves backwards in the file]' \ "--no-edit-warn[don't warn when using v command on a file opened by LESSOPEN]" \ '--no-histdups[remove duplicates from command history]' \ @@ -123,6 +131,7 @@ _arguments -S -s -A "[-+]*" \ "E[multi-file]" "F[from first line]" "K[highlight]" "N[non-matching]" "R[literal]" "W[wrap]" -' \ '--show-preproc-errors[display a message if preprocessor exits with an error status]' \ + '--past-eof[scrolling commands continue past end of file]' \ '--status-col-width=[set the width of the -J status column]:width [2]' \ '--status-line[highlight or color the entire line containing a mark]' \ '--use-backslash[subsequent options use backslash as escape char]' \ diff --git a/Completion/Unix/Command/_ln b/Completion/Unix/Command/_ln index 05c89bac2..75e63514a 100644 --- a/Completion/Unix/Command/_ln +++ b/Completion/Unix/Command/_ln @@ -10,7 +10,7 @@ args=( ) _pick_variant -r variant -b zsh gnu='(GNU|uutils)' $OSTYPE --version -case $variant; in +case $variant in gnu) opts=() args=( diff --git a/Completion/Unix/Command/_loadkeys b/Completion/Unix/Command/_loadkeys deleted file mode 100644 index d0a87b6f6..000000000 --- a/Completion/Unix/Command/_loadkeys +++ /dev/null @@ -1,19 +0,0 @@ -#compdef loadkeys - -case $OSTYPE in - linux*) - _arguments \ - '(--clearcompose -c)'{--clearcompose,-c}'[clear kernel compose table]' \ - '(--default -d)'{--default,-d}'[load default keymap file]' \ - '(--help -h)'{--help,-h}'[display help information]' \ - '(--mktable -m)'{--mktable,-m}'[output a "defkeymap.c" to stdout]' \ - '(--clearstrings)'{--clearstrings,-s}'[clear kernel string table]' \ - '*'{--verbose,-v}'[print more details]' \ - ':keymap:_files -W /usr/share/keymaps' - ;; - solaris*) - _files -W /usr/share/lib/keytables - ;; - - *) _default;; -esac diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls index a92b91b31..5cd2e7f54 100644 --- a/Completion/Unix/Command/_ls +++ b/Completion/Unix/Command/_ls @@ -108,6 +108,12 @@ if ! _pick_variant gnu='(GNU|uutils)' unix --version; then '-Z[display MAC label]' ) fi + if [[ $OSTYPE = freebsd<15->.* ]]; then + arguments+=( + '(--group-directories-first)--group-directories=:order:(first last)' + '(--group-directories)--group-directories-first' + ) + fi if [[ $OSTYPE = darwin* ]]; then arguments+=( '-@[display extended attribute keys and sizes in long listing]' @@ -118,14 +124,18 @@ if ! _pick_variant gnu='(GNU|uutils)' unix --version; then '-%[distinguish dataless files and directories with a %]' ) fi - if [[ $OSTYPE = solaris* ]]; then + if [[ $OSTYPE = (aix|solaris)* ]]; then arguments+=( '(-q)-b[print octal escapes for control characters]' '(-l -1 -C -m -x)-o[long listing but without group information]' '(-l -t -s -r -a)-f[interpret each argument as a directory]' + '-H[follow symlinks on the command line]' + ) + fi + if [[ $OSTYPE = solaris* ]]; then + arguments+=( '(-E -l)-e[long listing with full and consistent date/time]' '(-e -l)-E[long listing with ISO format date/time]' - '-H[follow symlinks on the command line]' '-v[long listing with verbose ACL information]' '-V[long listing with compact ACL information]' '-@[long listing with marker for extended attribute information]' diff --git a/Completion/Unix/Command/_lsof b/Completion/Unix/Command/_lsof index 60f59a589..a6dd4a03e 100644 --- a/Completion/Unix/Command/_lsof +++ b/Completion/Unix/Command/_lsof @@ -119,7 +119,7 @@ case $state in states) if compset -P 1 '*:'; then _sequence _wanted states expl state compadd - -M 'm:{a-z}={A-Z}' \ - CLOSED IDLE BOUND LISTEN ESTABLISHED SYN_SENT SYN_RCDV ESTABLISHED \ + CLOSED IDLE BOUND LISTEN ESTABLISHED SYN_SENT SYN_RCVD \ CLOSE_WAIT FIN_WAIT1 CLOSING LAST_ACK FIN_WAIT_2 TIME_WAIT && ret=0 else compset -S ':*' || suf=( -qS : ) diff --git a/Completion/Unix/Command/_lua b/Completion/Unix/Command/_lua index 3a1ef4fd7..0a4facbe3 100644 --- a/Completion/Unix/Command/_lua +++ b/Completion/Unix/Command/_lua @@ -1,4 +1,4 @@ -#compdef lua -P lua[0-9.-]## +#compdef lua flua -P lua[0-9.-]## # Complete lua library names. We go out of our way here to support sub-modules # (of the format foo.bar.baz), even though the way `lua -l` handles those isn't diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man index 28bc12fe7..888d73895 100644 --- a/Completion/Unix/Command/_man +++ b/Completion/Unix/Command/_man @@ -76,7 +76,7 @@ _man() { [[ $variant == (freebsd)* ]] && args+=( '(: -)-h[display help information]' # @todo Could enumerate these - '-m[search manual of specified architecture]:architecture' + '-m+[search manual of specified architecture]:architecture' '-o[use non-localized man pages]' '(-a)-S+[specify manual sections to search]: :->sects' ) @@ -135,7 +135,7 @@ _man() { [[ $variant == openbsd* ]] && args+=( "(${(j< >)modes})-l+[format and display specified file]:*:::manual file:_files" # @todo Could enumerate these - '-S[search manual of specified architecture]:architecture' + '-S+[search manual of specified architecture]:architecture' ) [[ $variant == solaris* ]] && args+=( "(${(j< >)modes})-l[display file locations]" diff --git a/Completion/Unix/Command/_monotone b/Completion/Unix/Command/_monotone deleted file mode 100644 index bcaab87f0..000000000 --- a/Completion/Unix/Command/_monotone +++ /dev/null @@ -1,43 +0,0 @@ -#compdef mtn - -local -a cmds -cmds=( - automate:automation db:database fdiff:debug fload:debug fmerge:debug - get_roster:debug identify:debug rcs_import:debug annotate:informative - cat:informative complete:informative diff:informative help:informative - list:informative log:informative ls:informative show_conflicts:informative - status:informative cert:key+cert chkeypass:key+cert dropkey:key+cert - genkey:key+cert trusted:key+cert pull:network push:network serve:network - sync:network privkey:packet\ i/o pubkey:packet\ i/o read:packet\ i/o - cvs_import:rcs approve:review comment:review disapprove:review tag:review - testresult:review checkout:tree co:tree explicit_merge:tree heads:tree - merge:tree merge_into_dir:tree migrate_workspace:tree propagate:tree - refresh_inodeprints:tree setup:tree set:vars unset:vars add:workspace - attr:workspace ci:workspace commit:workspace drop:workspace mv:workspace - pivot_root:workspace pluck:workspace rename:workspace revert:workspace - rm:workspace update:workspace -) - -_arguments \ - '--brief[print a brief version of the normal output]' \ - '--confdir[set location of configuration directory]:confdir:_files -/' \ - '(-d --db)'{-d,--db}'[set name of database]:dbname' \ - '--debug[print debug log to stderr while running]' \ - '--dump[file to dump debugging log to, on failure]:dumpfile:_files' \ - '--full-version[print detailed version number, then exit]' \ - '(-h --help)'{-h,--help}'[display help message]' \ - '(-k --key)'{-k,--key}'[set key for signatures]:key:' \ - '--keydir[set location of key store]:keydir:_files -/' \ - '--log[file to write the log to]:logfile:_files' \ - '--norc[do not load ~/.monotone/monotonerc or _MTN/monotonerc lua files]' \ - '--nostd[do not load standard lua hooks]' \ - '--pid-file[record process id of server]:arg:' \ - '--quiet[suppress verbose, informational and progress messages]' \ - '--rcfile[load extra rc file]:extra rcfile:_files' \ - '--reallyquiet[suppress warning, verbose, informational and progress messages]' \ - '--root[limit search for workspace to specified root]:root:_files -/' \ - '--ticker[set ticker style]:ticker style:(count dot none)' \ - '--version[print version number, then exit]' \ - '(-@ --xargs)'{-@,--xargs}'[insert command line arguments taken from the given file]:file:_files' \ - '1:command: _describe -t commands command cmds' \ - '*:file:_files' diff --git a/Completion/Unix/Command/_moosic b/Completion/Unix/Command/_moosic deleted file mode 100644 index 475a0c75c..000000000 --- a/Completion/Unix/Command/_moosic +++ /dev/null @@ -1,487 +0,0 @@ -#compdef moosic - -_moosic_add_cmds() { - - # querying for information - typeset -a queries - queries=( - "help:print brief description of command" - "current:print name of currently playing song" - "current-time:print the amount of time the current song has been playing" - "list:print the list of items in the current song queue" - "plainlist:print the current song queue without numbering each line" - "history:print a list of items that were recently played" - {status,state}":print the current state of the music daemon" - "length:print the number of items in the queue" - "ispaused:show whether the current song is paused or not" - "islooping:show whether the server is in loop mode" - "isadvancing:show whether the server is advancing through the song queue" - "version:print version information for client and server" - ) - - - # appending to song queue - typeset -a appending - appending=( - {append,add}":add the files to be played to the end of the song queue" - {pl-append,pl-add}":add the items listed in the given playlist files to end of queue" - "prepend:add the files to be played to the beginning of the song queue" - "pl-prepend:add the items in the given playlist files to beginning of queue" - "mixin:add the files to the song queue and reshuffle the entire queue" - "pl-mixin:add items in given playlist files to song queue and reshuffle the entire queue" - "replace:replace the current contents of the song queue with files listed" - "pl-replace:replace current contents of song queue with songs given in playlists" - "insert:insert the given items at a given point in the song queue" - "pl-insert:insert items from playlist files at specified point in queue" - "putback:reinsert current song at start of song queue" - "stagger-add:adds file list to end of queue after rearranging queue into staggered order" - "stagger-merge:adds given file list to queue in interleaved fashion" - "interval-add:inserts given songs with regular frequency specified by interval argument" - ) - - # removing - typeset -a removing - removing=( - {cut,del}":removes all song queue items in given range" - "crop:removes all song queue items that do not fall within given range" - "remove:remove all song queue items matching any one of given regexps" - "filter:remove all queue items not matching all given regexps" - "clear:clear song queue" - "wipe:clear song queue and stop current song" - ) - - # rearranging - typeset -a rearranging - rearranging=( - "move:move all items in given range to new position in song queue" - "move-pattern:moves all items matching the given regexp to new position" - "swap:trade places of songs in two specified ranges" - {shuffle,reshuffle}":reshuffle song queue within an optional range" - "sort:sort queue within optional range" - "reverse:reverse order of song queue" - "partial-sort:sort items matching each regexp" - "stagger:stagger items matching each regexp" - "sub:perform regular expression substitution on all items in queue" - "suball:like sub, but replace all occurrences of the pattern" - ) - - # general management - typeset -a general - general=( - "next:jumps ahead, number of songs optional" - "previous:retreats to previously played song" - "goto:jumps to next song matching regexp" - "gobackto:jumps back to most recent previous song matching regexp" - "noadvance:halt queue advancement" - "advance:resume queue advancement" - "toggle-advance:toggle queue advancement" - "stop:stop playing current song, stop processing queue, put current song back" - "pause:suspend current song to resume it later" - "unpause:unpause current song" - "play:resume playing" - "loop:turn loop mode on" - "noloop:turn loop mode off" - "toggle-loop:toggle loop mode" - "reconfigure:daemon reload configuration file" - "showconfig:show daemon filetype associations" - "start-server:starts new instance of daemon with given options" - {quit,exit,die}":quit daemon" - ) - - _describe queries queries -J queries - _describe appending appending -J appending - _describe removing removing -J removing - _describe rearranging rearranging -J rearranging - _describe general general -J general -} - -_moosic() { - typeset context state line - typeset -A opt_args - - typeset -a filelist_opts - filelist_opts=( - '(-g --shuffle-global)'{-g,--shuffle-global}'[shuffle filelist after directory expansion]' - '(-d --shuffle-dir)'{-d,--shuffle-dir}'[shuffle results of expanding the directories]' - '(-a --shuffle-args)'{-a,--shuffle-args}'[shuffle actual command line arguments]' - '(-o --inorder)'{-o,--inorder}'[do not shuffle filelist]' - '(-s --sort)'{-s,--sort}'[sort filelist lexicographically after expansion]' - '(-r --no-recurse)'{-r,--no-recurse}'[do not recurse through directories]' - '(-n --no-file-munge)'{-n,--no-file-munge}'[do not modify names in expanded filelist]' - '(-f --auto-find)'{-f,--auto-find}'[perform fuzzy search for music files]' - '(-F --auto-grep)'{-F,--auto-grep}'[like --auto-find but with regexp]' - '(-U --allow-unplayable)'{-U,--allow-unplayable}'[allow addition of unknown song types]' - ) - - typeset -a auto_opts - auto_opts=( - '(-m --music-dir)'{-m,--music-dir}'[directory used for auto-find, auto-grep]:directory:_files' - ) - - typeset -a main_opts - main_opts=( - '(-i --ignore-case)'{-i,--ignore-case}'[treat regexps as if they are case-insensitive]' - '(-S --showcommands)'{-S,--showcommands}'[show all moosic commands, then exit]' - '(-h --help)'{-h,--help}'[print help message then exit]' - '(-v --version)'{-v,--version}'[print version information, then exit]' - '(-c --config-dir)'{-c,--config-dir}'[configuration directory]:directory:_files' - '(-t --tcp)'{-t,--tcp}'[talk to server at specified host and port]:host\:port:' - '(-N --no-startserver)'{-N,--no-startserver}'[do not start moosicd server]' - ) - - typeset -a list_opts - list_opts=( - '(-C --current-in-list)'{-C,--current-in-list}'[print currently playing song in list]' - ) - - # GLOBAL ARGUMENTS - # do not use the -A option here. It will break the processing of - # positional arguments. - _arguments $main_opts $list_opts $auto_opts $filelist_opts \ - '1: :->cmd' \ - '*:: :->posarg' - - if [[ $state == cmd ]]; then - _moosic_add_cmds - elif [[ $state == posarg ]]; then - _moosic_cmd_${line[1]} - fi -} - -# Do something, but only if the current word is 2. -_do2() { - if (( CURRENT == 2 )); then - $@ - else - _message 'no more arguments' - fi -} - -### QUERY COMMANDS - -_moosic_cmd_help() { - _do2 '_moosic_add_cmds' -} - -_moosic_cmd_current() { - _message 'no arguments' -} - -_moosic_cmd_current-time() { - _do2 '_message' 'strftime string' -} - -_moosic_cmd_list() { - _do2 '_message' 'range' -} - -_moosic_cmd_plainlist() { - _do2 '_message' 'range' -} - -_moosic_cmd_history() { - _do2 '_message' 'maximum number of entries' -} - -_moosic_cmd_status() { - _message 'no arguments' -} - -_moosic_cmd_state() { - _message 'no arguments' -} - -_moosic_cmd_length() { - _message 'no arguments' -} - -_moosic_cmd_ispaused() { - _message 'no arguments' -} - -_moosic_cmd_islooping() { - _message 'no arguments' -} - -_moosic_cmd_isadvancing() { - _message 'no arguments' -} - -_moosic_cmd_version() { - _message 'no arguments' -} - -### APPENDING COMMANDS - -_moosic_song_files() -{ - _arguments -A '-*' $main_opts $filelist_opts $auto_opts \ - '*:song file:_files' -} - -_moosic_cmd_append() { - _moosic_song_files -} - -_moosic_cmd_add() { - _moosic_song_files -} - -_moosic_cmd_pl-append() { - _moosic_song_files -} - -_moosic_cmd_pl-add() { - _moosic_song_files -} - -_moosic_cmd_prepend() { - _moosic_song_files -} - -_moosic_cmd_pl-prepend() { - _moosic_song_files -} - -_moosic_cmd_mixin() { - _moosic_song_files -} - -_moosic_cmd_pl-mixin() { - _moosic_song_files -} - -_moosic_cmd_replace() { - _moosic_song_files -} - -_moosic_cmd_pl-replace() { - _moosic_song_files -} - -_moosic_cmd_insert() { - _moosic_song_files -} - -_moosic_cmd_pl-insert() { - _moosic_song_files -} - -_moosic_cmd_putback() { - _message 'no arguments' -} - -_moosic_cmd_stagger-add() { - _moosic_song_files -} - -_moosic_cmd_stagger-merge() { - _moosic_song_files -} - -_moosic_cmd_interval-add() { - _arguments -A '-*' $main_opts $filelist_opts \ - '1:interval:' \ - '*:song file:_files' -} - -### REMOVING COMMANDS - -_moosic_cmd_cut() { - _do2 '_message' 'range' -} - -_moosic_cmd_del() { - _do2 '_message' 'range' -} - -_moosic_cmd_crop() { - _do2 '_message' 'range' -} - -_moosic_cmd_remove() { - _do2 '_message' 'regex' -} - -_moosic_cmd_filter() { - _do2 '_message' 'regex' -} - -_moosic_cmd_clear() { - _message 'no arguments' -} - -_moosic_cmd_wipe() { - _message 'no arguments' -} - -### REARRANGING COMMANDS - -_moosic_cmd_move() { - _arguments -A '-*' $main_opts \ - '1:range:' \ - '2:index:' \ - '*:no more arguments:' -} - -_moosic_cmd_move-pattern() { - _arguments -A '-*' $main_opts \ - '1:regex:' \ - '2:index:' \ - '*:no more arguments:' -} - -_moosic_cmd_swap() { - _arguments -A '-*' $main_opts \ - '1:range:' \ - '2:range:' \ - '*:no more arguments:' -} - -_moosic_cmd_shuffle() { - _arguments -A '-*' $main_opts \ - '1:range (optional):' \ - '*:no more arguments:' -} - -_moosic_cmd_reshuffle() { - _arguments -A '-*' $main_opts \ - '1:range (optional):' \ - '*:no more arguments:' -} - -_moosic_cmd_sort() { - _arguments -A '-*' $main_opts \ - '1:range (optional):' \ - '*:no more arguments:' -} - -_moosic_cmd_reverse() { - _arguments -A '-*' $main_opts \ - '1:range (optional):' \ - '*:no more arguments:' -} - -_moosic_cmd_partial-sort() { - _do2 '_message' 'regex' -} - -_moosic_cmd_stagger() { - _do2 '_message' 'regex' -} - -_moosic_cmd_sub() { - _arguments -A '-*' $main_opts \ - '1:pattern:' \ - '2:replacement:' \ - '3:range (optional):' \ - '*:no more arguments:' -} - -_moosic_cmd_suball() { - _arguments -A '-*' $main_opts \ - '1:pattern:' \ - '2:replacement:' \ - '3:range (optional):' \ - '*:no more arguments:' -} - -### GENERAL COMMANDS - -_moosic_cmd_next() { - if (( CURRENT == 2 )); then - - typeset -a display display_cmd - if zstyle -a ":completion:${curcontext}:next" \ - 'command' display_cmd; then - $display_cmd - else - display=(${(f)"$(moosic list)"}) - fi - - typeset -a numbers - numbers=({1..${#display}}) - - compadd -V songs -d display -a numbers - else - _message 'no more arguments' - fi -} - -_moosic_cmd_previous() { - _do2 '_message' 'number to skip' -} - -_moosic_cmd_goto() { - _do2 '_message' 'regex' -} - -_moosic_cmd_gobackto() { - _do2 '_message' 'regex' -} - -_moosic_cmd_noadvance() { - _message 'no arguments' -} - -_moosic_cmd_advance() { - _message 'no arguments' -} - -_moosic_cmd_toggle-advance() { - _message 'no arguments' -} - -_moosic_cmd_stop() { - _message 'no arguments' -} - -_moosic_cmd_pause() { - _message 'no arguments' -} - -_moosic_cmd_unpause() { - _message 'no arguments' -} - -_moosic_cmd_play() { - _message 'no arguments' -} - -_moosic_cmd_loop() { - _message 'no arguments' -} - -_moosic_cmd_noloop() { - _message 'no arguments' -} - -_moosic_cmd_toggle-loop() { - _message 'no arguments' -} - -_moosic_cmd_reconfigure() { - _message 'no arguments' -} - -_moosic_cmd_showconfig() { - _message 'no arguments' -} - -_moosic_cmd_start-server() { - _message 'options' -} - -_moosic_cmd_quit() { - _message 'no arguments' -} - -_moosic_cmd_exit() { - _message 'no arguments' -} - -_moosic_cmd_die() { - _message 'no arguments' -} - -_moosic "$@" diff --git a/Completion/Unix/Command/_mount b/Completion/Unix/Command/_mount index bf75aa118..bdabd3791 100644 --- a/Completion/Unix/Command/_mount +++ b/Completion/Unix/Command/_mount @@ -293,8 +293,8 @@ if (( ! $+_fs_any )); then 'sync[do I/O synchronously]' ) _fs_cdfs=( - '(nodefperm)defperm[ignore permission bits]' - '(defperm)defperm[use permission bits]' + '(defperm)nodefperm[ignore permission bits]' + '(nodefperm)defperm[use permission bits]' 'noversion[strip off version extension]' 'rrip[use RRIP extensions]' ) diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc index e3383e56d..83700d828 100644 --- a/Completion/Unix/Command/_mpc +++ b/Completion/Unix/Command/_mpc @@ -234,7 +234,7 @@ _mpc_play() { } _mpc_seek() { - _message -e position 'position ([+-][HH:MM:SS]|<0-100>%%)' + _message -e position 'position ([+-][HH:MM:SS]|<0-100>%)' } _mpc_seekthrough() { @@ -380,7 +380,7 @@ local mpccmd="$words[1]" _arguments -C \ '(-q --quiet --no-status -v --verbose)'{-v,--verbose}'[give verbose output]' \ '(-q --quiet --no-status -v --verbose)'{-q,--quiet,--no-status}'[prevent printing song status on completion]' \ - '(-h --host)'{-h,--host=}'[connect to specified host]:_hosts' \ + '(-h --host)'{-h,--host=}'[connect to specified host]: :_hosts' \ '(-p --port)'{-p,--port=}'[connect to server port]:port' \ '(-f --format)'{-f,--format=}'[specify the format of song display]:format string:->formats' \ '(-w --wait)'{-w,--wait}'[wait for operation to finish (e.g. database update)]' \ diff --git a/Completion/Unix/Command/_mtr b/Completion/Unix/Command/_mtr index 9a73cfbd4..c5f7ea129 100644 --- a/Completion/Unix/Command/_mtr +++ b/Completion/Unix/Command/_mtr @@ -9,6 +9,7 @@ _arguments -s -S \ '(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]' \ '(H -U --max-unknown)'{-U+,--max-unknown=}'[specify maximum unknown hosts]:maximum [5]' \ + '(H -E --max-display-path)'{-E+,--max-display-path=}'[specify maximum number of ECMP paths to display]:ECMP paths [8]' \ '(H -P --port)'{-P+,--port=}'[specify target port for TCP, SCTP or UDP]:port' \ '(H -L --localport -T --tcp -S --sctp)'{-L+,--localport=}'[specify source port number for UDP]' \ '(H -s --psize 2)'{-s+,--psize=}'[packet size]:packet size (bytes)' \ @@ -41,6 +42,8 @@ _arguments -s -S \ "I[interarrival jitter]"' \ '(H -z --aslookup -y --ipinfo)'{-y+,--ipinfo=}'[select IP information in output]:information:((0\:display\ AS\ number 1\:display\ IP\ prefix 2\:display\ country\ code 3\:display\ RIR 4\:display\ allocation\ date))' \ '(H -y --ipinfo -z --aslookup)'{-z,--aslookup}'[display AS number]' \ + '(H)--ipinfo_provider4=[specify provider for IPv4 AS lookups]:domain [origin.asn.cymru.com]' \ + '(H)--ipinfo_provider6=[specify provider for IPv6 AS lookups]:domain [origin6.asn.cymru.com]' \ '(H)1:destination host:_hosts' \ '(H)2:packet size (bytes)' \ + '(H)' \ diff --git a/Completion/Unix/Command/_mv b/Completion/Unix/Command/_mv index cc33819b9..707f848c5 100644 --- a/Completion/Unix/Command/_mv +++ b/Completion/Unix/Command/_mv @@ -3,7 +3,7 @@ local args variant aopts=( -A '-*' ) _pick_variant -r variant -b zsh gnu='(GNU|uutils)' $OSTYPE --version -case $variant; in +case $variant in gnu) aopts=() args=( diff --git a/Completion/Unix/Command/_myrepos b/Completion/Unix/Command/_myrepos index d26c1245b..b667746e8 100644 --- a/Completion/Unix/Command/_myrepos +++ b/Completion/Unix/Command/_myrepos @@ -61,7 +61,7 @@ case $state in "offline:advise mr that it is in offline mode" "online:advise mr that it is in online mode" "remember:remember a command to be run later" - "help:display this help." + "help:display help." ) mr_alias=( diff --git a/Completion/Unix/Command/_nano b/Completion/Unix/Command/_nano new file mode 100644 index 000000000..29fb5337a --- /dev/null +++ b/Completion/Unix/Command/_nano @@ -0,0 +1,87 @@ +#compdef nano rnano + +local -a args context state state_descr line expl +local -A opt_args + +args=( + '(-A --smarthome)'{-A,--smarthome}'[enable smart home key]' + '(-B --backup)'{-B,--backup}'[save backups of existing files]' + '(-C --backupdir)'{-C+,--backupdir=}'[save uniquely numbered backups to specified directory]:backup directory:_directories' + '(-D --boldtext)'{-D,--boldtext}'[use bold instead of reverse video text]' + '(-E --tabstospaces)'{-E,--tabstospaces}'[convert typed tabs to spaces]' + '(-F --multibuffer)'{-F,--multibuffer}'[read file into new buffer by default]' + '(-G --locking)'{-G,--locking}'[use vim-style lock files]' + '(-H --historylog)'{-H,--historylog}'[remember search/replace strings]' + '(-I --ignorercfiles)'{-I,--ignorercfiles}"[don't look at nanorc files]" + '(-J --guidestripe)'{-J+,--guidestripe=}'[show vertical stripe at specified column]: :_numbers -l1 "column number"' + '(-K --rawsequences)'{-K,--rawsequences}'[interpret escape sequences directly instead of via ncurses]' + '(-L --nonewlines)'{-L,--nonewlines}"[don't automatically add EOF newline]" + '(-M --trimblanks)'{-M,--trimblanks}'[trim trailing whitespaces when hard-wrapping]' + '(-N --noconvert -u --unix)'{-N,--noconvert}"[don't convert files from DOS/Mac format]" + '(-O --bookstyle)'{-O,--bookstyle}'[when justifying, leading whitespace means new paragraph]' + '(-P --positionlog)'{-P,--positionlog}'[remember cursor position]' + '(-Q --quotestr)'{-Q+,--quotestr=}'[specify regular expression to match quoting]:quoting regex [^([ \t]*([!#%\:;>|}]|//))+]' + '(-R --restricted)'{-R,--restricted}'[restrict access to the file system]' + '(-S --softwrap)'{-S,--softwrap}'[soft-wrap long lines]' + '(-T --tabsize)'{-T+,--tabsize=}'[specify tab width]: :_numbers -u columns -l1 -d8 "tab width"' + '(-c --constantshow -U --quickblank)'{-U,--quickblank}'[hide status-bar messages after next keystroke]' + '(- : *)'{-V,--version}'[display version information]' + '(-W --wordbounds -X --wordchars)'{-W,--wordbounds}'[detect word boundaries more accurately]' + '(-W --wordbounds -X --wordchars)'{-X+,--wordchars=}'[specify word characters]:word characters' + '(-Y --syntax)'{-Y+,--syntax=}'[specify syntax-highlighting definition]: :->syntaxes' + '(-Z --zap)'{-Z,--zap}'[let Backspace/Delete erase marked region]' + '(-a --atblanks)'{-a,--atblanks}'[when soft wrapping, wrap at whitespace]' + '(-b --breaklonglines -w --nowrap)'{-b,--breaklonglines}'[automatically hard-wrap long lines]' + '(-c --constantshow -U --quickblank)'{-c,--constantshow}'[constantly report cursor position in status bar]' + '(-d --rebinddelete)'{-d,--rebinddelete}'[fix Backspace/Delete confusion problem]' + '(-e --emptyline)'{-e,--emptyline}'[keep line below title bar empty]' + '(-f --rcfile)'{-f+,--rcfile=}'[use only specified file for configuring nano]:rc file:_files' + '(-g --showcursor)'{-g,--showcursor}'[show cursor in file browser and help viewer]' + '(- : *)'{-h,--help}'[display help information]' + '(-i --autoindent)'{-i,--autoindent}'[automatically indent new lines]' + '(-j --jumpyscrolling)'{-j,--jumpyscrolling}'[scroll per half-screen, not per line]' + '(-k --cutfromcursor)'{-k,--cutfromcursor}"[make 'cut text' (^k) cut from cursor to end of line]" + '(-l --linenumbers)'{-l,--linenumbers}'[show line numbers]' + '(-m --mouse)'{-m,--mouse}'[enable mouse support]' + '(-n --noread)'{-n,--noread}'[only write to named files (do not read)]' + '(-o --operatingdir)'{-o+,--operatingdir=}'[specify operating directory]:operating directory:_directories' + '(-p --preserve -/ --modernbindings)'{-p,--preserve}'[preserve XON (^q) and XOFF (^s)]' + '(-q --indicator)'{-q,--indicator}'[show position indicator (scroll bar)]' + '(-r --fill)'{-r+,--fill=}'[specify width for hard-wrap and justify]: :_numbers -u columns -Nd-8 "wrap width"' + '(-s --speller)'{-s+,--speller=}'[specify spell-checking program]:spell-checking program/command:_cmdstring' + '(-t --saveonexit)'{-t,--saveonexit}'[save changes on exit without prompting]' + '(-N --noconvert -u --unix)'{-u,--unix}'[save files by default in Unix format]' + '(-v --view)'{-v,--view}'[disallow editing (read-only mode)]' + '(-b --breaklonglines -w --nowrap)'{-w,--nowrap}"[don't hard-wrap long lines]" + '(-x --nohelp)'{-x,--nohelp}"[don't show help lines at bottom]" + '(-y --afterends)'{-y,--afterends}'[make Ctrl+Right and Ctrl+Delete stop at word ends]' + '(- : *)'{-z,--listsyntaxes}'[list names of available syntax definitions]' + '(-! --magic)'{-!,--magic}'[use libmagic to determine syntax if necessary]' + '(-@ --colonparsing)'{-@,--colonparsing}'[accept filename:linenumber notation on command line]' + '(-% --stateflags)'{-%,--stateflags}'[show state flags in title bar]' + '(-_ --minibar)'{-_,--minibar}'[hide title bar and show mini bar at bottom]' + '(-0 --zero)'{-0,--zero}'[hide UI, use whole terminal]' + '(-/ --modernbindings)'{-/,--modernbindings}'[use better-known key bindings]' + '*: :->files' +) + +_arguments -s -S : $args && ret=0 + +case $state in + syntaxes) + local -a tmp + tmp=( ${(f)"$( _call_program syntaxes $words[1] --listsyntaxes )"} ) + tmp=( ${tmp:#(#i)*available syntax*} ) + tmp=( ${(@Z<n>)tmp} ) + _wanted syntaxes expl syntax compadd -a - tmp && ret=0 + ;; + + files) + _alternative \ + 'line-pattern: :_guard "(|+*)" "+line[,column] or +[crCR]{/|?}pattern"' \ + 'files: :_files' \ + && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_netstat b/Completion/Unix/Command/_netstat index 35d639f99..256337e22 100644 --- a/Completion/Unix/Command/_netstat +++ b/Completion/Unix/Command/_netstat @@ -14,7 +14,7 @@ case $OSTYPE in linux-gnu) families=( '(-4 --inet)'{-4,--inet} - '(-6 --inet)'{-4,--inet6} + '(-6 --inet)'{-6,--inet6} '(-A --protocol)'{-A+,--protocol=}':protocol:_sequence compadd - inet inet6 unix ipx ax25 netrom ddp bluetooth' --unix -x --ip --tcpip --ax25 --x25 --rose --ash --bluetooth --ipx --netrom --ddp --appletalk --econet --ec diff --git a/Completion/Unix/Command/_ngrep b/Completion/Unix/Command/_ngrep index 924597826..28d6ddc88 100644 --- a/Completion/Unix/Command/_ngrep +++ b/Completion/Unix/Command/_ngrep @@ -25,6 +25,8 @@ _arguments -s -S \ '-S+[set the upper limit on size of packets matched]:size (bytes)' \ '(-x)-W+[set the dump format]:packet display format:(normal byline single none)' \ '-c+[force the column width to the specified size]:columns' \ + '-C[colorize matches in packet contents output]' \ + '-u[show payload as UTF-8 characters]' \ '-P+[set the non-printable display char to what is specified]:character [.]' \ '-F+[read the bpf filter from the specified file]:file:_files' \ '-N[show sub protocol number]' \ diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm index a78eb7068..725ed3c39 100644 --- a/Completion/Unix/Command/_nm +++ b/Completion/Unix/Command/_nm @@ -69,7 +69,13 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu '--special-syms[include special symbols in the output]' '--synthetic[display synthetic symbols as well]' "--target=[target object format]:target:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })" - '--unicode=[specify how to treat UTF-8 encoded unicode characters]:how_to_treat:(default show invalid hex escape highlight)' + '--unicode=[specify how to treat UTF-8 encoded unicode characters]: : _values "treatment [default]" + {d,default}"[no special treatment]" + {l,locale}"[convert to current locale]" + {i,invalid}"[not part of a valid string]" + {x,hex}"[<> enclosed hex byte sequences]" + {e,escape}"[escape sequences (\\\\uxxxx)]" + {h,highlight}"[escape sequences highlighted in red]"' \ '(-W --no-weak)'{-W,--no-weak}'[ignore weak symbols]' '--with-symbol-versions[display version strings after symbol names]' '--without-symbol-versions[not display of symbol version information]' diff --git a/Completion/Unix/Command/_nmap b/Completion/Unix/Command/_nmap index 2a507baa3..4325a5317 100644 --- a/Completion/Unix/Command/_nmap +++ b/Completion/Unix/Command/_nmap @@ -1,63 +1,125 @@ #compdef nmap -local curcontext="$curcontext" state line suf ret=1 +local curcontext="$curcontext" ign dir ret=1 +local -a state line expl suf +local -A opt_args +local -aU scripts categories -_arguments -C \ +(( $#words == 2 )) || ign='!(- *)' +_arguments -s -S -C \ + '!(-6)-4' \ '!-sI:zombie host:_hosts' \ - '!-P'{T,S,U}'+:port list' \ - '*-s-[specify scan type]:scan type:((S\:TCP\ SYN\ scan T\:TCP\ connect\(\)\ scan F\:stealth\ FIN\ scan X\:stealth\ Xmas\ tree\ scan N\:stealth\ null\ scan P\:ping\ scanning U\:UDP\ scan O\:IP\ protocol\ scan I\:idle\ scan A\:ACK\ scan W\:window\ scan R\:RPC\ scan L\:list\ scan V\:version\ detection))' \ - '-b[specify ftp relay host]:ftp relay host:_hosts' \ - '*-P-[specify probe types and options]:probe type/options:->probe-opts' \ - '-A[enable OS detection and version scanning]' \ - '-O[enable remote OS identification]' \ - '-6[enable IPv6 support]' \ - '-I[enable TCP reverse ident scanning]' \ - '-f[use tiny fragmented IP packets]' \ - '*-v[verbose mode]' \ - '-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]' \ + '!-P'{S,A,U,Y}'+:port list' \ + '!-PO+:protocol list' \ + '!(-F -p --exclude-ports)-sn' \ '-iL[read target specifications from file]:file:_files' \ '-iR[scan random hosts]:num hosts' \ - '-p[specify ports to try]:port numbers' \ + '--exclude[specify hosts/networks to exclude]:host list:_sequence _hosts' \ + '--excludefile[use exclude list from a file]:file:_files' \ + '*-s-[specify scan type]:scan type:((S\:TCP\ SYN\ scan T\:TCP\ connect\(\)\ scan F\:stealth\ FIN\ scan X\:stealth\ Xmas\ tree\ scan N\:stealth\ null\ scan P\:ping\ scanning U\:UDP\ scan O\:IP\ protocol\ scan I\:idle\ scan A\:TCP\ ACK\ scan W\:TCP\ window\ scan M\:TCP\ Maimon\ scan R\:RPC\ scan L\:list\ scan Y\:SCTP\ INIT\ scan Z\:SCTP\ COOKIE-ECHO\ scan V\:version\ detection n\:no\ port\ scan C\:equivalent\ to\ --script=default))' \ + '*-P-[specify probe types and options]:probe type/options:->probe-opts' \ + '(-R --dns-servers --system-dns)-n[skip reverse DNS to speed things up]' \ + '(-n)-R[always do reverse DNS on targets]' \ + '--resolve-all[scan all addresses resolved via DNS]' \ + '--unique[scan each address only once]' \ + '(--dns-servers -n)--system-dns[use OS DNS resolver for reverse lookups]' \ + '(--system-dns -n)--dns-servers[specify custom DNS servers for reverse lookups]:server:_sequence _hosts' \ + "--disable-arp-ping[don't do ARP or IPv6 ND of locally connected ethernet hosts]" \ + "--discovery-ignore-rst[don't treat RST replies as proof of a target being up]" \ + '--traceroute[trace hop path to each host]' \ + '--scanflags[customize TCP scan flags]:TCP flags:->tcp-flags' \ + '-b[specify ftp relay host]:ftp relay host:_hosts' \ + '-p+[specify ports to try]:port numbers' \ + '--exclude-ports[exclude specified ports]:port numbers' \ '-F[scan only ports listed in services file]' \ - '-D[perform decoy scan]:host list:_sequence -s, _hosts' \ - '-S[specify source address]:address:_hosts' \ + "-r[don't randomize order in which ports are scanned]" \ + '--top-ports[scan most common ports]:number of ports' \ + '--port-ratio[scan ports more common than specified ratio]: :_numbers -l 0.0 -m 1.0 ratio' \ + "--allports[don't exclude any ports from version detection]" \ + '(--version-light --version-all)--version-intensity[limit version probes to try]:level:((0\:light 1 2 3 4 5 6 7 8 9\:try\ all))' \ + '(--version-intensity --version-all)--version-light[alias for --version-intensity 2]' \ + '(--version-intensity --version-light)--version-all[alias for --version-intensity 9]' \ + '--version-trace[show packets related to version scanning]' \ + '-O[enable remote OS identification]' \ + '--osscan-limit[limit OS detection to promising targets]' \ + '(--osscan-guess --fuzzy)'{--osscan-guess,--fuzzy}'[guess OS more aggressively]' \ + '--max-os-tries[set maximum number of OS detection tries against a target]:tries [5]' \ + '--script=[specify Lua scripts]:script:->scripts' \ + '--script-args[provide arguments to scripts]:arguments' \ + '--script-args-file[provide script arguments in a file]:file:_files' \ + '--script-trace[show all data sent and received]' \ + '--script-updatedb[update the script database]' \ + "$ign--script-help=[show help about scripts]:script:->scripts" \ + --{min,max}-hostgroup'[set parallel scan group size]:size' \ + --{min,max}-parallelism'[specify number of scans to perform in parallel]:number' \ + --{min,max}-rtt-timeout'[set time to wait for a probe response]: :_numbers -u seconds time \:s ms m h' \ + '--initial-rtt-timeout[specify initial probe timeout]: :_numbers -u seconds timeout \:s ms m h' \ + '--max-retries[cap number of port scan probe retransmissions]:tries' \ + '--host-timeout[specify maximum time for scanning a single host]: :_numbers -u seconds timeout \:s ms m h' \ + '--script-timeout[set a ceiling on script execution time]:max time' \ + '(--scan-delay --max-scan-delay)'--{max-,}'scan-delay[set amount of time between probes to a given host]: :_numbers -u seconds delay \:s ms m h' \ + '--min-rate[send packets no slower than number per second]:packets' \ + '--max-rate[send packets no faster than number per second]:packets' \ + '--defeat-'{rst,icmp}'-ratelimit' \ + '--nsock-engine:IO multiplexing engine:(iocp epoll kqueue poll select)' \ + '-T[set a timing template]:timing policy:(paranoid sneaky polite normal aggressive insane)' \ + '-f[fragment packets]' \ + '--mtu=[specify MTU, with -f]:mtu' \ + '-D[perform decoy scan]:host list:_sequence _hosts' \ + '-S[spoof source address]:address:_hosts' \ '-e[specify interface to use]:network interface:_net_interfaces' \ - '-g[specify source port number]:port number' \ + '(-g --source-port)'{-g,--source-port=}'[specify source port number]:port number' \ + '--data=[append a custom payload to sent packets]:payload (hex string)' \ + '--data-string=[append a custom ASCII string to sent packets]:string' \ '--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]' \ + '--ip-options=[send packets with specified IP options]:IP options:->ip-options' \ + '--ttl[specify IPv4 time to live for sent packets]:time-to-live' \ '--randomize-hosts[scan hosts in random order]' \ - '-M[specify maximum number of parallel TCP connects]:maximum TCP connects' \ + '--spoof-mac=[spoof your MAC address]:MAC address' \ + '--proxies=[relay connections through HTTP/SOCKS4 proxies]:proxy:_sequence _urls' \ + '--badsum[send packets with a bogus TCP/UDP/SCTP checksum]' \ + '--adler32[use deprecated Adler32 instead of CRC32C for SCTP checksums]' \ + '*-o-[log results]:log format:->log-forms: :{_files || _date_formats}' \ + '*-v-[increase verbosity]::level' \ + '*-d-[increase debugging level]::level' \ + '--reason[show why a port is in a particular state]' \ + '--stats-every=[print periodic timing stats]: :_numbers -u seconds interval \:s ms m h' \ + '--open[only show open (or possibly open) ports]' \ '--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)' \ - '--interactive[go into interactive mode]' \ + "$ign--iflist[list interfaces and routes]" \ + '--append-output[append results to any log files]' \ + "$ign--resume[resume aborted scan]:log filename:_files" \ + '--noninteractive[disable runtime interactions via keyboard]' \ + '(--webxml)--stylesheet[specify XSL stylesheet to transform XML output to HTML]:stylesheet:_urls' \ + '(--stylesheet)--webxml[load stylesheet from Nmap.Org]' \ + '--no-stylesheet[omit XSL stylesheet declaration from XML]' \ + '-6[enable IPv6 scanning]' \ + '(-O)-A[enable OS detection, version detection, script scanning and traceroute]' \ + '--datadir=[specify custom Nmap data file location]:directory:_directories' \ + '--servicedb=[specify custom services file]:services file:_files' \ + '--versiondb=[specify custom service probes file]:service probes file:_files' \ + '(--send-ip)--send-eth[send using raw ethernet frames]' \ + '(--send-eth)--send-ip[send using raw IP packets]' \ + '(--unprivileged)--privileged[assume user is fully privileged]' \ + '(--privileged)--unprivileged[assume user lacks raw socket privileges]' \ + '!--release-memory' \ + "$ign"{-V,--version}'[print version number]' \ + "$ign"{-h,--help}'[print help summary]' \ '*:host:_hosts' && ret=0 case $state in probe-opts) - _values -S '' 'probe type/option' \ - "0[don't try to ping hosts before scanning]" \ - 'T[use TCP "ping"]' \ - 'S[use SYN packets instead of ACK]' \ - 'U[send UDP probes]' \ - 'E[use a true ping]' \ - 'P[use an ICMP timestamp request]' \ - 'M[use a netmask request]' \ - 'B[use ACK and ICMP echo in parallel]' && ret=0 + _values -S '' 'discovery probe type [R]' \ + 'n[skip host discovery]' \ + 'A[use TCP with ACK flag]' \ + 'S[use TCP with SYN flag]' \ + 'U[use UDP discovery probe]' \ + 'Y[use SCTP discovery probe]' \ + 'E[use ICMP echo request ]' \ + 'P[use ICMP timestamp request]' \ + 'M[use ICMP netmask request]' \ + 'O[IP protocol ping]' \ + 'R[use ARP]' && ret=0 ;; log-forms) _values 'log format' \ @@ -65,13 +127,50 @@ case $state in 'X[XML]' \ 'G[grepable]' \ 'A[all]' \ - 'S[S|<ipT kiDdI3]' && ret=0 + 'S[S|<rIpt kIddi3]' && ret=0 ;; - host-list) - suf=() - compset -P '*,' + tcp-flags) + compset -P '(URG|ACK|PSH|RST|SYN|FIN)#' + _wanted tcp-flags expl 'TCP flag' compadd -S '' \ + URG ACK PSH RST SYN FIN && ret=0 + ;; + ip-options) + _values -S ' ' "IP option" \ + 'R[record route (9 slots available)]' \ + 'T[record internet timestamps (9 slots)]' \ + 'U[record timestamps and ip addresses (4 slots)]' \ + 'L[loose source routing (8 slots)]:hop ip' \ + 'S[strict source routing (8 slots)]:hop ip' && ret=0 + ;; + scripts) + compset -P '*,(|+)' compset -S ',*' || suf=(-qS ,) - _hosts "$suf[@]" && ret=0 + + if [[ $PREFIX$SUFFIX = */* ]]; then + _files -g "*.nse(-.)" + return + fi + + categories=( all ) + for dir in \ + ${opt_args[--datadir]:+${~opt_args[--datadir]}/scripts(/N)} \ + $NMAPDIR/scripts(/N) \ + ${${commands[$words[1]]:-$words[1]}:P:h:h}/share/nmap/scripts(/N) \ + ~/.nmap/scripts(/N) \ + ../share/nmap/scripts(/N) \ + $NMAPDATADIR/scripts(/N) \ + . + do + if [[ -r $dir/script.db ]]; then + scripts+=( ${${${(SM)${(f)"$(<$dir/script.db)"}#filename = \"[^.]##.}%.}#*\"} ) + categories+=( ${${(s.,.)${(SM)${(f)"$(<$dir/script.db)"}##categories = [^\}]#}#*\{}//[ \"]/} ) + else + scripts+=( $dir/*.nse(N:t:r) ) + fi + done + _alternative \ + 'categories:category:compadd $suf -a categories' \ + 'scripts:script:compadd -M "r:|-=* r:|=*" $suf -a scripts' && ret=0 ;; esac diff --git a/Completion/Unix/Command/_numfmt b/Completion/Unix/Command/_numfmt index 999c412a1..dd8f6182f 100644 --- a/Completion/Unix/Command/_numfmt +++ b/Completion/Unix/Command/_numfmt @@ -15,6 +15,7 @@ _arguments -S \ '(H)--padding=[pad the output to specified width]:width; positive - right-align; negative - left-align' \ '(H)--round=[use specified method for rounding when scaling]:method [from-zero]:(up down from-zero towards-zero nearest)' \ '(H)--suffix=[add suffix to output numbers and accept optional suffix in input numbers]:suffix' \ + '(H)--unit-separator=[insert separator between number and unit on output]:separator' \ "(H)--to=[auto-scale output numbers to specified unit]:unit:$units" \ '(H)--to-unit=[specify output unit size]:unit size [1]' \ '(H -z --zero-terminated -d --delimiter)'{-z,--zero-terminated}'[line delimiter is NUL, not newline]' \ diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump index 71a615c97..0a8820327 100644 --- a/Completion/Unix/Command/_objdump +++ b/Completion/Unix/Command/_objdump @@ -67,8 +67,13 @@ case $variant in '!(--no-recurse-limit)--recurse-limit' '--no-recurse-limit[disable demangling recursion limit]' '(-w --wide)'{-w,--wide}'[format output for more than 80 columns]' - '-U+[specify how to display unicode characters]:method:(d l e x h i)' - '--unicode=[specify how to display unicode characters]:method:(default locale escape hex highlight invalid)' + '(-U --unicode)'{-U+,--unicode=}'[specify how to treat UTF-8 encoded unicode characters]: : _values "treatment [default]" + {d,default}"[no special treatment]" + {l,locale}"[convert to current locale]" + {i,invalid}"[not part of a valid string]" + {x,hex}"[<> enclosed hex byte sequences]" + {e,escape}"[escape sequences (\\\\uxxxx)]" + {h,highlight}"[escape sequences highlighted in red]"' \ '(-z --disassemble-zeroes)'{-z,--disassemble-zeroes}"[don't skip blocks of zeroes when disassembling]" '--start-address=[only process data whose address is >= ADDR]:address' diff --git a/Completion/Unix/Command/_opustools b/Completion/Unix/Command/_opustools index 1fd97798a..c860a170f 100644 --- a/Completion/Unix/Command/_opustools +++ b/Completion/Unix/Command/_opustools @@ -14,7 +14,7 @@ case $service in '--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]' \ + '--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]' \ @@ -57,7 +57,7 @@ case $service in '--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)' \ + '--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) diff --git a/Completion/Unix/Command/_pandoc b/Completion/Unix/Command/_pandoc index 797e73eaa..0bf017882 100644 --- a/Completion/Unix/Command/_pandoc +++ b/Completion/Unix/Command/_pandoc @@ -9,10 +9,10 @@ _pandoc_format() { local format=${PREFIX%%(+|-)*} if compset -P '*(+|-)'; then local pm=${IPREFIX[-1]} # '+' or '-' - local -a extensions=(${${$(pandoc --list-extensions=$format):#$pm*}#(+|-)}) + local -a extensions=( ${${$(_call_program extensions pandoc --list-extensions=$format):#$pm*}#(+|-)} ) _wanted extensions expl 'extension' compadd -S '+' -r '-+ ' -a extensions else - local -a formats=( $(pandoc --list-$inout[2]-formats) ) + local -a formats=( $(_call_program formats pandoc --list-$inout[2]-formats) ) _wanted formats expl 'format' compadd -S '+' -r '-+ ' -a formats fi } @@ -22,15 +22,19 @@ _pandoc_format() { _pandoc_all_formats(){ local -a expl local -aU formats - formats=( $(pandoc --list-input-formats) $(pandoc --list-output-formats) ) - _wanted formats expl 'format' compadd -a formats + formats=( + $(_call_program input-formats pandoc --list-input-formats) + $(_call_program output-formats pandoc --list-output-formats) + ) + _description formats expl 'format' + compadd "$expl[@]" "$@" -a formats } # pdf engine choice (( $+functions[_pandoc_pdf_engine] )) || _pandoc_pdf_engine(){ _alternative \ - 'engines:engine:(pdflatex lualatex xelatex latexmk tectonic wkhtmltopdf weasyprint prince context pdfroff)' \ + 'engines:engine:(pdflatex lualatex xelatex latexmk tectonic wkhtmltopdf weasyprint pagedjs-cli prince context groff pdfroff typst)' \ 'engine-executables:engine executable:_files -g "*(#q*)"' } @@ -43,7 +47,7 @@ _pandoc_pdf_engine_opts(){ _tex ;; *) - _message "Options for ${pdf_engine}" + _message "option for ${pdf_engine}" ;; esac } @@ -79,7 +83,7 @@ _pandoc_template(){ (( $+functions[_pandoc_highlight_style] )) || _pandoc_highlight_style(){ _alternative \ - 'styles:style:( $(pandoc --list-highlight-styles) )' \ + 'styles:style:( $(_call_program styles pandoc --list-highlight-styles) )' \ 'style-files:style file:_files -g "*.theme(-.)"' } @@ -195,7 +199,8 @@ _arguments -s \ '--abbreviations=[specify a custom abbreviations file]:file:_files ' \ {-s,--standalone}'[produce output with an appropriate header and footer]' \ '--template=[use specified file as a custom template for the generated document. Implies --standalone]: :_pandoc_template' \ - {\*-V+,\*--variable=}'[set the variable KEY to the value VALUE]:key\:value: ' \ + {\*-V+,\*--variable=}'[set a template variable]:key\:value' \ + \*--variable-json='[set a template variable to the value specified by a JSON string]:key\:json' \ '(- :)'{-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: ' \ '--eol=[manually specify line endings (crlf|lf|native)]: :_pandoc_eol' \ @@ -209,6 +214,7 @@ _arguments -s \ '--highlight-style=[specify coloring style to be used in highlighted source code]: :_pandoc_highlight_style' \ '(- :)--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(-.)"' \ + '--syntax-highlighting=[specify method to use for syntax highlighting]:method' \ \*{-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' \ @@ -217,6 +223,7 @@ _arguments -s \ '--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]' \ '--embed-resources=-[produce a standalone HTML document with no external dependencies]::enable:(true false)' \ + '--link-images=-[include links to images instead of embedding the images in ODT]::enable:(true false)' \ '--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]' \ @@ -224,7 +231,9 @@ _arguments -s \ '--markdown-headings[specify style for level1 and 2 headings in markdown output]:style [atx]:(setext atx)' \ '--list-tables=-[render tables as list tables in RST output]::enable(true false)' \ '--top-level-division=[treat top-level headers as given division type in LaTeX, ConTeXt, DocBook and TEI output]:top level division:(default section chapter part)' \ - {-N,--number-sections}'[number section headings in LaTeX, ConTeXt, HTML, or EPUB output]' \ + '(--lof --list-of-figures)'{--lof=-,--list-of-figures=-}'[include an automatically generated list of figures]::enable:(true false)' \ + '(--lot --list-of-tables)'{--lot=-,--list-of-tables=-}'[include an automatically generated list of tables]::enable:(true false)' \ + '(-N --number-sections)'{-N-,--number-sections=-}'[number section headings in LaTeX, ConTeXt, HTML, or EPUB output]::enable:(true false)' \ '--number-offset=[specify 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)]' \ diff --git a/Completion/Unix/Command/_patchutils b/Completion/Unix/Command/_patchutils index a5f6441b1..83bf1d67f 100644 --- a/Completion/Unix/Command/_patchutils +++ b/Completion/Unix/Command/_patchutils @@ -13,6 +13,9 @@ case $service in '(-z --decompress)'{-z,--decompress}'[decompress .gz and .bz2 files]' ) ;| + (combine|inter|filter|flip)diff) + args+=( '--in-place[write output to original input files]' ) + ;| interdiff|combinediff|flipdiff) args+=( '(-q --quiet)'{-q,--quiet}'[quieter output]' @@ -22,6 +25,7 @@ case $service in '(-B --ignore-blank-lines)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' '(-i --ignore-case)'{-i,--ignore-case}'[ignore case differences]' '(-b --ignore-space-change)'{-b,--ignore-space-change}'[ignore changes in the amount of whitespace]' + '--color=-[colorize the output]::when [auto]:(never always auto)' '!(--in-place)--interpolate' '!-h' '!(--no-revert-omitted --in-place)--combinediff' '!(--no-revert-omitted)--flip' @@ -33,7 +37,6 @@ case $service in "--no-revert-omitted[don't revert files changed in only the first patch]" ) ;; - flipdiff) args+=( '--in-place[write output to original input files]' ) ;; filterdiff|grepdiff|lsdiff) args+=( '(-i --include)'{-i,--include}'[include only files matching pattern]:pattern:_files' @@ -42,6 +45,8 @@ case $service in '--lines=[only list hunks containing lines within specified range]:range' '(-F --files)'{-F+,--files=}'[only list files within specified range]:range' '--strip=[remove specified number of pathname components before displaying]:components' + '--git-prefixes=[specify handling of a/ and b/ prefixes in git diffs]:handling:(strip keep)' + '--git-extended-diffs=[process git diffs without hunks]:action [include]:(exclude include)' '--addprefix=[insert specified path prefix before displaying path names]:prefix:_directories' '*:diff file:_files' ) @@ -68,7 +73,7 @@ case $service in '--format=[use specified output format]:format:(unified context)' '--addnewprefix=[insert specified path prefix before new file path names]:prefix:_directories' '--addoldprefix=[insert specified path prefix before original file path names]:prefix:_directories' - '--as-numbered-lines=[display lines of selected hunks]:line numbers:(before after)' + '--as-numbered-lines=[display lines of selected hunks]:line numbers:(before after original-before original-after)' "--remove-timestamps[don't include timestamps in output]" ) ;| @@ -103,5 +108,6 @@ case $service in ;; esac + _arguments -s $args diff --git a/Completion/Unix/Command/_perl b/Completion/Unix/Command/_perl index 1631560ce..ad0c7c553 100644 --- a/Completion/Unix/Command/_perl +++ b/Completion/Unix/Command/_perl @@ -7,7 +7,7 @@ _perl () { '-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)]" \ + "-c[check syntax only]" \ '( -dt -d: -dt:)-d[run scripts under debugger]' \ '(-d -d: -dt:)-dt[run scripts under debugger (debugged code uses threads)]' \ '(-d -dt -dt:)-d\:-[run under control of a debugging/tracing module]:debugging/tracing module:_perl_modules --strip-prefix --perl-hierarchy=Devel' \ diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep index b7009eafb..b3ef86223 100644 --- a/Completion/Unix/Command/_pgrep +++ b/Completion/Unix/Command/_pgrep @@ -1,8 +1,7 @@ -#compdef pgrep pkill +#compdef pgrep pkill pidwait # Notes: -# - We assume that Linux systems use procps-ng - specifically, procps-ng >=3.3.4 -# (which changed the behaviour of -f and added -a) +# - We assume that Linux systems use procps-ng # - We don't really need to keep pgopts and pkopts separate, but it seems like # it should make things a bit easier to follow @@ -17,13 +16,13 @@ typeset -a arguments sig_arguments aopts arguments=( '-a[include process ancestors in match list]' '-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 --pidfile -p --pid)'{-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' '(-g --pgroup)'{-g+,--pgroup=}'[match only on specified process group IDs]: :->pgid' '(: * -)'{-h,--help}'[display help information]' '-I[request confirmation before signalling each process]' - '-i[ignore case distinctions]' + '(-i --ignore-case)'{-i,--ignore-case}'[ignore case distinctions]' '-j+[match only on specified jail IDs]:jail:_sequence _jails -0 -o jid' '(-L --logpidfile)'{-L,--logpidfile}'[fail if PID file not locked (with -F)]' '(-N)-M+[extract name list from specified core]:core file:_files' @@ -67,15 +66,25 @@ arguments=( case $OSTYPE in linux*) # Note: We deliberately exclude -v but not --inverse from pkill - pgopts=AacdFfGghLlnoOPrstUuVvwx- - pkopts=AceFfGgHhLnoOPstUuVx- + pgopts=AacdFfGghLlnopOPQrstUuVvwx- + pkopts=AceFfGgHhLmnoOPstUuVx- + pwopts=AceFfGghiLnOoPpQrstUuVx- arguments=( ${arguments:#((#s)|*\))(\*|)-[acl]*} '(-c --count)'{-c,--count}'[display count of matching processes]' + '(-p --pid -F --pidfile)'{-p+,--pid=}'[match process PIDs]: :_sequence _pids' + '(-Q --shell-quote)'{-Q,--shell-quote}'[output the command line in shell-quoted form]' + ) + [[ $service == pkill ]] && arguments+=( + '(-m --mrelease)'{-m,--mrelease}'[release process memory immediately after kill]' ) [[ $service == pgrep ]] && arguments+=( '(-a -l --list-full --list-name)'{-a,--list-full}'[display full command line]' '(-a -l --list-full --list-name)'{-l,--list-name}'[display process name]' + '--quiet[suppress all normal output]' + ) + [[ $service == pidwait ]] && arguments+=( + '(-e --echo)'{-e,--echo}'[display PIDs before waiting]' ) ;; dragonfly*|freebsd*) @@ -110,7 +119,9 @@ case $OSTYPE in ;; esac -if [[ $service == pgrep ]]; then +if [[ $service == pidwait ]]; then + arguments=( ${(M)arguments:#((#s)|*\))(\*|)-[$pwopts]*} ) +elif [[ $service == pgrep ]]; then arguments=( ${(M)arguments:#((#s)|*\))(\*|)-[$pgopts]*} ) else arguments=( ${(M)arguments:#((#s)|*\))(\*|)-[$pkopts]*} ) @@ -140,7 +151,7 @@ fi arguments+=( $sig_arguments + o '*: :->pname' ) -[[ $OSTYPE == linux* ]] || aopts+=( -A '*-' ) +[[ $OSTYPE == linux* ]] || aopts+=( -A '-?*' ) _arguments -C -s -S $aopts : $arguments && ret=0 # complete comma-separated list of various IDs diff --git a/Completion/Unix/Command/_php b/Completion/Unix/Command/_php index 9a8f519b1..3ed3e2705 100644 --- a/Completion/Unix/Command/_php +++ b/Completion/Unix/Command/_php @@ -155,7 +155,7 @@ _php() { if compset -P 1 '*='; then _default && ret=0 else - compset -S '=*' || suf=( -qS '=' ) + compset -S '=*' || suf=( -r= -S= ) _wanted directives expl 'INI directive' \ compadd "$suf[@]" -a directives && ret=0 fi diff --git a/Completion/Unix/Command/_pip b/Completion/Unix/Command/_pip index bafc7f9e9..370012d56 100644 --- a/Completion/Unix/Command/_pip +++ b/Completion/Unix/Command/_pip @@ -85,7 +85,6 @@ case $state in '--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]' diff --git a/Completion/Unix/Command/_pkg_instance b/Completion/Unix/Command/_pkg_instance deleted file mode 100644 index 3f4c49219..000000000 --- a/Completion/Unix/Command/_pkg_instance +++ /dev/null @@ -1,20 +0,0 @@ -#autoload - -local -A opts -local whicharg - -zparseopts -E -D -- '-_opts:=opts' - -whicharg=${opts#*:} - -case ${opts%:*} in -(installed) - compadd "$@" - ${opt_args[$whicharg]}/var/sadm/pkg/*/pkginfo(:h:t) - ;; -(spooled) - compadd "$@" - ${opt_args[$whicharg]}/*(:t) - ;; -(uninstalled) - compadd "$@" - ${opt_args[$whicharg]:-/var/spool/pkg}/*/pkgmap(:h:t) - ;; -esac diff --git a/Completion/Unix/Command/_pkgadd b/Completion/Unix/Command/_pkgadd deleted file mode 100644 index 7adc18a2a..000000000 --- a/Completion/Unix/Command/_pkgadd +++ /dev/null @@ -1,32 +0,0 @@ -#compdef pkgadd - -_pkgadd_pass() { - _values -S : 'password descriptor' \ - '(file env console)pass[literal password]:password:' \ - '(pass file console)env[environment variable]:environment:_parameters -g "*export*"' \ - '(pass env console)file[file]:file:_files' \ - '(pass env file)console[from /dev/tty]' -} - -_pkgadd() { - _arguments -s \ - '-d[device]:device file:_files' \ - '-x[HTTP(S) proxy]:HTTP proxy: ' \ - '-k[keystore]:keystore:_files' \ - '-P[password to decrypt keystore]:password:_pkgadd_pass' \ - '-Y[select packages by category]:category: ' \ - - set1 \ - '-n[non-interactive mode]' \ - '-v[trace all scripts]' \ - '-a[admin file]:admin file:_files' \ - "-M[don't use vfstab file]" \ - '-R[root path]:root path:_files -/' \ - '-r[response file]:response file:_files' \ - '-V[alternate vfstab file]:vfstab file:_files' \ - '*:package instance:_pkg_instance --_opts uninstalled:-d' \ - - set2 \ - '-s[spool package]:spool directory:_files -/' \ - '*:package instance:_pkg_instance --_opts uninstalled:-d' -} - -_pkgadd "$@" diff --git a/Completion/Unix/Command/_pkginfo b/Completion/Unix/Command/_pkginfo deleted file mode 100644 index eca9e057e..000000000 --- a/Completion/Unix/Command/_pkginfo +++ /dev/null @@ -1,18 +0,0 @@ -#compdef 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 deleted file mode 100644 index 1191a2d1f..000000000 --- a/Completion/Unix/Command/_pkgrm +++ /dev/null @@ -1,16 +0,0 @@ -#compdef 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/_pmap b/Completion/Unix/Command/_pmap index 5fd92ab9e..2226d3329 100644 --- a/Completion/Unix/Command/_pmap +++ b/Completion/Unix/Command/_pmap @@ -1,11 +1,11 @@ #compdef pmap if _pick_variant procps=procps-ng unix -V 2>/dev/null; then - # based on procps-ng-3.3.15 _arguments -s \ '(exit -A --range)'{-A+,--range}'[limit results to the specified address range]:low,high: ' \ '(exit -q --quiet)'{-q,--quiet}'[do not display some header or footer lines]' \ '(exit -p --show-path)'{-p,--show-path}'[show full path to files in the mapping column]' \ + '(exit -k --use-kernel-name)'{-k,--use-kernel-name}'[use names provided by kernel]' \ '(exit)*: :_pids' \ + '(format)' \ '(exit)'{-d,--device}'[show the device format]' \ diff --git a/Completion/Unix/Command/_postfix b/Completion/Unix/Command/_postfix index 006c950e3..8c172b424 100644 --- a/Completion/Unix/Command/_postfix +++ b/Completion/Unix/Command/_postfix @@ -67,7 +67,7 @@ case $service in '-d[delete]:queue id:_postfix_queue_id' \ '-h[hold]:queue id:_postfix_queue_id' \ '-H[release]:queue id:_postfix_queue_id' \ - '*-r[requeue]:queue id, or "ALL":_postfix_queue_id' \ + '*-r[requeue]:queue id:_phony ALL _postfix_queue_id' \ '1:queue:(hold incoming active deferred)' ;; (postqueue) diff --git a/Completion/Unix/Command/_postgresql b/Completion/Unix/Command/_postgresql index 595eb1cb4..aff245578 100644 --- a/Completion/Unix/Command/_postgresql +++ b/Completion/Unix/Command/_postgresql @@ -200,7 +200,7 @@ __pgsql_cfg_params_values() { _message -e values 'PostgreSQL run-time configuration-parameter value' else compset -S '=*' - __pgsql_cfg_params "$@" -qS= + __pgsql_cfg_params "$@" -r= -S= fi } @@ -332,7 +332,7 @@ __pgsql_cfg_variables_values() { _message -e values 'PostgreSQL special-variable value' else compset -S '=*' - __pgsql_variables "$@" -qS= + __pgsql_variables "$@" -r= -S= fi } diff --git a/Completion/Unix/Command/_ps b/Completion/Unix/Command/_ps index 7d83f90ea..7e3db03a7 100644 --- a/Completion/Unix/Command/_ps +++ b/Completion/Unix/Command/_ps @@ -36,12 +36,8 @@ args=( '*-U+[select processes by real user]:user:_sequence -s , _users' '-o+[specify output format]:property:_sequence -s , _ps_props -' - '-c[show scheduler properties]' '-f[full listing]' - '-j[show session ID and process group ID]' '-l[long listing]' - '-L[show information about each light weight process]' - '-y[show RSS in place of ADDR (used with -l)]' ) bsd=( @@ -51,15 +47,10 @@ bsd=( 'x[include processes with no controlling terminal]' '(j l s u X)v[output in virtual memory format]' '*w[wide output]' - 'L[display all format specifiers]' - 'S[include child process data with the parent]' - 'T[select processes attached to current terminal]' ) bsdarg=( '*p[select processes by ID]' '*t[select processes by attached terminal]' - 'O[specify additional output fields]' - 'o[specify output format]' ) case $OSTYPE in @@ -76,11 +67,30 @@ case $OSTYPE in '-Z[show zone with which process is associated]' ) ;; - linux-gnu|dragonfly*|freebsd*|netbsd*|openbsd*) + ^aix*) + args+=( + '-L[show information about each light weight process]' + '-c[show scheduler properties]' + '-j[show session ID and process group ID]' + '-y[show RSS in place of ADDR (used with -l)]' + ) + bsd+=( + 'L[display all format specifiers]' + 'S[include child process data with the parent]' + 'T[select processes attached to current terminal]' + ) + bsdarg+=( + 'O[specify additional output fields]' + 'o[specify output format]' + ) + ;| + linux-gnu|aix*|dragonfly*|freebsd*|netbsd*|openbsd*) bsd+=( 'e[show environment after command]' '(j l s v X)u[output in resource usage format]' ) + ;| + linux-gnu|dragonfly*|freebsd*|netbsd*|openbsd*) bsdarg+=( 'N[set namelist file for WCHAN display]' '*U[select processes by effective user]' @@ -89,10 +99,14 @@ case $OSTYPE in linux-gnu|dragonfly*|freebsd*|openbsd*) bsd+=( 'H[show threads as if they were processes]' ) ;| + aix*|darwin*|dragonfly*|freebsd*|netbsd*|openbsd*) + bsd+=( + 'c[show just executable name for command]' + ) + ;| darwin*|dragonfly*|freebsd*|netbsd*|openbsd*) bsd+=( 'A[select every process]' - 'c[show just executable name for command]' 'h[repeat header lines, one per page of output]' '(r)m[sort by memory usage]' '(m)r[sort by CPU usage]' @@ -110,9 +124,6 @@ case $OSTYPE in darwin*|freebsd*) bsd+=( 'X[skip processes with no controlling terminal]' ) ;| - freebsd*|dragonfly*) - bsd+=( 'f[show command and environment for swapped out processes]' ) - ;| netbsd*|openbsd*) bsdarg+=( 'W[extract swap information from specified file]' ) ;| @@ -121,6 +132,26 @@ case $OSTYPE in 'd[show process hierarchy]' ) ;| + aix*) + args+=( + '-M[list 64 bit processes]' + "-N[don't gather thread statistics]" + '-L+[show process descendants]:pid list:_sequence _pids' + '-T+[show process tree rooted at given pid]:pid:_pids' + '-P[display project info]' + "-X[don't truncate user and group names]" + '-Z[display page size settings]' + '-k[list kernel processes]' + '-c+[filter by workload management class]:class list' + '-m[list kernel threads]' + ) + bsd+=( + 'g[display all processes]' + 'n[numerical output]' + 's[display kernel stack size of each process]' + "X[don't truncate user and group names]" + ) + ;| darwin*) bsd+=( 'd[select all processes except session leaders]' @@ -143,13 +174,19 @@ case $OSTYPE in fi ;; dragonfly*) - bsd+=( 'R[subsort by parent/child chain]' ) + bsd+=( + 'R[subsort by parent/child chain]' + 'f[show command and environment for swapped out processes]' + ) ;; freebsd*) bsd+=( - '*J[select processes by jail ID]' 'Z[show mac label]' ) + bsdarg+=( + 'D[expand list of selected processes based on process tree]' + '*J[select processes by jail ID]' + ) ;; netbsd*) bsd+=( '(j l u v)s[output in thread format]' ) ;; openbsd*) @@ -169,6 +206,7 @@ case $OSTYPE in '-M[show security data]' '(--forest -H)'{--forest,-H}'[show process hierarchy]' '-P[add psr column]' + '--delimiter=[specify column delimiter]:string' '--headers[repeat header lines, one per page of output]' '(--cols --columns --width)'{--cols,--columns,--width}'[set screen width]:width' '(--lines --rows)'{--lines,--rows}'[set screen height]' @@ -205,8 +243,9 @@ case $OSTYPE in ;; esac -if (( CURRENT > 1 )) && [[ $OSTYPE != (solaris*|linux-gnu) || - ( $OSTYPE = linux-gnu && $words[CURRENT-1] != -* ) ]]; then +if (( CURRENT > 1 )) && [[ $OSTYPE != (aix*|solaris*|linux-gnu) || + ( $OSTYPE = (aix*|linux-gnu) && $words[CURRENT-1] != -* ) ]] +then case $words[CURRENT-1] in *k) local sopt @@ -215,6 +254,7 @@ if (( CURRENT > 1 )) && [[ $OSTYPE != (solaris*|linux-gnu) || _sequence -s , _ps_props $sopt - && return ;; *g) [[ $OSTYPE = darwin* ]] && _wanted -C option-g-1 processes \ expl 'process ID' _sequence -s , _pids && return ;; + *D) _wanted directions expl direction compadd up down both && return ;; *G) _sequence -s , _groups && return ;; *J) _sequence _jails -0 && return ;; *[MNW]) _files && return ;; diff --git a/Completion/Unix/Command/_pump b/Completion/Unix/Command/_pump deleted file mode 100644 index 08ec026ed..000000000 --- a/Completion/Unix/Command/_pump +++ /dev/null @@ -1,24 +0,0 @@ -#compdef pump - -_arguments \ - '(-c --config-file=)'{-c,--config-file=}'[specify configuration file to use]:configuration file:_files' \ - '(-h --hostname=)'{-h,--hostname=}'[specify hostname to request]:hostname:_hosts' \ - '(-i --interface=)'{-i,--interface=}'[specify interface to configure]:interface:_net_interfaces' \ - '(-k --kill)'{-k,--kill}'[kill daemon (and disable all interfaces)]' \ - '(-l --lease=)'{-l,--lease=}'[specify lease time to request]:time (hours)' \ - '(-L --leasesecs=)'{-L,--leasesecs=}'[specify seconds to request for]:time (seconds)]' \ - '(-r --release)'{-r,--release}'[release interface]:interface:_net_interfaces' \ - '(-R --renew)'{-R,--renew}'[force immediate lease renewal]:interface:_net_interfaces' \ - '(-v --verbose)'{-v,--verbose}'[log verbose debug info]' \ - '(-s --status)'{-s,--status}'[display interface status]:interface:_net_interfaces' \ - '(-d --no-dns)'{-d,--no-dns}"[don't update resolv.conf]" \ - '(- *)'{-?,--help}'[display help information]' \ - "--no-gateway[don't set a gateway for this interface]" \ - "--no-setup[don't set up anything]" \ - "--no-resolvconf[don't set up resolvconf]" \ - '--no-bootp[ignore non-DHCP BOOTP responses]' \ - '--lookup-hostname[force lookup of hostname]' \ - '--script=[specify script to use]:script:_files' \ - "--win-client-ident[set the client identifier to match window's]" \ - '--usage[display brief usage message]' \ - ':interface:_net_interfaces' diff --git a/Completion/Unix/Command/_pv b/Completion/Unix/Command/_pv index 0e1f148d5..4bec330a6 100644 --- a/Completion/Unix/Command/_pv +++ b/Completion/Unix/Command/_pv @@ -17,7 +17,6 @@ _arguments -s -S $args \ '(-I --fineta -F --format)'{-I,--fineta}'[show absolute estimated time of arrival]' \ '(-r --rate -F --format)'{-r,--rate}'[show data transfer rate counter]' \ '(-a --average-rate -F --format)'{-a,--average-rate}'[show data transfer average rate counter]' \ - '(-m --average-rate-window)'{-m+,--average-rate-window=}'[compute average rate over period]:duration (seconds) [30]' \ '(-b --bytes -8 --bits -F --format)'{-b,--bytes}'[show number of bytes transferred]' \ '(-8 --bits -b --bytes -F --format)'{-8,--bits}'[show number of bits transferred]' \ '(-k --si)'{-k,--si}'[treat suffixes as multiples of 1000 rather than 1024]' \ @@ -33,10 +32,11 @@ _arguments -s -S $args \ '(-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]' \ - '(-m --average-rate-window)'{-m,--average-rate-window}'[compute average rate over past period]:period (seconds) [30]' \ + '(-m --average-rate-window)'{-m,--average-rate-window}'[compute average rate over period]:period (seconds) [30]' \ '(-w --width)'{-w+,--width}'[assume terminal is specified characters wide]:width' \ '(-H --height)'{-H+,--height=}'[assume terminal is specified rows high]:height' \ '(-N --name)'{-N+,--name=}'[prefix visual information with given name]:name' \ + '(-u --bar-style)'{-u+,--bar-style=}'[set default bar style]:name [plain]:(plain block granular shaded)' \ '(-x --extra-display)'{-x+,--extra-display=}'[also send progress to destination]:destination:_sequence - compadd windowtitle processtitle' \ '(-v --stats)'{-v,--stats}'[output transfer statistics at the end]' \ '(-f --force -R --remote)'{-f,--force}'[output even if standard error is not a terminal]' \ @@ -70,6 +70,8 @@ case $state in 'a:average data transfer rate' 'b:bytes transferred so far' 'T:percentage of transfer buffer in use' + 'A:last written' + 'L:previous line' 'N:name prefix' '%:literal %' ) diff --git a/Completion/Unix/Command/_rar b/Completion/Unix/Command/_rar index d1d381974..27120dfa5 100644 --- a/Completion/Unix/Command/_rar +++ b/Completion/Unix/Command/_rar @@ -15,17 +15,19 @@ common=( '-dh[open shared files]' '-ep[exclude paths from name]' '-f[freshen files]' - '-idn[hide archived names]' - '-idp[disable percentage display]' + '-id-[disable messages]: : _values -s "" message + "c[copyright]" "d[done]" "n[archived names]" "p[percentage indicator]" "q[quiet]"' \ '-ierr[send all messages to stderr]' '-inul[disable all messages]' '-kb[keep broken extracted files]' '-o\+[overwrite existing files]' '-o\-[do not overwrite existing files]' + '-ol-[save symbolic links as the link instead of the file]:: :((a\:absolute s\:skip))' \ '-ow[save or restore file owner and group]' '-p+:password' '-p\-[do not query password]' '-r[recurse subdirectories]' + '-si-[read data from standard input]::name' '-ta+[process files modified after a date]:date (YYYYMMDDHHMMSS)' '-tb+[process files modified before a date]:date (YYYYMMDDHHMMSS)' '-tn+[process files newer than a specified time]:time' @@ -56,9 +58,8 @@ case $service in else _arguments -S \ '-ep3[expand paths to full including the drive letter]' \ - '-idc[disable ___ display]' \ - '-idd[disable ___ display]' \ - '-idq[disable ___ display]' \ + '-mes[skip encrypted files]' \ + '-op-[set output path for extracted files]:path:_directories' \ '-n+:file to include:_files' \ '-n@+:file of files to include:_files' \ "$common[@]" \ @@ -106,6 +107,7 @@ case $service in '-en[do not put end of archive block]' \ '-ep1[exclude base directory from names]' \ '-ep2[expand paths to full]' \ + '-ep4-[exclude path prefix from names]:prefix' \ '-hp[encrypt both file data and headers]' \ '-ilog[log errors to file (registered versions only)]' \ '-isnd[enable sound]' \ @@ -113,7 +115,6 @@ case $service in '-m+[set compression level]:compression level:(( 0\:store 1\:fastest 2\:fast 3\:normal 4\:good 5\:maximal ))' \ '-md+[dictionary size]:dictionary size (KB):( 64 128 256 512 1024 2048 4096 a b c d e f g )' \ '-ms[specify file types to store]' \ - '-ol[save symbolic links as the link instead of the file]' \ '-p[set password]' \ '-r0[recurse subdirectories for wildcard names only]' \ '-rr[add data recovery record]' \ diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf index 43cbc81c6..a0ecdaf2a 100644 --- a/Completion/Unix/Command/_readelf +++ b/Completion/Unix/Command/_readelf @@ -2,11 +2,11 @@ local variant args sections -sections=( .bss .data .dynamic .dynsym .got .interp .shstrtab .symtab .text ) +sections=( .bss .comment .data .dynamic .dynsym .got .interp .shstrtab .symtab .text ) _pick_variant -r variant elftoolchain=elftoolchain elfutils=elfutils binutils --version args=( - '(-a --all)'{-a,--all}'[show all tables]' + '(-a --all -h --file-header -l --program-headers --segments -S --section-headers --sections -r --relocs -d --dynamic -V --version-info -A --arch-specific -I --histogram --got-contents)'{-a,--all}'[show all tables]' '(-g --section-groups)'{-g,--section-groups}'[show section groups]' '(-h --file-header)'{-h,--file-header}'[show file header]' '(-l --program-headers --segments)'{-l,--program-headers,--segments}'[show program headers]' @@ -57,8 +57,12 @@ case $variant in '(-C)--demangle=-[decode symbol names]::style [auto]:(none auto gnu-v3 java gnat dlang rust)' '!(--no-recurse-limit)--recurse-limit' '--no-recurse-limit[disable demangling recursion limit]' - '-U+[specify how to display unicode characters]:method:(d l e x h i)' - '--unicode=[specify how to display unicode characters]:method:(default locale escape hex highlight invalid)' + '(-U --unicode)'{-U+,--unicode=}'[specify how to treat UTF-8 encoded unicode characters]: : _values "treatment [locale]" + {l,locale,d,default}"[convert to current locale]" + {i,invalid}"[not part of a valid string]" + {x,hex}"[<> enclosed hex byte sequences]" + {e,escape}"[escape sequences (\\\\uxxxx)]" + {h,highlight}"[escape sequences highlighted in red]"' \ '(-X --extra-sym-info)'{-X,--extra-sym-info}'[display extra information when showing symbols]' '!(-X --extra-sym-info)--no-extra-sym-info' '(-L --lint --enable-checks)'{-L,--lint,--enable-checks}'[display warning messages for possible problems]' @@ -71,6 +75,7 @@ case $variant in '--ctf-symbols=[use specified section as the CTF external symbol table]:section' '--ctf-strings=[use specified section as the CTF external string table]:section' '--sframe=-[display SFrame info from section]::section name [.sframe]' + '(-a --all)--got-contents[display GOT section contents]' '(-T --silent-truncation)'{-T,--silent-truncation}"[if a symbol name is truncated, don't add ... suffix]" ) ;; diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm index cc2e456b5..4575e4dc4 100644 --- a/Completion/Unix/Command/_rm +++ b/Completion/Unix/Command/_rm @@ -9,7 +9,7 @@ args=( '*:: :->file' ) _pick_variant -r variant -b zsh gnu='(GNU|uutils)' $OSTYPE --version -case $variant; in +case $variant in gnu) opts=() args+=( diff --git a/Completion/Unix/Command/_rmdir b/Completion/Unix/Command/_rmdir index 029fa5b85..deb244abb 100644 --- a/Completion/Unix/Command/_rmdir +++ b/Completion/Unix/Command/_rmdir @@ -8,7 +8,7 @@ args=( ) _pick_variant -r variant -b zsh gnu='(GNU|uutils)' $OSTYPE --version -case $variant; in +case $variant in gnu) aopts=() args+=( diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync index 1657d411e..d6748f0f5 100644 --- a/Completion/Unix/Command/_rsync +++ b/Completion/Unix/Command/_rsync @@ -209,9 +209,9 @@ _rsync() { '--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-delete=[don't delete more than the specified number of files]:number" \ "--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' \ + "--min-size=[don't transfer any file smaller than specified size]: :_numbers -f -u bytes size B K M G T P" \ '--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]' \ @@ -278,8 +278,8 @@ _rsync() { '(--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' \ + '--iconv=[request charset conversion of filenames]:convert specification' \ + '--checksum-seed=[set checksum seed (advanced)]:number' \ '--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 82111b455..eebf6c25f 100644 --- a/Completion/Unix/Command/_ruby +++ b/Completion/Unix/Command/_ruby @@ -1,8 +1,8 @@ #compdef ruby irb erb ruby-mri -P (ruby|[ei]rb)[0-9.]# -value-,RUBY(LIB|OPT|PATH),-default- -local curcontext="$curcontext" state line expl desc RUBY ret=1 +local curcontext="$curcontext" state line expl desc RUBY variant ret=1 typeset -A opt_args -local -a opts irb erb all common charsets suf +local -a opts irb erb all common charsets suf jit_opts all=( '*-r+[require the library before executing your script]:library name:->library' @@ -47,23 +47,112 @@ opts=( '--backtrace-limit=[limit the maximum length of backtrace]:number' '!'{-y,--yydebug} '!--dump=:target:(version copyright usage yydebug syntax parsetree parsetree_with_comment insns)' - '(--mjit --yjit)--jit[enable jit for the platform]' - '(--jit --yjit)--mjit[enable C compiler-based JIT compiler]' - '(--jit --mjit)--yjit[enable in-process JIT compiler]' - '--mjit-warnings[enable printing JIT warnings]' - '--mjit-debug[enable JIT debugging (very slow)]' - '--mjit-wait[wait until JIT compilation finishes every time (for testing)]' - '--mjit-save-temps[save JIT temporary files]' - '--mjit-verbose=-[print JIT logs of level num or less to stderr]:maximum log level [0]' - '--mjit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:number [100]' - '--mjit-min-calls=-[specify number of calls to trigger JIT]:calls [10000]' - '--yjit-stat[enable collecting YJIT statistics]' - '--yjit-exec-mem-size=-[size of executable memory block in MiB]:mem size' - '--yjit-call-threshold=-[number of calls to trigger JIT]:number' - '--yjit-max-versions=-[maximum number of versions per basic block]:versions' - '--yjit-greedy-versioning[greedy versioning mode]' ) +if [[ $service == ruby[0-9.]# ]]; then + _pick_variant -r variant -c "$service --version" \ + ruby_no_jit='ruby ([01].|2.[0-5])' \ + ruby_experimental_jit='ruby (2.[67]|3.0)' \ + ruby31='ruby 3.1' ruby32='ruby 3.2' ruby33='ruby 3.3' ruby34='ruby 3.4' \ + ruby40='ruby 4.0' ruby41_higher + + if [[ $variant != "ruby_no_jit" ]]; then + jit_opts=('(--jit --mjit --yjit --rjit --zjit)--jit[enable default JIT for the platform]') + fi + + case "$variant" in + (ruby_experimental_jit|ruby31) + jit_opts+=( + '--jit-warnings[enable printing JIT warnings]' + '--jit-debug[enable JIT debugging (very slow)]' + '--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]:log level' + '--jit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:num' + '--jit-min-calls=-[specify number of calls to trigger JIT]:num' + ) + ;| + (ruby31|ruby32) + jit_opts+=( + '(--jit --mjit --yjit)--mjit[enable C compiler-based JIT compiler]' + '(--jit --mjit --yjit)--yjit[enable in-process JIT compiler]' + ) + ;| + (ruby31|ruby32) + jit_opts+=( + '--mjit-warnings[enable printing JIT warnings]' + '--mjit-debug[enable JIT debugging (very slow)]' + '--mjit-wait[wait until JIT compilation finishes every time (for testing)]' + '--mjit-save-temps[save JIT temporary files]' + '--mjit-verbose=-[print JIT logs of level num or less to stderr]:log level' + '--mjit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:num' + '--mjit-min-calls=-[specify number of calls to trigger JIT]:num' + '--yjit-max-versions=[Maximum number of versions per basic block (default: 4)]:num' + '--yjit-greedy-versioning[Greedy versioning mode (default: disabled)]' + ) + ;| + (ruby32|ruby33|ruby34|ruby40|ruby41_higher) + jit_opts+=( + '--yjit-stats[Enable collecting YJIT statistics]' + '--yjit-exec-mem-size=[Hard limit on executable memory block in MiB]:mem size' + '--yjit-call-threshold=[Number of calls to trigger JIT]:num' + ) + ;| + (ruby33|ruby34|ruby40|ruby41_higher) + # mjit was removed since Ruby 3.3 + jit_opts+=( + '--yjit-cold-threshold=[Global calls after which ISEQs not compiled (default: 200K)]:num' + '--yjit-disable[Disable YJIT for lazily enabling it with RubyVM::YJIT.enable]' + '--yjit-code-gc[Run code GC when the code size reaches the limit]' + '--yjit-perf[Enable frame pointers and perf profiling]' + '--yjit-trace-exits[Record Ruby source location when exiting from generated code]' + '--yjit-trace-exits-sample-rate=[Trace exit locations only every Nth occurrence]:num' + ) + ;| + (ruby34|ruby40|ruby41_higher) + jit_opts+=( + '--yjit-mem-size=[Soft limit on YJIT memory usage in MiB (default: 128)]:mem size' + "--yjit-log=[Enable logging of YJIT's compilation activity]: :_files" + ) + ;| + (ruby33|ruby34) + # ruby 3.3 and 3.4 provide rjit + jit_opts+=( + '(--jit --yjit --rjit)--yjit[Enable in-process JIT compiler]' + '--rjit-exec-mem-size=[Size of executable memory block in MiB (default: 64)]:mem size' + '--rjit-call-threshold=[Number of calls to trigger JIT (default: 10)]:num' + '--rjit-stats[Enable collecting RJIT statistics]' + '--rjit-disable[Disable RJIT for lazily enabling it with RubyVM::RJIT.enable]' + '--rjit-trace[Allow TracePoint during JIT compilation]' + '--rjit-trace-exits[Trace side exit locations]' + ) + ;| + (ruby40|ruby41_higher) + # zjit was introduced since ruby 4 + jit_opts+=( + '(--jit --yjit --zjit)--yjit[Enable in-process JIT compiler]' + '(--jit --yjit --zjit)--zjit[enable method-based JIT compiler]' + '--zjit-mem-size=[Max amount of memory that ZJIT can use in MiB (default: 128)]:mem size' + '--zjit-call-threshold=[Number of calls to trigger JIT (default: 30)]:num' + '--zjit-num-profiles=[Number of profiled calls before JIT (default: 5)]:num' + '--zjit-stats-quiet[Collect ZJIT stats and suppress output]' + '--zjit-stats=-[Collect ZJIT stats]: :_files' + '--zjit-disable[Disable ZJIT for lazily enabling it with RubyVM::ZJIT.enable]' + '--zjit-perf[Dump ISEQ symbols into /tmp/perf-{}.map for Linux perf]' + '--zjit-log-compiled-iseqs=[Log compiled ISEQs to the file. The file will be truncated]: :_files' + '--zjit-trace-exits=-[Record source on side-exit]:counter' + '--zjit-trace-exits-sample-rate=[Frequency at which to record side exits]:frequency' + ) + ;| + (ruby41_higher) + jit_opts+=( + '--zjit-trace-compiles[Record compilation phases as Perfetto trace events]' + '--zjit-trace-invalidation[Record invalidation events as Perfetto trace events]' + ) + ;| + esac +fi + irb=( '-f[suppress read of ~/.irbrc]' $opts[(r)*-d\[*] @@ -121,7 +210,7 @@ case "$service" in ;; ruby[0-9.]#) RUBY=$words[1] - _arguments -C -s -S : $opts $all $common && ret=0 + _arguments -C -s -S : $opts $all $common $jit_opts && ret=0 ;; irb[0-9.]#) RUBY=${words[1]/irb/ruby} diff --git a/Completion/Unix/Command/_screen b/Completion/Unix/Command/_screen index 9336ae82d..65cb63e31 100644 --- a/Completion/Unix/Command/_screen +++ b/Completion/Unix/Command/_screen @@ -76,6 +76,7 @@ _arguments -C \ '-m[ignore $STY variable, do create a new screen session]' \ '-O[choose optimal output rather than exact vt100 emulation]' \ '-p[preselect the named window]:window number or name:((\=\:windowlist -\:blank\ window \:window\ number))' \ + '-P[enable authentication]' \ '-q[quiet startup, exit with non-zero return code if unsuccessful]' \ '-Q[send response to stdout of command query process]:screen command:(echo info lastmsg number select time title windows)' \ '-r[reattach to a detached screen process]: :->detached-sessions' \ diff --git a/Completion/Unix/Command/_script b/Completion/Unix/Command/_script index 25f8ea35f..431a112e1 100644 --- a/Completion/Unix/Command/_script +++ b/Completion/Unix/Command/_script @@ -30,7 +30,7 @@ case $OSTYPE in "(-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' + "(-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)' @@ -40,6 +40,7 @@ case $OSTYPE in "(-t --timing $hlp)"{-t-,--timing=-}'[output timing data]::timing file:_files' '(- 1)'{-h,--help}'[display help information]' '(- 1)'{-V,--version}'[display version information]' + '!--:*::: : _normal $service' ) ;; darwin*|dragonfly*|netbsd*|freebsd*) diff --git a/Completion/Unix/Command/_sed b/Completion/Unix/Command/_sed index ecbec61d1..262628155 100644 --- a/Completion/Unix/Command/_sed +++ b/Completion/Unix/Command/_sed @@ -88,7 +88,7 @@ elif _pick_variant -r variant gnu=GNU unix --version; then 'v:fail if GNU extensions not supported or older than specified version' ) cmds_end+=( - "e:execute a command and include it's output" + "e:execute a command and include its output" 'F:print the filename of the current input file' 'Q:quit' 'z:empty the pattern space' diff --git a/Completion/Unix/Command/_service b/Completion/Unix/Command/_service index 28563429b..5f9ca0d67 100644 --- a/Completion/Unix/Command/_service +++ b/Completion/Unix/Command/_service @@ -11,14 +11,18 @@ zstyle -T ":completion:${ctx}" tag-order && \ case $OSTYPE in freebsd<14->.*) - args=( '-E+[set environment variable before executing the rc.d script]:variable:_parameters -g "*export*~*readonly*" -S=' ) + args=( + '(-l -r)-d[enable debugging of rc.d scripts]' + '-E+[set environment variable before executing the rc.d script]:variable:_parameters -g "*export*~*readonly*" -S=' + '(-l -r)-q[quiet]' + ) ;& freebsd<11->.*) args+=( '-j+[perform actions in specified jail]:jail:_jails' ) ;& freebsd*|dragonfly*) actions=( - '(*)-r[show the results of boot time rcorder]' + '(* -q -d)-r[show the results of boot time rcorder]' '(*)-R[restart all enabled local services]' ) ;& @@ -28,7 +32,7 @@ case $OSTYPE in '*::service argument:_init_d' \ + '(actions)' $actions \ '(*)-e[show services that are enabled]' \ - '(*)-l[list all scripts in /etc/rc.d and the local startup directory]' \ + '(* -q -d)-l[list all scripts in /etc/rc.d and the local startup directory]' \ ':service name:_services' ;; *) diff --git a/Completion/Unix/Command/_sh b/Completion/Unix/Command/_sh index f0f18d4bb..d50b81ccc 100644 --- a/Completion/Unix/Command/_sh +++ b/Completion/Unix/Command/_sh @@ -1,36 +1,151 @@ -#compdef sh ash csh dash ksh ksh88 ksh93 mksh oksh pdksh rc tcsh yash +#compdef sh ash csh dash ksh ksh88 ksh93 lksh mksh oksh osh pdksh posh rc rksh rksh93 tcsh yash ysh -local bourne argv0 -local -a args all_opts=( -{{0..9},{A..Z},{a..z}} ) +(( $+functions[_sh_set_options] )) || +_sh_set_options() { + local MATCH MBEGIN MEND k_ v_ + local -a opts_ tmp_ expl_ -[[ $service == (csh|?csh|fish|rc) ]] || bourne=1 + tmp_=( ${(f)"$( _call_program options $words[1] -c '"set -o"' )"} ) -# 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]:' + # remove heading + [[ $tmp_[1] == (#i)*'current option'* ]] && tmp_=( $tmp_[2,-1] ) + # convert osh/ysh syntax + [[ $tmp_[1] == set\ [+-]o\ * ]] && { + tmp_=( ${(@)tmp_##set [+-]o } ) + tmp_=( ${tmp_:^tmp_} ) + } + # loop since some shells arrange the options in columns + for k_ v_ in $=tmp_; do + opts_+=( $k_ ) + done -# 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#(*[\*\)]|)[+-]?}%[+-]?}})}} ) + _wanted set-options expl_ 'set option' compadd -a "$@" - opts_ +} -_arguments -s -S -A '-*' : $args +local variant apat='[+-]?*' +local -a args oopts + +case ${${(Q)words[1]}:t} in + r#ksh) + _pick_variant -r variant \ + ksh93=showme \ + mksh='utf8-#mode' \ + oksh='csh-#history' \ + '' \ + -c '"set -o"' + ;; + sh) + _pick_variant -r variant \ + zsh=junkie \ + bash=onecmd \ + ksh93=showme \ + mksh='utf8-#mode' \ + oksh='csh-#history' \ + ksh=keyword \ + dash=debug \ + '' \ + -c '"set -o"' + ;; +esac +case $variant in + bash|zsh) _$variant "$@"; return ;; + ?*) service=$variant ;; +esac + +# bourne/ksh/posix-style shells. not meant to be totally accurate, but mostly +if [[ $service != (csh|?csh|rc) ]]; then + args=( + # invocation options + '(1 -)-c[execute specified command string]: :_cmdstring:argv[0]:' + '-i[act as interactive shell]' + '-l[act as login shell]' # not defined by posix but very widely supported + '-o+[set specified option]: :_sh_set_options' + '+o+[unset specified option]: :_sh_set_options' + '(-c)-s[read commands from standard input]' + # set options. these are all defined by posix + '(-a +a)'{'-a[',"+a[don't "}'mark all variables for export]' + '(-b +b)'{'-b[',"+b[don't "}'report status of terminated background jobs immediately]' + '(-C +C)'{'-C[',"+C[don't "}'prevent output redirection from overwriting existing files]' + '(-e +e)'{'-e[',"+e[don't "}'exit immediately on non-zero return]' + '(-f +f)'{'-f[',"+f[don't "}'disable file globbing]' + '(-h +h)'{'-h[',"+h[don't "}'hash commands]' + '(-m +m)'{'-m[',"+m[don't "}'enable job control]' + '(-n +n)'{'-n[',"+n[don't "}'read (syntax-check) commands only]' + '(-u +u)'{'-u[',"+u[don't "}'treat unset variables as an error during parameter expansion]' + '(-v +v)'{'-v[',"+v[don't "}'print shell input lines as they are read]' + '(-x +x)'{'-x[',"+x[don't "}'print command trace]' + ) + + case $service in + dash) + args=( + ${args:#\(*\)[+-]h\[*} + '(-E +E -V +V)'{'-E[',"+E[don't "}'use emacs-style command-line editing]' + '(-I +I)'{'-I[',"+I[don't "}'ignore EOF]' + '(-E +E -V +V)'{'-V[',"+V[don't "}'use vi-style command-line editing]' + ) + ;; + yash) + PREFIX= _sh_set_options -O oopts + oopts=( ${oopts:#cmdline} ) + args+=( + '(- : *)--help[display help information]' + '(- : *)'{-V,--version}'[display version information]' + "(--profile)--noprofile[don't load ~/.yash_profile]" + "(--rcfile)--norcfile[don't load ~/.yashrc]" + '(--noprofile)--profile=[load specified file instead of ~/.yash_profile]:.yash_profile file:_files' + '(--norcfile)--rcfile=[load specified file instead of ~/.yashrc]:.yashrc file:_files' + ${${(M)args:#\(*\)-c\[*}/-c/--cmdline} + --$^oopts + ++$^oopts + ) + ;; + *ksh*) + args+=( + '(-k +k)'{'-k[',"+k[don't "}'recognise parameter assignments anywhere in a command]' + '(-p +p)'{'-p[',"+p[don't "}'enable privileged mode]' + '(-r +r)'{'-r[',"+r[don't "}'enable restricted mode]' + ) + ;| + oksh|r#[lm]ksh) + args+=( + '(-X +X)'{'-X[',"+X[don't "}'mark directories with trailing / when globbing]' + ) + ;| + ksh93) + PREFIX= _sh_set_options -O oopts + oopts=( ${${oopts:#rc}//[_-]/} ) + args+=( + '(-B +B)'{'-B[',"+B[don't "}'enable brace expansion]' + '(-D +D)'{'-D[',"+D[don't "}'display strings subject to language translation]' + '(-E +E --rc)'{'--rc[','-E[',"+E[don't "}'load $ENV or ~/.kshrc]' + '(-G +G)'{'-G[',"+G[don't "}'enable ** pattern (globstar)]' + '(-H +H)'{'-H[',"+H[don't "}'enable history expansion]' + '(-t +t)'{'-t[',"+t[don't "}'read one command and exit]' + --$^oopts + ) + [[ $PREFIX == --n* ]] && args+=( --no$^oopts ) + ;; + r#[lm]ksh) + args+=( + '(-U +U)'{'-U[',"+U[don't "}'enable UTF-8 support]' + '-T+[spawn on specified tty]:tty:_files -g "*(%c)"' + ) + ;; + esac + +# others. these options are common to all of those currently enumerated +else + apat='-?*' + args=( + '(1 -)-c[execute specified command string]: :_cmdstring' + '-e[exit immediately on non-zero return]' + '-i[act as interactive shell]' + '-l[act as login shell]' + '-x[print command trace]' + ) +fi + +args+=( '1:script file:_files' '*:: :_files' ) + +_arguments -s -S -A $apat : $args diff --git a/Completion/Unix/Command/_shutdown b/Completion/Unix/Command/_shutdown index a237b14e0..fdadd3b12 100644 --- a/Completion/Unix/Command/_shutdown +++ b/Completion/Unix/Command/_shutdown @@ -1,35 +1,39 @@ #compdef shutdown -local -a args +local curcontext="$curcontext" variant="$OSTYPE" ret=1 +local -a state line args suffixes -if [[ -d /etc/systemd ]]; then - _arguments \ - '--help[display usage information]' \ - '(-H --halt)'{-H,--halt}'[halt the machine]' \ - '(-P --poweroff -h)'{-P,--poweroff,-h}'[power-off the machine (default)]' \ - '(-r --reboot)'{-r,--reboot}'[reboot the machine]' \ - "(--no-wall)-k[don't shutdown, just write wall message]" \ - "(-k)--no-wall[don't send a wall message]" \ - '-c[cancel pending shutdown]' \ - '1: :_guard "^-*" "time (now/hh\:mm/+mins)"' \ - '*:warning message' - return -fi +[[ -d /run/systemd/system ]] && variant=systemd -case $OSTYPE in +case $variant in + systemd) + args=( + "(-k)--no-wall[don't send a wall message]" + '1: :->times' + '*:warning message' + + '(action)' + '(* : -)--help[display usage information]' + "(--no-wall)-k[don't shutdown, just write wall message]" + {-H,--halt}'[halt the machine]' + {-P,--poweroff,-h}'[power-off the machine (default)]' + {-r,--reboot}'[reboot the machine]' + '-c[cancel pending shutdown]' + ) + ;; *bsd*|dragonfly*|linux*|darwin*) args=( - '-h[halt the system after shutdown]' - '-r[reboot the system]' + '(-p -r -c)-h[halt the system after shutdown]' + '(-p -h -c)-r[reboot the system]' '-k[kick everybody off]' '-n[prevent file system cache from being flushed]' - '1: :_guard "^-*" "time (now/hh\:mm/+mins)"' + '1: :->times' + '(*)-[read warning message from standard input]' \ '*:warning message' ) ;| *bsd*|dragonfly*) args+=( - '-p[turn off power after shutdown]' + '(-h -r -c)-p[turn off power after shutdown]' ) ;| (net|open)bsd*) @@ -39,13 +43,14 @@ case $OSTYPE in ) ;| freebsd*|dragonfly*) + suffixes=( s:seconds :m:minutes h:hours ) args+=( '-o[execute halt or reboot instead of sending a signal to init]' ) ;| freebsd<12->.*) args+=( - '-c[power cycle the system instead of halting if possible]' + '(-h -r -p)-c[power cycle the system instead of halting if possible]' ) ;; netbsd*) @@ -74,4 +79,16 @@ case $OSTYPE in ;; esac -_arguments $args +_arguments -C $args && ret=0 + +if [[ -n $state ]]; then + if compset -P '+'; then + _numbers -u minutes "grace period" $suffixes + else + _alternative \ + 'relative-times:relative time:{ compadd "$expl[@]" -S "" +; compadd "$expl[@]" now }' \ + 'absolute-times: :_guard "^-*" "time ([yymmdd]hhmm)"' && ret=0 + fi +fi + +return ret diff --git a/Completion/Unix/Command/_sleep b/Completion/Unix/Command/_sleep new file mode 100644 index 000000000..677062ab9 --- /dev/null +++ b/Completion/Unix/Command/_sleep @@ -0,0 +1,25 @@ +#compdef sleep + +local sum inf fraction +local -a expl units + +case $OSTYPE in + linux-gnu) + args=( + -S + '--help[display help information]' + '--version[display version information]' + ) + ;& # fall-through + solaris*) + inf="_phony infinity --" + ;& # fall-through + darwin*|freebsd*) + units=( :s:seconds m:minutes h:hours d:days ) + sum='*' + fraction='-f' + ;; +esac + +_arguments $args \ + "${sum}:interval:$inf _numbers $fraction -u seconds interval $units" diff --git a/Completion/Unix/Command/_sort b/Completion/Unix/Command/_sort index 90827de4f..ac808a6d4 100644 --- a/Completion/Unix/Command/_sort +++ b/Completion/Unix/Command/_sort @@ -45,7 +45,6 @@ case $variant in "$ordering"{-R,--random-sort}'[sort by random hash of keys]' "$ordering"{-V,--version-sort}'[sort version numbers]' "$ordering--sort=[specify comparator]:comparator:(general-numeric human-numeric month numeric random version)" - '(-i --ignore-nonprinting)'{-i,--ignore-nonprinting}'[consider only printable characters]' '--random-source=[get random bytes from file]:file:_files' '--batch-size=[maximum inputs to merge]:number' '--compress-program=[specify program to compress temporary files with]:program:(gzip bzip2 lzop xz)' diff --git a/Completion/Unix/Command/_sqlite b/Completion/Unix/Command/_sqlite index a83624083..9b8431248 100644 --- a/Completion/Unix/Command/_sqlite +++ b/Completion/Unix/Command/_sqlite @@ -47,20 +47,24 @@ options+=( $^dashes'-bail[stop after hitting an error]' $^dashes'-cmd[run specified command before reading stdin]:sqlite meta-command' $^dashes'-deserialize[open the database using sqlite3_deserialize()]' + $^dashes'-escape[set rendering of control characters in output]:escape [ascii]:(symbol ascii off)' '(-*batch -*interactive)'$^dashes'-batch[force batch I/O]' '(-*batch -*interactive)'$^dashes'-interactive[force interactive I/O]' + $^dashes'-ifexists[only open if database already exists]' $^dashes'-lookaside[specify size and number of entries for lookaside memory]:size (bytes): :entries' $^dashes'-maxsize[specify maximum size for a --deserialize database]:size' $^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"-noinit[don't read ~/.sqliterc file at startup]" $^dashes'-nonce[set the safe-mode escape nonce]:string' $^dashes'-no-rowid-in-view[disable rowid-in-view using sqlite3_config()]' $^dashes'-pagecache[specify size and number of slots for page cache memory]:size (bytes): :slots' $^dashes'-pcachetrace[trace all page cache operations]' $^dashes'-readonly[open the database read-only]' $^dashes'-safe[enable safe-mode]' + $^dashes'-screenwidth[use specified default screen width]:width' $^dashes'-stats[print memory stats before each finalize]' $^dashes'-unsafe-testing[allow unsafe commands and modes for testing]' $^dashes'-vfs[use specified default VFS]:vfs:(unix-dotfile unix-excl unix-none unix-namedsem)' diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 9ab1a1139..c95849e84 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -13,7 +13,7 @@ _ssh () { '-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' + '-F+[specify alternate config file]:config file:_phony none _files' '*-i+[select identity file]:SSH identity file:_files -g "*(-.^AR)"' '*-o+[specify extra options]:option string:->option' ) @@ -41,7 +41,7 @@ _ssh () { '-B+[bind to specified interface before attempting to connect]:interface:_net_interfaces' \ '(-P)-b+[specify interface to transmit on]:bind address:_bind_addresses' \ '-D+[specify a dynamic port forwarding]:dynamic port forwarding:->dynforward' \ - '-e+[set escape character]:escape character (or `none'\''):' \ + '-e+[set escape character]:escape character:_phony none' \ '-E+[append log output to file instead of stderr]:log file:_files' \ '(-n)-f[go to background]' \ '-g[allow remote hosts to connect to local forwarded ports]' \ @@ -61,7 +61,7 @@ _ssh () { '-p+[specify port on remote host]:port number on remote host' \ '(-v)*-q[quiet operation]' \ '*-R+[specify remote port forwarding]:remote port forwarding:->forward' \ - '-S+[specify location of control socket for connection sharing]:path to control socket:_files' \ + '-S+[specify location of control socket for connection sharing]:path to control socket:_phony none _files' \ '(- 1 *)-Q+[query parameters]:query option:((cipher\:"supported symmetric ciphers" cipher-auth\:"supported symmetric ciphers that support authenticated encryption" compression mac\:"supported message integrity codes" kex\:"key exchange algorithms" kex-gss\:"GSSAPI key exchange algorithms" key\:"key types" key-cert\:"certificate key types" key-plain\:"non-certificate key types" key-sig\:"all key types and signature algorithms" protocol-version\:"supported SSH protocol versions" sig\:"supported signature algorithms" help\:"show supported queries" HostbasedAcceptedAlgorithms HostKeyAlgorithms KexAlgorithms MACs PubkeyAcceptedAlgorithms))' \ '-s[invoke subsystem]' \ '(-t)-T[disable pseudo-tty allocation]' \ @@ -263,7 +263,7 @@ _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 -u)-V+[specify certificate validity interval]:interval" \ + "$p1($cmn -f -u)-V+[specify certificate validity interval]:interval:_phony -S\: always" \ "($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 \ @@ -402,8 +402,8 @@ _ssh () { 'values:truth value:(yes no)' && ret=0 ;; (#i)escapechar=*) - _message -e 'escape character (or `none'\'')' - ret=0 + _description escape-characters expl 'escape character' + _phony "$expl[@]" none && ret=0 ;; (#i)fingerprinthash=*) _values 'fingerprint hash algorithm' \ diff --git a/Completion/Unix/Command/_strings b/Completion/Unix/Command/_strings index 685daa286..774399328 100644 --- a/Completion/Unix/Command/_strings +++ b/Completion/Unix/Command/_strings @@ -18,6 +18,13 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu l\:16-bit\ little-endian B\:32-bit\ big-endian L\:32-bit\ little-endian))' + '(-U --unicode -e --encoding)'{-U+,--unicode=}'[specify how to treat UTF-8 encoded unicode characters]: : _values "treatment [default]" + {d,default}"[rely on --encoding]" + {l,locale}"[convert to current locale]" + {i,invalid}"[not part of a valid string]" + {x,hex}"[<> enclosed hex byte sequences]" + {e,escape}"[escape sequences (\\\\uxxxx)]" + {h,highlight}"[escape sequences highlighted in red]"' \ '(-f --print-file-name)'{-f,--print-file-name}'[print name of the file before each string]' '(-n --bytes)'{-n+,--bytes=}"$bytes" '(-d -t --radix)'{-t+,--radix=}"$format" diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip index 59cb537b9..930080f89 100644 --- a/Completion/Unix/Command/_strip +++ b/Completion/Unix/Command/_strip @@ -49,7 +49,9 @@ if _pick_variant -r variant gnu=GNU elftoolchain=elftoolchain $OSTYPE --version; '(*)-o+[output file]:output file:_files' '--keep-section-symbols[retain section symbols]' '--keep-file-symbols[retain symbols specifying source file names]' - '(-v --verbose)'{-v,--verbose}'[list all object files modified or members of archives]') + '(-v --verbose)'{-v,--verbose}'[list all object files modified or members of archives]' + '--plugin=[load specified plugin]:plugin' + ) ;; elftoolchain) args+=( diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index e2889c71a..d3f800610 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -79,7 +79,7 @@ _svn () { usage=${${(M)${(f)"$(_call_program options svn help $dash_v -- $cmd)"}:#usage:*}#usage:*$cmd] } _store_cache svn-${cmd}-usage usage fi - if _cache_invalid svn-${cmd}-usage || \ + if _cache_invalid svn-${cmd}-args || \ ! _retrieve_cache svn-${cmd}-args; then args=( @@ -119,7 +119,7 @@ _svn () { _store_cache svn-${cmd}-args args fi - case $cmd in; + case $cmd in (add) args+=( '*:file: _svn_modified "addable"' diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo index c334c6765..33a9d6c0c 100644 --- a/Completion/Unix/Command/_sudo +++ b/Completion/Unix/Command/_sudo @@ -52,7 +52,7 @@ else '(--preserve-env -i --login -s --shell -e --edit)-E[preserve user environment when running command]' \ '(-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]" \ + '(-P --preserve-groups -i --login -s --shell -e --edit)'{-P,--preserve-groups}"[preserve group vector instead of setting to target's]" \ '*:: :->normal' ) fi @@ -85,7 +85,7 @@ if [[ $state = normal ]]; then 'options:option:(-s --shell -l --login)' \ 'parameters: :_parameters -g "*export*~*readonly*" -qS=' && ret=0 else - _normal + _normal && ret=0 fi fi diff --git a/Completion/Unix/Command/_tcpdump b/Completion/Unix/Command/_tcpdump index 7047b2d34..25605875f 100644 --- a/Completion/Unix/Command/_tcpdump +++ b/Completion/Unix/Command/_tcpdump @@ -94,9 +94,6 @@ _data_link_types () { fi } -_bpf_filter () { -} - args=( '-A[print each packet in ASCII]' '-c+[exit after receiving specified number of packets]:number of packets' diff --git a/Completion/Unix/Command/_tex b/Completion/Unix/Command/_tex index 1a70b5058..c5f0c370c 100644 --- a/Completion/Unix/Command/_tex +++ b/Completion/Unix/Command/_tex @@ -24,6 +24,6 @@ _arguments : \ '-src-specials=-[insert source specials in certain places of the DVI file]:WHERE:_values -s , WHERE cr display hbox math par parend vbox' \ '-translate-file=-[use the TCX file TCXNAME]:TCXNAME:' \ '-8bit[make all characters printable by default]' \ - '-help[display this help and exit]' \ + '-help[display help and exit]' \ '-version[output version information and exit]' \ '*:TeX or LaTeX file:_files -g "*.(tex|TEX|texinfo|texi|dtx)(-.)"' diff --git a/Completion/Unix/Command/_texinfo b/Completion/Unix/Command/_texinfo index 2f5d0f91f..a37bc8ae9 100644 --- a/Completion/Unix/Command/_texinfo +++ b/Completion/Unix/Command/_texinfo @@ -123,13 +123,16 @@ case $service in '--conf-dir=[specify additional directory for configuration files]:directory:_directories' \ '--init-file=[specify initialisation file]:file:_files' \ \*{-c+,--set-customization-variable=}'[set customization variable]:variable' \ + '--trace-includes[print names of included files]' \ '(-v --verbose)'{-v,--verbose}'[explain what is being done]' \ '(* -)--version[display version info]' \ - '(--html --xml --plaintext)--docbook[output in DocBook XML format]' \ - '(--docbook --xml --plaintext)--html[output in HTML format]' \ + '(--html --xml --epub3 --latex --plaintext)--docbook[output in DocBook XML format]' \ + '(--docbook --xml --epub3 --latex --plaintext)--html[output in HTML format]' \ '--no-headers[suppress node separators and menus]' \ - '(--docbook --html --plaintext)--xml[output in XML (TexinfoML) format]' \ - '(--docbook --html --xml)--plaintext[output in plain text format]' \ + '(--docbook --html --epub3 --latex --plaintext)--xml[output in XML (TexinfoML) format]' \ + '(--docbook --html --xml --latex --plaintext)--epub3[output in EPUB 3 format]' \ + '(--docbook --html --xml --epub3 --plaintext)--latex[output in LaTeX format]' \ + '(--docbook --html --xml --epub3 --latex)--plaintext[output in plain text format]' \ '--dvi[output in dvi format]' \ '--dvipdf[output in pdf format]' \ '--ps[output in ps format]' \ @@ -138,11 +141,13 @@ case $service in '(--docbook --xml)--no-split[suppress splitting of output]' \ '--no-number-sections[output chapter and section numbers]' \ '!(--no-number-sections)--number-sections' \ + '--no-number-footnotes[number footnotes sequentially]' \ + '!(--no-number-footnotes)--number-footnotes' \ '(-o --output=)'{-o,--output}'[specify output file]:output file:_files' \ '(--docbook --html --xml)--disable-encoding[output special characters]' \ '!(--disable-encoding)--enable-encoding' \ '(--docbook --html --xml)--fill-column=[specify width to break lines at]:width [72]' \ - '(--docbook --html --xml)--footnote-style=[specify style for output of footnotes]:((separate\:in\ own\ node end\:at\ end\ of\ node))' \ + '(--docbook --html --xml)--footnote-style=[specify style for output of footnotes]:style [end]:((separate\:in\ own\ node end\:at\ end\ of\ node))' \ '(--docbook --html --xml)--paragraph-indent=[specify spaces to indent paragraphs by]:indent [3]' \ '(--docbook --html --xml)--split-size=[split Info files at specified size]:size [300000]' \ '(--docbook --xml --plaintext)--css-include=[specify file in include in HTML <style> output]:file:_files' \ @@ -151,7 +156,7 @@ case $service in '(--docbook --xml --plaintext)--split=[split output at specified boundary]:split boundary:(chapter section node)' \ '(--docbook --xml --plaintext)--transliterate-file-names[produce file names in ASCII transliteration]' \ '(--docbook --xml --plaintext)--node-files[produce redirection files for nodes]' \ - '-Xopt=[specify option to texi2dvi]:options' \ + '*-Xopt=[pass option to texi2dvi]:option' \ '-D[define variable]:variable' \ '-I[specify directory to append to @include search path]:directory:_files -/' \ '-P[specify directory to prepend to @include search path]:directory:_files -/' \ diff --git a/Completion/Unix/Command/_tiff b/Completion/Unix/Command/_tiff index 1aeff3ff7..f44df0ec9 100644 --- a/Completion/Unix/Command/_tiff +++ b/Completion/Unix/Command/_tiff @@ -157,7 +157,8 @@ tiffinfo) '-s[display offsets and byte counts for all data strips]' \ '-i[ignore read errors]' \ '-f+[force fill order]:fill order:(lsb2msb msb2lsb)' \ - '-w[display raw data in words]' \ + '-w[show image data as 16-bit words]' \ + '-W[warn about unknown tags]' \ '-z[enable strip chopping]' \ '-M+[set the memory allocation limit]:limit (MiB), 0 for unlimited' \ '*:input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 @@ -172,7 +173,7 @@ tiffmedian) ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffsplit) - _arguments \ + _arguments : \ '-M+[set the memory allocation limit]:limit (MiB), 0 for unlimited' \ ':input file:_files -g "*.(#i)tif(|f)(-.)"' \ ':output file prefix' && ret=0 @@ -235,6 +236,7 @@ pal2rgb) *) _description files expl 'picture file' _files "$expl[@]" -g "$pat" && ret=0 +;; esac if [[ -n "$state" ]]; then @@ -265,7 +267,7 @@ if [[ -n "$state" ]]; then while _tags; do while _next_label values expl 'compression scheme'; do compadd "$expl[@]" - none jbig g4 packbits sgilog && ret=0 - compadd "$expl[@]" -qS: - lzw zip lzma zstd webp jpeg g3 && ret=0 + compadd "$expl[@]" -qS: - lzw zip lerc lzma zstd webp jpeg g3 && ret=0 done (( ret )) || return 0 done diff --git a/Completion/Unix/Command/_timeout b/Completion/Unix/Command/_timeout index f1961012d..676f8e8cd 100644 --- a/Completion/Unix/Command/_timeout +++ b/Completion/Unix/Command/_timeout @@ -11,9 +11,9 @@ local args ) _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]" \ + '(-p --preserve-status)'{-p,--preserve-status}'[always exit with the same status as command even if it times out]' \ + '(-f --foreground)'{-f,--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' \ + '(-k --kill-after)'{-k+,--kill-after=}'[followup first signal with SIGKILL if command persists after specified time]: :_numbers -f -u seconds duration \:s\:seconds m\:minutes h\:hours d\:days' \ '1: :_numbers -f -u seconds duration :s:seconds m:minutes h:hours d:days' \ '*:::command: _normal -p $service' diff --git a/Completion/Unix/Command/_tla b/Completion/Unix/Command/_tla deleted file mode 100644 index ec7e76d44..000000000 --- a/Completion/Unix/Command/_tla +++ /dev/null @@ -1,631 +0,0 @@ -#compdef tla - -autoload -z is-at-least -local TLA=$words[1] -local tla_version -local hide_short - -# ask the user which version of tla this is -if ! zstyle -s ":completion:${curcontext}:" tla-version tla_version; then - # ask tla instead - tla_version="$($TLA --version)" - if [[ "${${(f)tla_version}[1]}" == The\ GNU\ Arch\ Revision\ Control\ System\ \(tla\)\ (#b)([0-9.]##) ]]; then - tla_version="$match[1]" - else - tla_version="${${$($TLA --version)#tla tla-}%% from regexps.com*}" - [[ $tla_version == *[a-zA-Z]* ]] && tla_version=1.3 # tla doesn't know - fi -fi - -# test whether to hide short options from completion -if zstyle -s ":completion:${curcontext}:" hide-shortopts hide_short; then - case $hide_short in - true|yes|on|1) hide_short='!' ;; - *) hide_short='' ;; - esac -fi - -# completion functions - -(( $+functions[_tla_archives] )) || -_tla_archives () { _arch_archives tla "$@" } - -(( $+functions[_tla_categories] )) || -_tla_categories () { _arch_namespace tla 1 "$argv[@]" } - -(( $+functions[_tla_branches] )) || -_tla_branches () {_arch_namespace tla 2 "$argv[@]" } - -(( $+functions[_tla_versions] )) || -_tla_versions () { _arch_namespace tla 3 "$argv[@]" } - -(( $+functions[_tla_revisions] )) || -_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 "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. - # Should complete based on -A, -R, -d -} - -(( $+functions[_tla_config] )) || -_tla_config () { - - # zsh 4.1.1+ is recommended; 4.0.6 gives the error below when doing - # tla build-config e<TAB> - # _path_files:322: no matches found: configs//e/.(/) - # whereas 4.1.1 completes correctly - - local configdir root ret=1 n expl - - n=$opt_args[(i)(-d|--dir)] - [[ -n "$n" ]] && configdir=$opt_args[$n] - root="$(_call_program tla $TLA tree-root ${configdir} 2>&1)" - if (( $? )); then - _message -e messages "Error: $root" - return $ret - fi - - if [[ -d "$root/configs" ]]; then - configdir=("$root/configs") - _description files expl 'config file' - _files -W configdir "$expl[@]" && ret=0 - else - _message -e messages "No configs/ directory in tree whose root is $root" - fi - return $ret -} - -(( $+functions[_tla_limit] )) || -_tla_limit () { #presently only does push-mirror style limits - [[ $words[$CURRENT] == *@* ]] && return 1 - - local expl archive - archive=${words[(r)*@*]:-$($TLA my-default-archive 2> /dev/null)} - if [ $archive ]; then - - if [[ $PREFIX != *--* ]]; then - _description -V categories expl "category in $archive" - compadd -q -S -- "$expl[@]" `$TLA categories -A $archive` - else - _tla_namespace_branches 3 - fi - fi -} - -(( $+functions[_tla_tree_or_rev] )) || -_tla_tree_or_rev () { - _alternative 'trees:tree:_files -/' 'revisions:revision:_tla_revisions' -} - -(( $+functions[_tla_libraries] )) || -_tla_libraries () { - local libraries expl - libraries=($(_call_program tla $TLA my-revision-library)) - _description -V libraries expl "revision library" - compadd "$expl[@]" -a libraries -} - -(( $+functions[_tla_my_revision_library] )) || -_tla_my_revision_library () { - if [[ -n $words[(r)-d] ]] || [[ -n $words[(r)--delete] ]]; then - _tla_libraries - else - _files -/ - fi -} - -(( $+functions[_tla_log_versions] )) || -_tla_log_versions () { - local logs expl - if is-at-least 1.1 $tla_version; then - logs=($(_call_program tla $TLA log-versions)) - else - logs=($(_call_program tla $TLA logs)) - fi - _description -V versions expl "log version" - compadd "$expl[@]" -a logs -} - -# command argument definitions -# commands with different versions - -local cmd_register_archive cmd_archives cmd_ls_archives cmd_redo -local cmd_redo_changes cmd_changes cmd_what_changed cmd_categories -local cmd_branches cmd_versions cmd_cacherev cmd_logs cmd_log_versions -local cmd_log_ls cmd_update cmd_join_branch cmd_replay cmd_deltapatch -local cmd_delta_patch cmd_apply_delta cmd_sync_tree cmd_make_sync_tree -local cmd_delta cmd_revdelta cmd_library_categories cmd_library_branches -local cmd_library_versions cmd_library_revisions -local cmd_archive_register - -cmd_log_ls=('*:version:_tla_log_versions') -cmd_log_versions=() -# the options should only complete items that are in the tree - -if is-at-least 1.1 $tla_version; then - cmd_register_archive=('::archive:_tla_archives' ':location:_files -/') - cmd_archive_register=($cmd_register_archive) - cmd_archives=('::regex:') - cmd_redo=('::changeset:_files -/') - cmd_changes=('::revision:_tla_revisions' - # ':separator:(--)' '*::limit:_files' - #don't understand the limit usage - ) - cmd_categories=('::archive:_tla_archives') - cmd_branches=('::category:_tla_categories') - cmd_versions=('::branch:_tla_branches') - cmd_cacherev=('::revision:_tla_revisions') - #should only complete non-cached revisions - - cmd_logs=($cmd_log_ls) - cmd_update=('::revision:_tla_revisions') - cmd_join_branch=(':revision:_tla_revisions') - #should only complete continuation revisions - - cmd_replay=('*::revision:_tla_revisions') - cmd_deltapatch=(':FROM:_tla_tree_or_rev' ':TO:_tla_tree_or_rev') - cmd_sync_tree=(':revision:_tla_revisions') - cmd_delta=(':FROM:_tla_tree_or_rev' ':TO:_tla_tree_or_rev' '::DEST:_files -/') - cmd_library_categories=('::archive:_tla_archives --library') - cmd_library_branches=('::category:_tla_categories --library') - cmd_library_versions=('::branch:_tla_branches --library') - cmd_library_revisions=('::version:_tla_versions --library') -else - cmd_register_archive=(':archive:_tla_archives' ':location:_files -/') - cmd_archives=() - cmd_redo=() - cmd_changes=('::revision:_tla_revisions') - cmd_categories=() - cmd_branches=(':category:_tla_categories') - cmd_versions=(':branch:_tla_branches') - cmd_cacherev=(':revision:_tla_revisions' '::dir:_files -/') - cmd_logs=($cmd_log_versions) - cmd_update=(':dir:_files -/' '::newdir:_files -/' - '::revision:_tla_revisions') - cmd_join_branch=(':dir:_files -/' '::newdir:_files -/' - ':revision:_tla_revisions') - cmd_replay=(':dir:_files -/' '::newdir:_files -/' '::revision:_tla_revisions') - cmd_deltapatch=(':FROM:_tla_tree_or_rev' ':TO:_tla_tree_or_rev' - ':UPON:_tla_tree_or_rev' '::DEST:_files -/') - cmd_sync_tree=(':dir:_files -/' '::newdir:_files -/' - ':revision:_tla_revisions') - cmd_delta=(':FROM:_tla_tree_or_rev' ':TO:_tla_tree_or_rev') - cmd_library_categories=() - cmd_library_branches=(':category:_tla_categories --library') - cmd_library_versions=(':branch:_tla_branches --library') - cmd_library_revisions=(':version:_tla_versions --library') -fi - -cmd_ls_archives=($cmd_archives) -cmd_redo_changes=($cmd_redo) -cmd_what_changed=($cmd_changes) -cmd_delta_patch=($cmd_deltapatch) -cmd_apply_delta=($cmd_deltapatch) -cmd_make_sync_tree=($cmd_sync_tree) -cmd_revdelta=($cmd_delta) - -# commands the same in all versions - -local cmd_help -cmd_help=() - -local cmd_my_id -cmd_my_id=('::id-string:') - -local cmd_my_default_archive -cmd_my_default_archive=('::archive:_tla_archives') - -local cmd_whereis_archive -cmd_whereis_archive=(':archive:_tla_archives') - -local cmd_init_tree -cmd_init_tree=('::version:_tla_versions') - -local cmd_tree_root -cmd_tree_root=('::directory:_files -/') - -local cmd_tree_version -cmd_tree_version=('::directory:_files -/') - -local cmd_set_tree_version -cmd_set_tree_version=(':version:_tla_versions') - -local cmd_build_config cmd_buildcfg -cmd_build_config=(':config:_tla_config') -cmd_buildcfg=($cmd_build_config) - -local cmd_cat_config cmd_catcfg cmd_cfgcat -cmd_cat_config=(':config:_tla_config') -cmd_catcfg=($cmd_cat_config) -cmd_cfgcat=($cmd_cat_config) - -local cmd_undo cmd_undo_changes -cmd_undo=('::revision:_tla_revisions') -cmd_undo_changes=($cmd_undo) - -local cmd_file_diffs -cmd_file_diffs=(':file:_files' '::revision:_tla_revisions') - -local cmd_file_find -cmd_file_find=(':file:_files' '::revision:_tla_revisions') - -local cmd_inventory cmd_srcfind -cmd_inventory=('::separator:(--)' '*:directory:_files -/') -cmd_srcfind=($cmd_inventory) - -local cmd_tree_lint cmd_lint -cmd_tree_lint=('::directory:_files -/') -cmd_lint=($cmd_tree_lint) - -local cmd_id cmd_invtag -cmd_id=('*:file:_files') -cmd_invtag=($cmd_id) - -local cmd_id_tagging_method cmd_tagging_method methods -cmd_id_tagging_method=('::tagging method:(($methods))') -methods=( - 'names:use naming conventions only' - 'implicit:use naming conventions but permit for inventory tags' - 'tagline:use naming conventions but permit for inventory tags' - 'explicit:require explicit designation of source' -) -cmd_tagging_method=($cmd_id_tagging_method) - -local cmd_add cmd_add_id cmd_add_tag -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=('*:file to delete:_files') -cmd_delete_id=($cmd_delete) -cmd_delete_tag=($cmd_delete) - -local cmd_move cmd_move_id cmd_move_tag -cmd_move_id=(':old name:_files' ':new name:_files') -cmd_move_id=($cmd_move) -cmd_move_tag=($cmd_move) -#would be nice not to offer dirs for newname if oldname is a file, and -#vice versa - -local cmd_mv -cmd_mv=('*:file:_files') -# not really right, but close enough - -local cmd_default_id cmd_explicit_default cmd_default_tag -cmd_default_id=('::TAG-PREFIX:') -cmd_explicit_default=($cmd_default_id) -cmd_default_tag=($cmd_default_id) - -local cmd_tagging_defaults cmd_id_tagging_defaults -cmd_tagging_defaults=() -cmd_id_tagging_defaults=($cmd_tagging_defaults) - -local cmd_changeset cmd_mkpatch -cmd_changeset=( - ':ORIG:_files -/' - ':MOD:_files -/' - ':DEST:_files -/' - '*:file:_files' -) -cmd_mkpatch=("$cmd_changeset[@]") - -local cmd_dopatch cmd_do_changeset cmd_apply_changeset -cmd_dopatch=(':changeset:_files -/' ':target:_files -/') -cmd_do_changeset=($cmd_dopatch) -cmd_apply_changeset=($cmd_dopatch) - -local cmd_show_changeset -cmd_show_changeset=('::changeset:_files -/') - -local cmd_make_archive -cmd_make_archive=('::name:' ':location:_files -/') - -local cmd_archive_setup -cmd_archive_setup=('*:version:_tla_branches --trailing-dashes') - -local cmd_make_category -cmd_make_category=(':category:_tla_archives -S /') - -local cmd_make_branch -cmd_make_branch=(':branch:_tla_categories --trailing-dashes') - -local cmd_make_version -cmd_make_version=(':version:_tla_branches --trailing-dashes') - -local cmd_import cmd_imprev -cmd_import=('::version:_tla_versions') -cmd_imprev=($cmd_import) - -local cmd_commit cmd_cmtrev -cmd_commit=('::version:_tla_versions' ':separator:(--)' '*:file:_files') -cmd_cmtrev=($cmd_commit) - -local cmd_get cmd_getrev -cmd_get=(':revision:_tla_revisions' '::directory:_files -/') -cmd_getrev=($cmd_get) - -local cmd_get_patch cmd_get_changeset -cmd_get_patch=(':revision:_tla_revisions' '::dir:_files -/') -cmd_get_changeset=($cmd_get_patch) - -local cmd_lock_revision -cmd_lock_revision=(':revision:_tla_revisions') - -local cmd_push_mirror cmd_archive_mirror -cmd_push_mirror=( - '::FROM or MINE:_tla_archives' - '::TO:_tla_archives' - '::LIMIT:_tla_limit' -) -cmd_archive_mirror=($cmd_push_mirror) - -local cmd_revisions -cmd_revisions=('::version:_tla_versions') - -local cmd_ancestry -cmd_ancestry=('::revision:_tla_revisions') - -local cmd_ancestry_graph -cmd_ancestry_graph=('::revision:_tla_revisions') - -local cmd_cat_archive_log -cmd_cat_archive_log=(':revision:_tla_revisions') - -local cmd_cachedrevs -cmd_cachedrevs=(':version:_tla_versions') - -local cmd_uncacherev -cmd_uncacherev=(':revision:_tla_revisions' '::dir:_files -/') - -local cmd_archive_meta_info -cmd_archive_meta_info=(':item-name:((name\:foo mirror\:bar))') - -local cmd_archive_snapshot -cmd_archive_snapshot=(':dir:_files -/' '::limit:_tla_revisions') - -local cmd_archive_version -cmd_archive_version=() - -local cmd_archive_fixup -cmd_archive_fixup=() - -local cmd_make_log -cmd_make_log=('::version:_tla_versions') - -local cmd_add_log cmd_add_log_version -cmd_add_log=(':version:_tla_versions') -cmd_add_log_version=($cmd_add_log) - -local cmd_remove_log cmd_remove_log_version -cmd_remove_log=(':version:_tla_log_versions') -cmd_remove_log_version=($cmd_remove_log) - -local cmd_abrowse -cmd_abrowse=('::LIMIT:_tla_revisions') - -local cmd_cat_log -cmd_cat_log=(':revision-spec:_tla_local_revisions') - -local cmd_changelog -cmd_changelog=('::version:_tla_versions') - -local cmd_log_for_merge -cmd_log_for_merge=('::version:_tla_versions') - -local cmd_merges -cmd_merges=(':INTO:_tla_revisions' '::FROM:_tla_revisions') - -local cmd_new_merges -cmd_new_merges=('::version:_tla_versions') - -local cmd_tag cmd_tagrev cmd_branch -cmd_tag=(':SOURCE-REVISION:_tla_revisions' ':TAG-VERSION:_tla_versions') -cmd_tagrev=($cmd_tag) -cmd_branch=($cmd_tag) - -local cmd_star_merge -cmd_star_merge=(':FROM:_tla_revisions') - -local cmd_missing cmd_whats_missing -cmd_missing=('::revision:_tla_revisions') -cmd_whats_missing=($cmd_missing) - -local cmd_pristines cmd_ls_pristines -cmd_pristines=('::limit:_tla_revisions') -cmd_ls_pristines=($cmd_pristines) - -local cmd_lock_pristine -cmd_lock_pristine=(':revision:_tla_revisions') - -local cmd_add_pristine -cmd_add_pristine=(':revision:_tla_revisions') - -local cmd_find_pristine -cmd_find_pristine=(':revision:_tla_revisions') - -local cmd_my_revision_library cmd_library_dir -cmd_my_revision_library=(':library:_tla_my_revision_library') -cmd_library_dir=($my_revision_library) - -local cmd_library_find -cmd_library_find=(':revision:_tla_revisions --library') - -local cmd_library_add -cmd_library_add=(':revision:_tla_revisions --exclude-library-revisions') - -local cmd_library_remove -cmd_library_remove=(':revision:_tla_revisions --library') - -local cmd_library_archives -cmd_library_archives=() - -local cmd_library_log -cmd_library_log=(':revision:_tla_revisions --library') - -local cmd_library_file -cmd_library_file=(':file:_files' ':revision:_tla_revisions --library') - -local cmd_grab -cmd_grab=(':location:_files') - -local cmd_parse_package_name -cmd_parse_package_name=(':name:') - -local cmd_valid_package_name -cmd_valid_package_name=(':name:') - -local cmd_library_config -cmd_library_config=(':library:_tla_libraries') - -local cmd_rbrowse -cmd_rbrowse=('::regular expression:') - -local cmd_rm -cmd_rm=('*:file:_files') - -local cmd_escape -cmd_escape=(':string:') - -local cmd_diff -cmd_diff=('::revision:_tla_revisions') - -local cmd_export -cmd_export=(':revision:_tla_revisions' ':dir:_files -/') - -#mutually exclusive options - -local -A excludes -excludes=( -# This first line means that if --output was given, don't complete -# --no-output or --keep. The converse is not true. ---output '--no-output --keep' ---no-output --output - ---silent ' --quiet --report --verbose --debug' ---quiet '--silent --report --verbose --debug' ---report '--silent --quiet --verbose --debug' ---verbose '--silent --quiet --report --debug' ---debug '--silent --quiet --report --verbose ' - ---sparse --non-sparse ---non-sparse --sparse - ---files ' --directories --both' ---directories '--files --both' ---both '--files --directories ' - ---mirror --mirror-from ---mirror-from --mirror - ---no-cached --cached-tags ---cached-tags --no-cached - ---non-greedy --greedy ---greedy --non-greedy -) - -_tla_main () { - typeset -A opt_args - local arguments - if (( CURRENT > 2 )); then - local cmd=${words[2]} - local var_cmd=cmd_${cmd//-/_} - curcontext="${curcontext%:*:*}:tla-$cmd:" - (( CURRENT-- )) - shift words - - arguments=() - local input - input=(${${(M)${(f)"$($TLA $cmd -h)"}:# *}# }) - - local i j=1 - local short long arg desc action - short=() - long=() - arg=() - desc=() - action=() - for (( i=1 ; i <= ${#input} ; i++ )); do - [[ "$input[i]" != *[^\ ]* ]] && continue # stupid blank lines - short[j]="${${${input[i]}[1,2]}#--}" - long[j]="${${input[i]#-?, }%% *}" - - arg[j]="${${${input[i]%% *}##* }##-*}" - [[ $long[j] == --archive ]] && arg[j]=ARCHIVE # tla doesn't mention this - - desc[j]="${input[i]##* }" - if [[ "$input[i+1]" == \ *[^\ ]* ]]; then # description continues - (( i++ )) - desc[j]="$desc[j] ${input[i]##* }" - fi - [[ "$short[j]" == -[hHV] ]] && continue - desc[j]="${${desc[j]//\[/\\[}//\]/\\]}" # escape brackets - - case $arg[j] in - DIR|PATCH-DIR|DEST|OUTPUT|PATH) - action[j]='_files -/' ;; - FILES|FILE|SNAP-FILE) - action[j]='_files' ;; - MASTER|MASTER-SOURCE|ARCHIVE) - action[j]='_tla_archives' ;; - CATEGORY) - action[j]='_tla_categories' ;; - BRANCH) - action[j]='_tla_branches' ;; - VERSION) - action[j]='_tla_versions' ;; - CFG) - action[j]='_tla_configs' ;; - LIB) - action[j]='_tla_libraries' ;; -# PATCH,FILE) # not sure how to complete this -# action[j]='_tla_patch_file' ;; - *) - action[j]='' ;; - esac - - (( j++ )) - - done - - local excluded k - for (( i = 1 ; i < j ; i++ )); do - excluded=($short[i] $long[i]) - foreach opt (${=excludes[$long[i]]}) - k=$long[(i)$opt] - excluded=($excluded $short[k] $long[k]) - #excludes matching short options too :-) - end - - - # generate arguments to _arguments ;-) - # make long and short options mutually exclusive - [ $short[i] ] && arguments=("$arguments[@]" - "${hide_short}(${excluded})${short[i]}[${desc[i]}]${arg[i]:+:$arg[i]:$action[i]}") - [ $long[i] ] && arguments=("$arguments[@]" - "(${excluded})${long[i]}[${desc[i]}]${arg[i]:+:$arg[i]:$action[i]}") - done - - arguments=("$arguments[@]" "${(@P)var_cmd-*:FILE:_files}") - else - local help - local -U cmds - help=(${(f)"$($TLA help)"}) - cmds=(${${${${(M)help:#* :*}/ #: #/:}%% ##}## #}) - arguments=(':command:(($cmds))') - fi - _arguments -S -A '-*' \ - {"${hide_short}(: -)-V",'(: -)--version'}'[display version]' \ - {"${hide_short}(: -)-h",'(: -)--help'}'[display help]' \ - '(: -)-H[display verbose help]' \ - "$arguments[@]" -} - -_tla_main "$@" diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux index b9c220f17..80c69d2fb 100644 --- a/Completion/Unix/Command/_tmux +++ b/Completion/Unix/Command/_tmux @@ -567,7 +567,7 @@ _tmux-list-windows() { [[ -n ${tmux_describe} ]] && print "list windows of a session" && return _arguments -s \ '-a[list all windows the tmux server possesses]' \ - '-F[specify output format]:format:__tmux-formats' \ + '-F+[specify output format]:format:__tmux-formats' \ '-f+[filter items]:filter format:__tmux-formats' \ '-t+[specify session]:session:__tmux-sessions' } @@ -764,7 +764,7 @@ _tmux-respawn-pane() { '-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' \ + '-t+[specify target pane]:pane:__tmux-panes' \ ':command:_cmdambivalent' } @@ -886,7 +886,7 @@ _tmux-server-access() { } _tmux-set-buffer() { - [[ -n ${tmux_describe} ]] && print "set contents of a paster buffer" && return + [[ -n ${tmux_describe} ]] && print "set contents of a paste buffer" && return _arguments -s -A "-*" -S \ '-a[append to rather than overwriting target buffer]' \ '-b+[specify target buffer index]:pane:__tmux-buffers' \ @@ -999,7 +999,7 @@ _tmux-show-hooks() { _tmux-show-buffer() { [[ -n ${tmux_describe} ]] && print "display the contents of a paste buffer" && return - _arguments '-b[specify target buffer index]:pane:->buffer' + _arguments '-b[specify target buffer index]:buffer:__tmux-buffers' } _tmux-show-environment() { @@ -1648,16 +1648,22 @@ function __tmux-session-options() { 'display-panes-active-colour:colour for active pane in display-panes' 'display-panes-time:time (in msecs) of display-panes output' 'display-time:time (in msecs) messages are displayed' + 'focus-follows-mouse:select panes when the mouse enters them' 'history-limit:number of copy-mode lines per window' + 'initial-repeat-time:initial repeat-key timeout' 'key-table:default key table' 'lock-after-time:lock sessions after N seconds' 'lock-command:command to run for locking a client' 'message-command-style:status line message command style' + 'message-format:prompt and message area format' 'message-line:status message and command prompt position' 'message-style:status line message style' 'mouse:enable mouse support' 'prefix:primary prefix key' 'prefix2:secondary prefix key' + 'prompt-command-cursor-style:cursor style in vi prompt command mode' + 'prompt-cursor-colour:prompt cursor colour' + 'prompt-cursor-style:prompt cursor style' 'renumber-windows:renumber windows if a window is closed' 'repeat-time:time for multiple commands without prefix-key presses' 'set-titles:try to set xterm window titles' @@ -1729,22 +1735,29 @@ function __tmux-server-options() { tmux_server_options=( 'backspace:set key sent by tmux for backspace' 'buffer-limit:number of buffers kept per session' + 'codepoint-widths:list of override widths for Unicode codepoints' 'command-alias:custom command aliases' 'copy-command:specify the default command when "copy-pipe" is called without arguments' + 'default-client-command:default tmux command with no subcommand' 'default-terminal:default terminal definition string' 'escape-time:set timeout to detect single escape characters (in msecs)' 'editor:specify the command used when tmux runs an editor' 'exit-unattached:make server exit if it has no attached clients' 'exit-empty:exit when there are no active sessions' 'extended-keys:control whether tmux will send extended keys through to the terminal' + 'extended-keys-format:extended-key output format' 'focus-events:request focus events from terminal' + 'get-clipboard:how tmux answers clipboard requests' 'history-file:tmux command history file name' + 'input-buffer-size:input bytes allowed before dropping' 'message-limit:set size of message log per client' + 'prefix-timeout:prefix-key timeout' 'prompt-history-limit:set the number of history items to save in the history file' 'set-clipboard:use esc sequences to set terminal clipboard' 'terminal-features:set terminal features not detected by terminfo' 'terminal-overrides:override terminal descriptions' 'user-keys:set list of user-defined key escape sequences' + 'variation-selector-always-wide:treat Unicode VS16 as always wide' ) _describe -t tmux-server-options 'tmux server option' tmux_server_options } @@ -1800,6 +1813,7 @@ function __tmux-window-options() { 'aggressive-resize:aggressively resize windows' 'allow-passthrough:allow programs in the pane to bypass tmux' 'allow-rename:allow programs to change window titles' + 'allow-set-title:allow apps to set pane titles' 'alternate-screen:allow alternate screen feature to be used' 'automatic-rename-format:format for automatic renames' 'automatic-rename:attempt to automatically rename windows' @@ -1808,6 +1822,9 @@ function __tmux-window-options() { 'copy-mode-current-match-style:set the style of the current search match in copy mode' 'copy-mode-mark-style:set the style of the line containing the mark in copy mode' 'copy-mode-match-style:set the style of search matches in copy mode' + 'copy-mode-position-format:format for the position indicator in copy mode' + 'copy-mode-position-style:style for position indicator in copy mode' + 'copy-mode-selection-style:style for selection in copy mode' 'cursor-colour:set the colour of the cursor' 'cursor-style:set the style of the cursor' 'fill-character:set the character used to fill unused window areas' @@ -1832,13 +1849,21 @@ function __tmux-window-options() { 'pane-border-status:turn border status off or set its position' 'pane-border-style:style of border pane' "pane-colours:an array used to configure tmux's colour palette" + 'pane-scrollbars:pane scrollbar visibility mode' + 'pane-scrollbars-position:side used for pane scrollbars' + 'pane-scrollbars-style:pane scrollbar style' + 'pane-status-current-style:current pane status-line style' + 'pane-status-style:pane status-line style' 'popup-border-lines:set the type of line used to draw popup borders' "popup-border-style:set the style for the popup's border" 'popup-style:set the popup style' "remain-on-exit:don't destroy windows after the program exits" "remain-on-exit-format:set the text shown at bottom of exited panes" 'scroll-on-clear:scroll previous contents into history before clear' + 'session-status-current-style:current session status-line style' + 'session-status-style:session status-line style' 'synchronize-panes:send input to all panes of a window' + 'tiled-layout-max-columns:column limit for the tiled layout' 'window-active-style:style of active window' 'window-size:indicate how to automatically size windows' 'window-status-activity-style:style of status bar activity tag' diff --git a/Completion/Unix/Command/_totd b/Completion/Unix/Command/_totd deleted file mode 100644 index 4d55d29bb..000000000 --- a/Completion/Unix/Command/_totd +++ /dev/null @@ -1,13 +0,0 @@ -#compdef totdconfig - -_arguments \ - - set1 \ - '-a[add totd specific options]' \ - '-D[add totd specific config into dhclient-enter-hooks]' \ - '-d:name server:_hosts' \ - '-l[configure resolv.conf]' \ - - set2 \ - '-r:config to remove:(dhcp totd resolv all)' \ - - set3 \ - '-h[help]' - diff --git a/Completion/Unix/Command/_tree b/Completion/Unix/Command/_tree index 595249126..fdb22a9c9 100644 --- a/Completion/Unix/Command/_tree +++ b/Completion/Unix/Command/_tree @@ -1,22 +1,29 @@ #compdef tree +# tree has its own weird option-parsing method that requires arguments to short +# options to appear in the next word... except for -L (as of 2.2.1) _arguments -s -S \ '-a[show all files, including hidden ones]' \ '-d[list directories only]' \ '-l[follow symlinks that point to directories]' \ '-f[print full path prefix for each file]' \ '-x[stay on current filesystem]' \ - '-L[specify max tree depth to descend]:level' \ + '-L+[specify max tree depth to descend]: :_numbers -l1 depth' \ '-R[recursively cross down the tree and execute tree again]' \ - '-P[only list files matching a pattern]:pattern:_files' \ - "-I[don't list files matching a pattern]:pattern:_files" \ + '-P[only list files matching specified pattern]:pattern:_files' \ + "-I[don't list files matching specified pattern]:pattern:_files" \ + '--gitignore[respect .gitignore files for filtering]' \ + '*--gitfile=[use specified file as gitignore file]:gitignore file:_files' \ '--ignore-case[ignore case when pattern matching]' \ '--matchdirs[include directory names in -P pattern matching]' \ + '--metafirst[print file meta-data at beginning of line]' \ + '--info[print file comments found in .info files]' \ + '*--infofile=[use specified file as info file]:info file:_files' \ '--noreport[omit file and directory report at end]' \ - '--charset=[character set for HTML and for line drawing]:charset' \ - "--filelimit=[don't descend directories with more than specified number of entries]:entries" \ - '--timefmt=[use specified time format]:format:_date_formats' \ - '-o[output to specified file]:file:_files' \ + '--charset=[specify character set for HTML and line drawing]:charset' \ + "--filelimit=[don't descend directories with more than specified number of entries]: :_numbers entries" \ + '--timefmt=[use specified time format]: :_date_formats' \ + '-o[output to specified file]: :_files' \ '--du[print directory sizes]' \ '--prune[exclude empty directories from the output]' \ '(-N)-q[print non-printable characters as question mark, not caret]' \ @@ -32,24 +39,33 @@ _arguments -s -S \ '-F[append descriptive character to end, like ls -F]' \ '--inodes[print inode numbers]' \ '--device[print device number to which file or directory belongs]' \ - '(--sort -t -c -U)-v[sort the output as version]' \ + '(--sort -t -c -U)-v[sort output as version]' \ '(-v --sort -c -U)-t[sort output by modification time]' \ '(-v --sort -t -U)-c[sort output by change time]' \ '(-v --sort -t -c -r --dirsfirst)-U[leave files unsorted]' \ '(-U)-r[sort in reversed order]' \ - '(-v -t -c -U)--sort[sort in specified order]:order:(name version size mtime ctime)' \ - '(-U)--dirsfirst[list directories before files]' \ + '(-v -t -c -U)--sort=[sort in specified order]:order:(name version size mtime ctime none)' \ + '(-U --filesfirst)--dirsfirst[list directories before files]' \ + '(-U --dirsfirst)--filesfirst[list files before directories]' \ "-i[don't print indentation lines]" \ - '(-S -X)-A[use ANSI line graphics hack when printing indentation lines]' \ - '(-A -X)-S[use console (CP437) line graphics]' \ - '(-C)-n[turn colorization off always, over-ridden by the -C option]' \ + '(-S -H -J -X)-A[use ANSI line graphics hack when printing indentation lines]' \ + '(-A)-S[equivalent to --charset=IBM437]' \ + '(-C)-n[turn colorization off always]' \ '(-n)-C[turn colorization on always]' \ - '(-A -S -n -C -J -H -T --nolinks)-X[XML output]' \ - '(-A -S -n -C -X -H -T --nolinks)-J[JSON output]' \ - '(-n -C -X)-H[turn on HTML output]:base HREF' \ - '(-n -C -X)-T[title for HTML output]:title' \ - '(-n -C -X)--nolinks[turn off hyperlinks in HTML output]' \ - '--fromfile[read paths from specified files]' \ - '(-)--version[version of tree]' \ - '(-)--help[verbose usage listing]' \ - '*:directory:_files -/' + '(-A -J -H -T --nolinks)-X[turn on XML output]' \ + '(-A -X -H -T --nolinks)-J[turn on JSON output]' \ + '(-A -J -X)-H[turn on HTML output]:base HREF' \ + '(-A -J -X)--hintro=[use specified file as HTML intro]:HTML intro file:_files' \ + '(-A -J -X)--houtro=[use specified file as HTML outro]:HTML outro file:_files' \ + '(-A -J -X)-T[specify title for HTML output]:title' \ + '(-A -J -X --hyperlink)--nolinks[turn off hyperlinks in HTML output]' \ + '(-H -J -X --nolinks)--hyperlink[turn on OSC 8 hyperlinks]' \ + '(-H -J -X --nolinks)--scheme=[specify schema used for OSC 8 hyperlinks]:schema [file\://]' \ + '(-H -J -X --nolinks)--authority=[specify authority (host name) used for OSC 8 hyperlinks]: :_hosts' \ + '(--fromtabfile)--fromfile[read paths from specified files]:paths file:_files' \ + '(--fromfile)--fromtabfile[read tab-indented paths from specified files]:paths file:_files' \ + '--fflinks[process symbolic link information with in files (with --from*file)]' \ + '--opt-toggle[turn on option toggling]' \ + '(- :)--version[display version information]' \ + '(- :)--help[display help information]' \ + '*: :_directories' diff --git a/Completion/Unix/Command/_twidge b/Completion/Unix/Command/_twidge deleted file mode 100644 index d8b3b3def..000000000 --- a/Completion/Unix/Command/_twidge +++ /dev/null @@ -1,77 +0,0 @@ -#compdef twidge -## completion for twidge 1.0.8, based on twidge(1) - -function _twidge_command { - typeset -a twidge_commands - typeset -i skip=1 - - twidge lscommands | while read cmd desc; do - if [[ $cmd == ---* ]] { - skip=0 - continue - } - if (( skip )) { - continue - } - twidge_commands+="${cmd}:${desc}" - done - - _describe command twidge_commands -} - -function _twidge_args { - typeset -a args_common args_more args_other args_update - - args_common=( - '(-a --all)'{-a,--all}'[receive all content]' - '(-e --exec)'{-e,--exec}'[execute command for each retrieved item]:command' - '(-l --long)'{-l,--long}'[long output format]' - '(-m --mailto)'{-m,--mailto}'[mail retrieved items]:mail address' - ) - - args_more=( - '(-s --saveid)'{-s,--saveid}'[save ID of most recent message]' - '(-u --unseen)'{-u,--unseen}'[only show unseen messages]' - ) - - args_other=( - '(-U --username)'{-U,--username}'[show updates of different user]:username' - ) - - args_update=( - '(-i --inreplyto)'{-i,--inreplyto}'[update in reply to a message]:message id' - '(-i --inreplyto 1)-r[read RFC2822 Mail]' - ':status' - ) - - case ${words[1]} in - lsarchive) - _arguments $args_common $args_more $args_other - ;; - ls(dm(|archive)|recent|replies|rt(|archive|replies))) - _arguments $args_common $args_more - ;; - lsfollow(ers|ing)) - _arguments $args_common :username - ;; - dmsend) - _arguments :recipient :status - ;; - (un|)follow) - _message username - ;; - update) - _arguments $args_update - ;; - esac -} - -function _twidge { - _arguments \ - '(-c --config)'{-c,--config}'[config file]:file:_files' \ - '(-d --debug)'{-d,--debug}'[enable debugging output]' \ - '(-): :_twidge_command' \ - '(-)*:: :_twidge_args' -} - -_twidge "$@" diff --git a/Completion/Unix/Command/_w b/Completion/Unix/Command/_w index 2da57a8f6..b63018024 100644 --- a/Completion/Unix/Command/_w +++ b/Completion/Unix/Command/_w @@ -9,6 +9,7 @@ case $OSTYPE in '(-c --container)'{-c,--container}'[show container uptime]' '(H -h)--no-header[suppress the heading]' '(H -i --ip-addr)'{-i,--ip-addr}'[display IP address instead of hostname]' + '(H -t --terminal)'{-t,--terminal}'[scan terminal devices to locate user sessions]' '(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]' @@ -41,12 +42,18 @@ case $OSTYPE in '-A[sort tty names alphabetically instead of utmp or utmpx order]' ) ;| - solaris*) + aix*|solaris*) args+=( '!(-s -w -l)'{-l,-w} '-s[short output form]' '(-)-u[produce only the heading line]' ) ;| + aix*) + args+=( + "-X[don't truncate user names]" + '-@[tag system activity with workload partition name]:wpar' + ) + ;; esac _arguments -S -s \ diff --git a/Completion/Unix/Command/_w3m b/Completion/Unix/Command/_w3m index de425cfb1..65c150590 100644 --- a/Completion/Unix/Command/_w3m +++ b/Completion/Unix/Command/_w3m @@ -14,6 +14,8 @@ _arguments -C \ '(-e -s )-j[JIS]' \ '(-v *)-B[load bookmark]' \ '-bookmark[specify bookmark file]:bookmark file:_files' \ + '-R[restore from session file]' \ + '-session[specify session file]:session file:_files' \ '-T[specify content-type]:content type:_mime_types' \ '-m[internet message mode]' \ '(-B *)-v[visual startup mode]' \ @@ -36,9 +38,11 @@ _arguments -C \ "-no-proxy[don't use proxy]" \ '(-6)-4[IPv4 only (-o dns_order=4)]' \ '(-4)-6[IPv6 only (-o dns_order=6)]' \ + '-insecure[use insecure SSL config options]' \ "-no-mouse[don't use mouse]" \ '(-no-cookie)-cookie[use cookie]' \ "(-cookie)-no-cookie[don't use cookie]" \ + '-cookie-jar[use specified cookie file]:file:_files' \ '(-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]' \ @@ -86,13 +90,13 @@ case "$state" in 'history:history:compadd -a w3mhistory' && ret=0 ;; option) - local -a options - options=( ${${(M)${(f)"$(_call_program options $words[1] -show-option 2>/dev/null)"}:# -o *}/(#b) -o (*)=[^ ]#[[:blank:]]##(*)/$match[1]:${match[2]:l}} ) + local -a wopts + wopts=( ${${(M)${(f)"$(_call_program options $words[1] -show-option)"}:# -o *}/(#b) -o (*)=[^ ]#[[:blank:]]##(*)/$match[1]:${match[2]:l}} ) if compset -P 1 '*='; then _message -e values 'value' else compset -S '=*' || suf=( -S '=' ) - _describe -t options 'option' options "$suf[@]" && ret=0 + _describe -t config-options 'option' wopts "$suf[@]" && ret=0 fi ;; esac diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget index acc8d5c6e..4e49193c8 100644 --- a/Completion/Unix/Command/_wget +++ b/Completion/Unix/Command/_wget @@ -55,7 +55,7 @@ _arguments -C -s \ '--prefer-family=[connect first to addresses of specified family]:address family:(IPv6 IPv4 none)' \ '(--http-user --ftp-user)--user[set both ftp and http user]:user' \ '(--http-password --ftp-password)--password[set both ftp and http password]:password' \ - '(--password --http-password --ftp-password)--ask-password:[prompt for passwords]' \ + '(--password --http-password --ftp-password)--ask-password[prompt for passwords]' \ '--use-askpass=:command:_command_names -e' \ '--no-iri[turn off IRI support]' \ '--local-encoding=[specify local encoding for IRIs]:encoding' \ @@ -105,7 +105,7 @@ _arguments -C -s \ '--certificate=[specify client certificate]:client certificate file:_files' \ '--certificate-type=[specify client certificate type]:certificate type:(PEM DER)' \ '--private-key=[specify private key file]:key file:_files' \ - '--private-key-type=[specify private key type]:key type:key type:(PEM DER)' \ + '--private-key-type=[specify private key type]:key type:(PEM DER)' \ "--ca-certificate=[specify file with bundle of CA's]:file:_files" \ "--ca-directory=[specify dir where hash list of CA's are stored]:directory:_directories" \ '--crl-file=[specify file with bundle of CRLs]:file:_files' \ diff --git a/Completion/Unix/Command/_xmlsoft b/Completion/Unix/Command/_xmlsoft index b8cf92700..aefb0e978 100644 --- a/Completion/Unix/Command/_xmlsoft +++ b/Completion/Unix/Command/_xmlsoft @@ -37,9 +37,8 @@ case $service in '--novalid[skip the DTD loading phase]' \ '--nodtdattr[do not default attributes from the DTD]' \ '--noout[do not dump the result]' \ - '--maxdepth[increase the maximum depth]:depth' \ - '--maxvars[increase the maximum variables]:variables' \ - '--maxparserdepth[increase the maximum parser depth]:depth' \ + '--maxdepth[increase the maximum depth]:depth [3000]' \ + '--maxvars[increase the maximum variables]:variables [15000]' \ '--huge[relax hardcoded limits of the parser]' \ '--seed-rand[initialise random number generator]:seed' \ '--html[input document is an HTML file]' \ @@ -64,7 +63,6 @@ case $service in '--version[display the version of the XML library used]' \ '--debug[dump a debug tree of the in-memory document]' \ '--shell[run a navigating shell]' \ - '--debugent[debug the entities defined in the document]' \ '--copy[used to test the internal copy implementation]' \ '--recover[output what was parsable on broken XML documents]' \ '--huge[remove any internal arbitrary parser limits]' \ @@ -75,8 +73,6 @@ case $service in '--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]' \ - '--htmlout[output results as HTML]' \ - '--nowrap[do not put HTML doc wrapper]' \ '--valid[validate the document in addition to std well-formed check]' \ '(--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' \ @@ -86,17 +82,19 @@ case $service in '(--noout --output -o)'{--output,-o}'[save to a given file]:output file:_files' \ '--repeat[repeat 100 times, for timing or profiling]' \ '--insert[ad-hoc test for valid insertions]' \ + '--strict-namespace[return failure if document has namespace errors]' \ '--compress[turn on gzip compression of output]' \ '--html[use the HTML parser]' \ '--xmlout[use the XML serializer when using --html]' \ '--nodefdtd[do not default HTML doctype]' \ '--push[use the push mode of the parser]' \ - '--pushsmall[use the push mode of the parser using tiny increments]' \ '--memory[parse from memory]' \ - '--maxmem[limit memory allocation]:bytes' \ + '--maxmem[limit memory allocation]:maximum (bytes)' \ '--nowarning[do not emit warnings from parser/validator]' \ '--noblanks[drop (ignorable?) blanks spaces]' \ '--nocdata[replace cdata section with text nodes]' \ + '--nodict[create document without dictionary]' \ + '--pedantic[enable additional warnings]' \ '--format[reformat/reindent the input]' \ '--encode[output in the given encoding]:encoding:(${encoding[@]})' \ '--dropdtd[remove the DOCTYPE of the input docs]' \ @@ -124,6 +122,8 @@ case $service in '--sax[do not build a tree but work just at the SAX level]' \ '--oldxml10[use XML-1.0 parsing rules before the 5th edition]' \ '(--noout)--xpath[evaluate the XPath expression, implies --noout]:XPath expression' \ + '(--noout)--xpath0[evaluate the XPath expression separating results by NUL, implies --noout]:XPath expression' \ + '--max-ampl[set maximum amplification factor]:factor [5]' \ '*:XML file:_webbrowser' && return ;; *XML_CATALOG_FILES*) diff --git a/Completion/Unix/Command/_xxd b/Completion/Unix/Command/_xxd index e9015a081..f56590915 100644 --- a/Completion/Unix/Command/_xxd +++ b/Completion/Unix/Command/_xxd @@ -22,13 +22,14 @@ local arguments arguments=( # output options - '(-b -bits -i -include -p -postscript -plain -ps -r -revert -u -uppercase)'{-b,-bits}'[output in binary digits, rather than hex]' - '( -E -EBCDIC -i -include -p -postscript -plain -ps -r -revert )'{-E,-EBCDIC}'[print human-readable part in EBCDIC rather than ASCII]' - '(-i -include -p -postscript -plain -ps -r -revert)-e[little-endian dump]' - '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps -r -revert )'{-i,-include}'[output in C include file style]' - '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps -C -capitalize )'{-p,-postscript,-plain,-ps}'[read or write a plain hexdump (no line numbers or ASCII rendering)]' + '(-b -bits -i -include -t -p -postscript -plain -ps -r -revert -u -uppercase)'{-b,-bits}'[output in binary digits, rather than hex]' + '(-E -EBCDIC -i -include -t -p -postscript -plain -ps -r -revert)'{-E,-EBCDIC}'[print human-readable part in EBCDIC rather than ASCII]' + '(-i -include -t -p -postscript -plain -ps -r -revert)-e[little-endian dump]' + '(-E -EBCDIC -i -include -p -postscript -plain -ps -r -revert)'{-i,-include}'[output in C include file style]' + '(-E -EBCDIC -p -postscript -plain -ps -r -revert)-t[append terminating zero to C include output]' + '(-b -bits -E -EBCDIC -i -include -t -p -postscript -plain -ps -C -capitalize)'{-p,-postscript,-plain,-ps}'[read or write a plain hexdump (no line numbers or ASCII rendering)]' - '(-b -bits -E -EBCDIC -i -include -r -revert -u -uppercase)'{-r,-revert}'[reverse mode\: read a hex dump and output binary data]' + '(-b -bits -E -EBCDIC -i -include -t -r -revert -u -uppercase)'{-r,-revert}'[reverse mode\: read a hex dump and output binary data]' '(-b -bits -r -revert -u -uppercase)'{-u,-uppercase}'[output upper-case hex digits]' '(- :)'{-h,-help}'[display usage message]' @@ -42,7 +43,7 @@ arguments=( '(-o -offset)'{-o+,-offset}'[add specified offset to displayed file position]:offset' '-d[show offset in decimal instead of hex]' '-R+[colorize the output]:when:(always auto never)' - '(-s -skip -seek)'{-s+,-skip,-seek}'[specify file offset to dump from]: :_guard "(0x|)[0-9a-fA-F]#" "file offset to dump from (absolute or relative)"' + '(-s -skip -seek)'{-s+,-skip,-seek}'[specify file offset to dump from]: :_guard "([+-]|)(0x|)[0-9a-fA-F]#" "file offset to dump from (bytes, absolute or +/- relative)"' ': :_files' ) diff --git a/Completion/Unix/Command/_xz b/Completion/Unix/Command/_xz index 6e68e0f69..d441a6545 100644 --- a/Completion/Unix/Command/_xz +++ b/Completion/Unix/Command/_xz @@ -18,12 +18,13 @@ case "$service" in '(I -k --keep)'{-k,--keep}"[keep (don't delete) input files]" \ '(I -f --force)'{-f,--force}'[force overwrite]' \ '(I -c --stdout)'{-c,--stdout}'[write on standard output]' \ + "(I)--no-sync[don't flush writes before removing input file]" \ '(I)*'{-q,--quiet}'[suppress all warnings]' \ '(I)*'{-v,--verbose}'[verbose mode]' \ '(I * --files --files0)--files=-[read list of files to process from file]::file:_files' \ '(I * --files --files0)--files0=-[read null terminated list of files to process from file]::file:_files' \ '(I -F --format)'{-F+,--format=}'[specify file format]:format:(auto xz lzma lzip raw)' \ - '(I -T --threads)'{-T+,--threads=}'[use specified number of threads]:threads [1]' \ + '(I -T --threads)'{-T+,--threads=}'[use specified number of threads]:threads [0]' \ '(I -M --memlimit --memory)'{-M+,--memlimit=,--memory=}'[set memory usage limit]: :_numbers -u bytes "memory limit" KiB MiB GiB %\:percentage\ of\ available\ RAM' \ '(I)--no-adjust[give error if settings exceed memory limit]' \ '(I -Q --no-warn)'{-Q,--no-warn}'[make warnings not affect exit status]' \ @@ -49,11 +50,14 @@ case "$service" in '(* comp decomp level filters common)--info-memory[display amount of RAM and memory usage limits]' \ '(- *)'{-h,--help}'[display help message]' \ '(- *)'{-H,--long-help}'[display the long help (lists also the advanced options)]' \ + '(- *)--filters-help[display liblzma filter string syntax information]' \ '(* comp decomp level filters common)'{-V,--version}'[display version number]' \ + '(level)' \ '(I filters decomp)-'{-best,-fast,1,2,3,4,5,6,7,8,9} \ + filters \ - '(I level decomp --extreme)'--{x86,powerpc,ia64,arm,armthumb,arm64,sparc}=-'[add a branch/call/jump filter]::option:->bcj-options' \ + '(I level decomp --extreme)'--{x86,powerpc,ia64,arm,armthumb,arm64,sparc,riscv}=-'[add a branch/call/jump filter]::option:->bcj-options' \ + '(I level decomp --extreme)--filters=[set filter chain using liblzma filter string]:filter string' \ + '!(I level decomp --extreme)--filters'{1..9}'=:filter string' \ '(I level decomp --extreme)'--lzma{1,2}=-'[add lzma filter]::option:->lzma-options' \ '(I level decomp --extreme)--delta=-[add delta filter]::option:->delta-options' && ret=0 ;; diff --git a/Completion/Unix/Command/_zdump b/Completion/Unix/Command/_zdump index f96bdd764..9e71a5f53 100644 --- a/Completion/Unix/Command/_zdump +++ b/Completion/Unix/Command/_zdump @@ -1,6 +1,26 @@ #compdef zdump -_arguments \ - '-v[lowest possible]' \ - '-c[cutoff]:cutoff year:' \ +local -a args + +case $OSTYPE in + aix*|(net|free)bsd*|linux*|solaris*) + args+=( '(-)--version[display version information]' ) + ;| + aix*|(net|free)bsd*|linux*) + args+=( '(-)--help[display usage information]' ) + ;| + (net|free)bsd*|linux*) + args+=( '-i[output a description of time intervals]' ) + ;| + aix*|(free|net|open)bsd*|linux*) + args+=( + '(-c)-t[cut off interval output at the given times]:cut off (seconds since epoch)' + '(-v)-V[like -v, but omit times relative to the extreme time values]' + ) + ;| +esac + +_arguments -S $args \ + '(-V)-v[print time at lowest possible time value]' \ + '(-t)-c[cut off interval output at the given years]:cutoff years [-500,2500]' \ '*:time zone:_time_zone' diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs index dd67ea767..412469521 100644 --- a/Completion/Unix/Command/_zfs +++ b/Completion/Unix/Command/_zfs @@ -69,6 +69,8 @@ rw_ds_props=( 'compression:value:($comp_algorithms)' 'copies:value:(1 2 3)' 'dedup:value:($dedup_algorithms)' + 'defaultuserquota:->quotas' + 'defaultgroupquota: :->quotas' '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)' @@ -79,7 +81,7 @@ rw_ds_props=( 'paths:mountpoint:_directories -W / -P /'" 'multilevel:value:(on off)' 'nbmand:value:(on off)' - {prefetch,primarycache}':value:(all none metadata)' + {prefetch,primarycache,secondarycache}':value:(all none metadata)' 'quota: :->quotas' 'readonly:value:(on off)' 'recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)' @@ -89,7 +91,6 @@ rw_ds_props=( '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' @@ -128,9 +129,11 @@ case $service:$implementation in 'bcloneused[amount of storage used by cloned blocks]' 'dedup_table_size[size of dedup table on-disk]' 'dedupcached[size of dedup table in arc]' + 'encryptionroot' 'expandsize[uninitialized space within the pool]' 'fragmentation[amount of fragmentation in the pool]' 'freeing[amount of space remaining to be reclaimed]' + 'last_scrubbed_txg[transaction group (TXG) up to which the most recent scrub operated]' 'load_guid[unique identifier generated when pool is loaded]' 'used[amount of storage space used within the pool]' ) @@ -150,12 +153,24 @@ case $service:$implementation in rw_ds_props+=( 'aclmode:value:(discard groupmask passthrough restricted)' 'acltype:value:(off noacl nfsv4 posix posixacl)' + 'defaultprojectquota:->quotas' + 'defaultprojectobjquota:->quotas' + 'defaultgroupobjquota:->quotas' + 'defaultuserobjquota:->quotas' + 'dnodesize:value:(legacy auto 1k 2k 4k 8k 16k)' + 'direct:value:(disabled standard always)' + 'groupobjquota@' 'mlslabel:value:(none)' # TODO: list sensitivity labels - 'redundant_metadata:value:(all most)' + 'overlay:value:(on off)' + 'projectquota@' 'projectobjquota@' + 'redundant_metadata:value:(all most some none)' + 'snapdev:value:(hidden visible)' + 'special_small_blocks:size [0]' + 'userobjquota@' '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}" + "filesystem_limit:unlimited:_phony none _numbers limit" + "snapshot_limit:unlimited:_phony none _numbers limit" 'volmode:mode:(( default\:use\ system-wide\ tunable full\:expose\ as\ block\ devices @@ -166,8 +181,8 @@ case $service:$implementation in ) ro_ds_props+=( createtxg clones filesystem_count guid logicalreferenced logicalused - receive_resume_token refcompressratio snapshot_count snapshots_changed - volblocksize written + objsetid receive_resume_token redact_snaps refcompressratio + snapshot_count snapshots_changed volblocksize written ) delegatable_perms=( bookmark load-key change-key userobjquota userobjused groupobjquota @@ -240,8 +255,6 @@ case $service:$implementation in "defaultwritelimit: : _alternative \ 'sizes: :_guard \[0-9\]\#\(\|\[BKMGTPEZ\]\) size\ \(bytes\ per\ second\)' \ 'properties:property:(none)'" - 'defaultuserquota:->quotas' - 'defaultgroupquota: :->quotas' 'keysource:value:->keysources' ) ci_ds_props+=( @@ -256,13 +269,13 @@ case $service:$implementation in zfs:openzfs) subcmds+=( bookmark change-key load-key program project projectspace redact - unload-key wait + rewrite unload-key wait version ) ;| zpool:openzfs) subcmds+=( - checkpoint events labelclear initialize reopen resilver sync trim wait - version + checkpoint events labelclear initialize reopen resilver sync prefetch + trim wait version ) ;| zfs:solaris) @@ -282,8 +295,9 @@ case $service:$implementation in ;; zpool:*) subcmds+=( - add attach clear create destroy detach export get history import iostat - list offline online reguid remove replace scrub set split status upgrade + add attach clear create destroy ddtprune detach export get history + import iostat list offline online reguid remove replace scrub set + split status upgrade ) ;; zstream:*) @@ -292,15 +306,18 @@ case $service:$implementation in esac case $OSTYPE in - solaris*) + solaris*|linux-gnu) 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)' ) + rw_ds_props+=( + 'relatime:value:(on off)' + 'volthreading:value:(on off)' + ) ci_ds_props+=( {,fs,def,root}'context:SELinux context:_selinux_contexts -a file_type' ) @@ -460,9 +477,11 @@ case $service:$words[1] in ;; zfs:clone) - [[ $implementation = solaris ]] && args+=( - '-K[create encryption key]' - ) + if [[ $implementation = solaris ]]; then + args+=( '-K[create encryption key]' ) + else + args+=( "-u[don't mount newly created dataset]" ) + fi _arguments -C -A "-*" -S $args \ '-p[create parent datasets]' \ '*-o+[set property]:property:->create-properties' \ @@ -508,7 +527,11 @@ case $service:$words[1] in 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]' ) + args=( + '(-j --json)'{-j,--json}'[output in JSON format]' + '--json-int[output numbers in integer format instead of strings]' + '-p[use exact (parsable) numeric output]' + ) fi _arguments -A "-*" -S $args \ '(-d)-r[recursively display children]' \ @@ -604,13 +627,25 @@ case $service:$words[1] in '*:file:_files' ;; + zfs:rewrite) + _arguments -A "-*" -S -s \ + '-P[rewrite physical blocks only so snapshots and incremental streams are unaffected]' \ + '-l+[specify maximum number of bytes to write]:maximum (bytes)' \ + '-o+[specify starting offset]:offset (bytes)' \ + '-r[recurse into directories]' \ + '-v[print names of all successfully rewritten files]' \ + "-x[don't cross file system boundaries]" \ + '*:file or directory:_files' + ;; + zfs:mount) [[ $OSTYPE != freebsd* ]] && args=( '-O[overlay mount]' ) [[ $implementation = openzfs ]] && args+=( '-l[load keys for encrypted filesystems as they are being mounted]' '(-a)-R[mount filesystems along with all their children]' ) - _arguments -A "-*" -S $args \ + _arguments -A "-*" -S : $args \ + '(- :)'{-j,--json}'[show all mounted file systems in JSON format]' \ '-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]' \ @@ -898,6 +933,11 @@ case $service:$words[1] in ':property:($delegatable_perms $ro_ds_props ${rw_ds_props%%:*})' ;; + (zfs|zpool):version) + _arguments -A "-*" -S \ + '-j[output in JSON format]' + ;; + zpool:(clear|online)) [[ $OSTYPE = linux* ]] && args=( "--power[power on the device's slot in the storage enclosure]" @@ -985,12 +1025,19 @@ case $service:$words[1] in '-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' \ + '-m+[set mountpoint for root dataset]:mountpoint:_phony none _path_files -/ -P / -W /' \ '-t+[use a temporary pool name]:pool name' \ ':pool :_guard "^-*" "pool name"' \ '*: :->virtual-devices' ;; + zpool:ddtprune) + _arguments -A "-*" -S \ + '(-p)-d[prune entries based on age]:age (days)' \ + '(-d)-p[prune to target percentage of unique entries]:target (percentage)' \ + ':pool:_zfs_pool' + ;; + zpool:destroy) _arguments -A "-*" -S \ '-f[force active datasets to be unmounted]' \ @@ -1020,9 +1067,17 @@ case $service:$words[1] in ;; zpool:get) - [[ $implementation = solaris ]] && args=( - '-s+[specify sources to display]: :_values -s , "source" local default none' - ) + if [[ $implementation = openzfs ]]; then + args=( + '(-j --json)'{-j,--json}'[output in JSON format]' + '--json-int[output numbers in integer format instead of strings]' + --json-pool-key-guid + ) + else + args=( + '-s+[specify sources to display]: :_values -s , "source" local default none' + ) + fi _arguments -A "-*" -S $args \ '-H[suppress headers and tab-delimit fields]' \ '-p[display numbers in parseable (exact) values]' \ @@ -1076,6 +1131,7 @@ case $service:$words[1] in zpool:initialize) _arguments -A "-*" -S \ + '(-a --all : *)'{-a,--all}'[begin, cancel, suspend initializing on all pools]' \ '(-s --suspend -c --cancel)'{-c,--cancel}'[cancel initializing on specified devices]' \ '(-s --suspend -c --cancel)'{-s,--suspend}'[suspend initializing on specified devices]' \ '(-u --uninit)'{-u,--uninit}'[clear initialization state on specified devices]' \ @@ -1130,6 +1186,9 @@ case $service:$words[1] in zpool:list) [[ $implementation = openzfs ]] && args=( '-g[display vdev GUIDs instead of normal device names]' + '(-j --json)'{-j,--json}'[output in JSON format]' + '--json-int[output numbers in integer format instead of strings]' + --json-pool-key-guid '-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]' @@ -1167,12 +1226,21 @@ case $service:$words[1] in ;; zpool:online) - _arguments -C -A "-*" -S $args \ + _arguments -C -A "-*" -S \ '-e[expand device to use all available space]' \ ':pool:_zfs_pool' \ '*:virtual device:->pool-devices' ;; + zpool:prefetch) + _arguments -A "-*" -S \ + '-t+[metadata type]:metadata type:(( + brt\:block\ reference\ table + ddt\:deduplication\ table + ))' \ + ':pool:_zfs_pool' + ;; + zpool:reopen) _arguments -A "-*" -S \ "-n[don't restart an in-progress scrub operation]" \ @@ -1180,7 +1248,9 @@ case $service:$words[1] in ;; zpool:reguid) - _zfs_pool + _arguments -A "-*" -S \ + '-g+[set pool guid]:guid (64-bit decimal)' \ + ':pool:_zfs_pool' ;; zpool:remove) @@ -1215,6 +1285,10 @@ case $service:$words[1] in zpool:scrub) [[ $implementation = openzfs ]] && args=( + '(-a --all *)'{-a,--all}'[begin, pause, stop scrub on all pools]' + '-C[continue scrub from last saved txg]' + '-S+[specify start date for transactions]:date (YYYY-MM-DD HH\:MM):_dates' + '-E+[specify end date for transactions]:date (YYYY-MM-DD HH\:MM):_dates' '(-s)-p[pause scrubbing]' '-w[wait until scrub has completed before returning]' '-e[only scrub files with known data errors]' @@ -1259,6 +1333,9 @@ case $service:$words[1] in '-c+[run scripts on each vdev]:script:_sequence _files -W "($ZPOOL_SCRIPTS_PATH /etc/zfs/zpool.d ~/.zpool.d)"' '-e[only show unhealthy vdevs]' '-i[display vdev initialization status]' + '(-j --json)'{-j,--json}'[output in JSON format]' + '--json-int[output numbers in integer format instead of strings]' + --json-flat-vdevs --json-pool-key-guid '-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]' @@ -1280,6 +1357,7 @@ case $service:$words[1] in zpool:trim) _arguments -C -A "-*" -S \ + '(-a --all 1 *)'{-a,--all}'[perform TRIM on all pools]' \ '(-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]' \ diff --git a/Completion/Unix/Command/_zip b/Completion/Unix/Command/_zip index cfa51be36..29c242caa 100644 --- a/Completion/Unix/Command/_zip +++ b/Completion/Unix/Command/_zip @@ -166,7 +166,7 @@ case $state in elif [[ -f $testfile.ZIP ]]; then zipfile=$testfile.ZIP else - return 1 + return ret fi 2>/dev/null if [[ $zipfile != $_zip_cache_name ]]; then _zip_cache_name="$zipfile" diff --git a/Completion/Unix/Command/_zstd b/Completion/Unix/Command/_zstd index 92c4a8e41..db23e541b 100644 --- a/Completion/Unix/Command/_zstd +++ b/Completion/Unix/Command/_zstd @@ -52,6 +52,7 @@ elif (( $words[(I)(-d|--decompress|--uncompress|-l|--list|-t|--test)] )); then '(--sparse)-o[specify output file]:file:_files -g "^*.(|t)zst(-.)"' "(M)--no-check[ignore checksums in compressed frame]" '!(M --no-check)'{-C,--check} + '--pass-through[pass through uncompressed files as-is]' '*:files:_files -g "*.(|t)zst(-.)"' ) else @@ -108,6 +109,7 @@ _arguments -s -S : $args \ '--filelist=[read list of files to operate upon from file]: :_files' \ '--output-dir-flat=[store processed files in directory]: :_directories' \ '--output-dir-mirror=[store processed files in directory respecting original structure]: :_directories' \ + '--no-asyncio[disable asynchronous IO]' \ '--trace=[log tracing information to file]: :_files' \ + '(M)' \ \!{-z,--compress,--uncompress} \ |
