diff options
Diffstat (limited to 'Completion/Unix/Command')
125 files changed, 4874 insertions, 2585 deletions
diff --git a/Completion/Unix/Command/_abcde b/Completion/Unix/Command/_abcde new file mode 100644 index 000000000..361b43091 --- /dev/null +++ b/Completion/Unix/Command/_abcde @@ -0,0 +1,50 @@ +#compdef abcde + +(( $+functions[_abcde_fields] )) || +_abcde_fields(){ + _values -s , field year genre +} + +(( $+functions[_abcde_actions] )) || +_abcde_actions(){ + _values -s , action cddb cue read getalbumart embedalbumart normalize encode tag move replaygain playlist clean +} + +_arguments -s \ + '(-t -T -p)-1[encode the whole CD in a single file]' \ + '-a[comma-delimited list of actions to perform]:action:_abcde_actions' \ + '-b[enable batch mode normalization]' \ + '-B[enable automatic embedding of album art with certain containers]' \ + '-c[specify an additional configuration file to parse]:config:_files' \ + '-C[resume a session for discid when you no longer have the CD available]:discid' \ + '-d[CD-ROM block device that contains audio tracks to be read]:cd-rom-file:_files' \ + '-D[capture debugging information]' \ + '-e[erase information about encoded tracks from the internal status file]' \ + '-f[force the removal of the temporary ABCDETEMPDIR directory]' \ + "-g[enable lame's --nogap option]" \ + '-G[download album art using the getalbumart function]' \ + '(- :)-h[get help information]' \ + '-j[start a specified number of encoder processes at once]:number' \ + '-k[keep the wav files after encoding]' \ + '-l[use the low-diskspace algorithm]' \ + '-L[use a local CDDB repository]' \ + '-m[create DOS-style playlists, modifying the resulting one by adding CRLF line endings those to work]' \ + "-n[don't query CDDB database]" \ + '-N[non interactive mode]' \ + '-o[select output type]:outputtype:(vorbis ogg mp3 flac spx mpc m4a wav wv ape opus mka aiff)' \ + "-p[pads track numbers with 0's]" \ + '-P[use Unix PIPES to read and encode in one step]' \ + '-r[remote encode on this comma-delimited list of machines using distmp3]:hosts:_sequence _hosts' \ + '-s[fields to be shown in the CDDB parsed entries]:field:_abcde_fields' \ + '-S[set the speed of the CD drive]:speed' \ + '-t[start the numbering of the tracks at a given number]:track-number' \ + '-T[start the numbering of the tracks at a given number and change internal tag numbering]:track-number' \ + '-U[set CDDBPROTO to version 5]' \ + '(- :)-v[show the version and exit]' \ + '-V[be more verbose]' \ + '-x[eject the CD when all tracks have been read]' \ + '-X[use an alternative "cue2discid" implementation]:cue2discid' \ + '-w[add a comment to the tracks ripped from the CD]:comment' \ + "-W[concatenate CD's]:cd-number" \ + '-z[debug mode]' \ + '*:tracks:' diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible index 89a4998b7..f1e13a813 100644 --- a/Completion/Unix/Command/_ansible +++ b/Completion/Unix/Command/_ansible @@ -1,10 +1,14 @@ -#compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault +#compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault -value-,ANSIBLE_STDOUT_CALLBACK,-default- local curcontext="$curcontext" plug plugvar ign ret=1 local -a args state line local -A opt_args case $service in + *,ANSIBLE_STDOUT_CALLBACK,*) + plug=callback + state=plugins + ;; ansible|ansible-console|ansible-doc|ansible-playbook) args=( \*{-M+,--module-path=}'[specify path to modules]:module path:_dir_list' @@ -30,7 +34,7 @@ case $service in '(-D --diff)'{-D,--diff}'[show differences when changing small files and templates]' '(-b --become)'{-b,--become}'[escalate privileges on remote system]' '(-f --forks)'{-f+,--forks=}'[specify number of parallel processes to use]:processes [5]' - '--become-method=[specify privilege escalation method to use]:method [sudo]:(sudo su pbrun pfexec doas dzdo ksu runas pmrun enable machinectl)' + '--become-method=[specify privilege escalation method to use]:method [sudo]:(sesu sudo su pbrun pfexec doas dzdo ksu runas pmrun enable machinectl)' '--become-user=[specify remote user for running operations]:user:_users' "--syntax-check[perform a syntax check on the playbook, but don't execute it]" '!(-R --su-user -U --sudo-user)'{-R,-U,--su-user,--sudo-user}':user [root]:_users' @@ -45,7 +49,7 @@ case $service in ;| ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull) args+=( - '(-i --inventory)'{-i+,--inventory=}'[specify inventory host file or host list]: : _alternative "files\:inventory 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' ) @@ -106,7 +110,7 @@ case $service in '(-l --list -F --list_files -s --snippet)'{-l,--list}'[list available plugins]' '(-l --list -F --list_files -s --snippet)'{-F,--list_files}'[show plugin names and their source files without summaries]' '(-l --list -F --list_files -s --snippet)'{-s,--snippet}'[show playbook snippet for specified plugins]' - '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(cache callback connection inventory lookup module strategy vars)' + '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(become cache callback cliconf connection httpapi inventory lookup shell module strategy vars)' '*:plugin:->plugins' ) ;; @@ -115,9 +119,11 @@ case $service in '--export[when doing an --list, represent in a way that is optimized for export]' '(-y --yaml)--graph[output inventory graph]' '--host[output specific host information]' + '--output=[with --list, specify output file]:file:_files' '--list[output all hosts information]' + '(-y --yaml --vars --graph)--toml[use TOML format instead of JSON]' '(-y --yaml)--vars[add variables to the graph display]' - '(-y --yaml --vars --graph)'{-y,--yaml}'[use YAML format instead of JSON]' + '(-y --yaml --toml --vars --graph)'{-y,--yaml}'[use YAML format instead of JSON]' ) ;; ansible-galaxy) @@ -162,6 +168,7 @@ case $service in ;; ansible-vault) args=( -A "-*" $args + '::action:(create decrypt edit encrypt encrypt_string rekey view)' '--new-vault-id=[specify new vault identity to use for rekey]:vault id' '--new-vault-password-file=[specify new vault password file to use for rekey]:file:_files' '*::args:->vault' @@ -170,12 +177,15 @@ case $service in esac (( $#words > 2 )) && ign='!' -_arguments -s -S -C $args \ - "${ign}(- :)--version[display version information]" \ - "${ign}(- :)"{-h,--help}'[display usage information]' \ - \*{-v,--verbose}"[verbose mode (repeat to increase)]" && ret=0 +if (( $#args )); then + _arguments -s -S -C $args \ + "${ign}(- :)--version[display version information, config and module locations]" \ + "${ign}(- :)"{-h,--help}'[display usage information]' \ + \*{-v,--verbose}"[verbose mode (repeat to increase)]" && ret=0 + + plug=${(v)opt_args[(i)-(t|-type)]:-module} +fi -plug=${(v)opt_args[(i)-(t|-type)]:-module} case $state in args) case ${(v)opt_args[(I)-(m|module)]} in @@ -265,6 +275,7 @@ case $state in ;; install) args+=( + "--force-with-deps[force overwriting an existing role and it's dependencies]" '(-n --no-deps)'{-n,--no-deps}"[don’t download roles listed as dependencies]" '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors and continue with the next specified role]' '(-g --keep-scm-meta)'{-g,--keep-scm-meta}'[use tar instead of the scm archive option when packaging the role]' @@ -303,6 +314,9 @@ case $state in '(-n --name)'{-n+,--name=}'[specify the variable name]:variable' '--stdin-name=[specify the variable name for stdin]:variable' ) + ;| + create|edit|rekey|view) args+=( ':file:_files' ) ;| + (en|de)crypt) args+=( '::file:_files' ) ;; esac _arguments -s -S $args && ret=0 diff --git a/Completion/Unix/Command/_arp b/Completion/Unix/Command/_arp index 90e30d6c2..389f1099b 100644 --- a/Completion/Unix/Command/_arp +++ b/Completion/Unix/Command/_arp @@ -38,8 +38,6 @@ case $OSTYPE in ;; darwin*|freebsd*|dragonfly*) cmds+=( '(-n -i)-S[create an arp entry, replacing any existing entry]' ) - ;| - darwin*|freebsd*) args+=( '(-s -Q -f)-i+[select an interface]:interface:_net_interfaces' ) ;| darwin*) diff --git a/Completion/Unix/Command/_arping b/Completion/Unix/Command/_arping index 66ce7bc18..4974a408a 100644 --- a/Completion/Unix/Command/_arping +++ b/Completion/Unix/Command/_arping @@ -12,6 +12,7 @@ _arguments -s \ '-V[print version and exit]' \ '-c[how many packets to send]:count' \ '-w[how long to wait for a reply]:timeout' \ + '-i[specify interval between packets]:interval (seconds)' \ '-I[interface]:ethernet interface:_net_interfaces' \ '-s[source ip address]:source IP address:_hosts' \ ':destination:_hosts' diff --git a/Completion/Unix/Command/_attr b/Completion/Unix/Command/_attr index d8d4ed260..121c0c539 100644 --- a/Completion/Unix/Command/_attr +++ b/Completion/Unix/Command/_attr @@ -56,7 +56,7 @@ case $service in '-r[act recursively]' \ '-s[act on symbolic links]' \ '(-w)-v[always display file name]' \ - '(-c -d)-x[use hexademical format for value input and output]' \ + '(-c -d)-x[use hexadecimal format for value input and output]' \ '*: :_files' \ + '(op)' \ '(-l -x)-c[remove all attributes]' \ diff --git a/Completion/Unix/Command/_avahi b/Completion/Unix/Command/_avahi new file mode 100644 index 000000000..562ec3647 --- /dev/null +++ b/Completion/Unix/Command/_avahi @@ -0,0 +1,52 @@ +#compdef avahi-browse avahi-browse-domains avahi-resolve avahi-resolve-address avahi-resolve-host-name + +local curcontext="$curcontext" pri ret=1 +local -A opt_args +local -a state line args serv desc disp + +args=( + '(- 1)'{-h,--help}'[display usage information]' + '(- 1)'{-V,--version}'[display version information]' + '(-v --verbose)'{-v,--verbose}'[enable verbose mode]' +) + +case $service in + *-browse*) + serv=( ${(f)"$(_call_program service-types avahi-browse -bk)"} ) + desc=( ${(f)"$(_call_program service-types-description avahi-browse -b)"} ) + (( $#desc )) && print -v disp -f '%s:%s' ${serv:^desc} + + _arguments -s -S -C $args \ + '(-D --browse-domains -a --all -b --dump-db)'{-D,--browse-domains}'[browse for browsing domains instead of services]' \ + '(-D --browse-domains -a --all -b --dump-db)'{-a,--all}'[show all services, regardless of the type]' \ + '(-d --domain)'{-d+,--domain=}'[specify domain to browse in]:domain' \ + '(-t --terminate)'{-t,--terminate}'[terminate after dumping a more or less complete list]' \ + '(-c --cache)'{-c,--cache}'[terminate after dumping all entries from the cache]' \ + '(-l --ignore-local)'{-l,--ignore-local}'[ignore local services]' \ + '(-r --resolve)'{-r,--resolve}'[resolve services found]' \ + '(-f --no-fail)'{-f,--no-fail}"[don't fail if the daemon is not available]" \ + '(-p --parsable)'{-p,--parsable}'[output in parsable format]' \ + '(-k --no-db-lookup)'{-k,--no-db-lookup}"[don't lookup service types]" \ + '(-D --browse-domains -a --all -b --dump-db)'{-b,--dump-db}'[dump service type database]' \ + '1: :->service-types' && ret=0 + + [[ -n $state ]] && _describe -t services "service type" disp && ret=0 + ;; + *-resolve*) + if (( ${words[(I)(-n|--name)]} )) || [[ $service = *-host-name ]]; then + args=( '*:host:_hosts' ) + pri=1 + fi + if (( ${words[(I)(-a|--address)]} )) || [[ $service = *-address && -n $pri ]]; then + args=( '*: :_guard "^-*" address' ) + fi + + _arguments -s -S $args \ + '(-a --address -n --name -h --help -V --version)'{-a,--address}'[resolve address]' \ + '(-a --address -n --name -h --help -V --version)'{-n,--name}'[resolve host name]' \ + '(-4)-6[lookup IPv6 address]' \ + '(-6)-4[lookup IPv4 address]' && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_awk b/Completion/Unix/Command/_awk index b23ecdf9d..dcb2a6c21 100644 --- a/Completion/Unix/Command/_awk +++ b/Completion/Unix/Command/_awk @@ -33,7 +33,7 @@ case $variant in {-e,--source}'[pass program text in arg]:program text:' '(1)'{-E+,--exec}'[like -f, but safer for CGI]:program file:->script' '(- : *)'{-h,--help}'[print usage message and exit]' - {-L-,--lint=-}'[warn about dubious or non-portable constructs]::flag:((fatal\:"treat warnings as fatal error" invalid\:"warn only about things that are actually invalid"))' + {-L-,--lint=-}'[warn about dubious or non-portable constructs]::flag:((fatal\:"treat warnings as fatal error" invalid\:"warn only about things that are actually invalid" no-ext\:"disable warnings about gawk extensions"))' {-n,--non-decimal-data}'[auto-detect octal/hexadecimal values in input]' {-N,--use-lc-numeric}"[force use of locale's decimal point character]" {-O,--optimize}'[enable optimization]' diff --git a/Completion/Unix/Command/_bash b/Completion/Unix/Command/_bash index cc219f788..383b369cb 100644 --- a/Completion/Unix/Command/_bash +++ b/Completion/Unix/Command/_bash @@ -22,6 +22,7 @@ args=( '--noprofile[do not load /etc/profile, ~/.bash_profile, etc.]' '--norc[do not load ~/.bashrc]' '--posix[enable POSIX mode]' + '--pretty-print[format a shell script]' '(-r --restricted)--restricted[act as restricted shell]' '(: -)--version[display version information]' # This is ugly, but this way the + variants have accurate descriptions. Note diff --git a/Completion/Unix/Command/_cat b/Completion/Unix/Command/_cat index c78dc4cd9..74d7278b8 100644 --- a/Completion/Unix/Command/_cat +++ b/Completion/Unix/Command/_cat @@ -51,7 +51,7 @@ elif [[ $OSTYPE = solaris* ]]; then '*: :_files' ) else - # POSIX reqires '-u', and most OSes may support '-n' + # POSIX requires '-u', and most OSes may support '-n' args=( '-n[number all output lines]' '-u[do not buffer output]' diff --git a/Completion/Unix/Command/_chmod b/Completion/Unix/Command/_chmod index af64b9eb9..3f6db7e91 100644 --- a/Completion/Unix/Command/_chmod +++ b/Completion/Unix/Command/_chmod @@ -1,54 +1,70 @@ -#compdef chmod gchmod +#compdef chmod gchmod zf_chmod -local curcontext="$curcontext" state line expl ret=1 -local -a args privs +local curcontext="$curcontext" state line expl ret=1 variant +local -a args privs aopts=( -A '-*' ) args=( '*: :->files' '1: :_file_modes' ) -if _pick_variant gnu=Free\ Soft unix --version; then - args+=( - '(-v --verbose -c --changes)'{-c,--changes}'[report changes made]' - '(-v --verbose -c --changes)'{-v,--verbose}'[output a diagnostic for every file processed]' - '(-f --silent --quiet)'{-f,--silent,--quiet}'[suppress most error messages]' - '(--no-preserve-root)--preserve-root[fail to operate recursively on /]' - "(--preserve-root)--no-preserve-root[don't treat / specially (default)]" - '(1)--reference=[copy permissions of specified file]:file:_files' - '(-R --recursive)'{-R,--recursive}'[change files and directories recursively]' - '(- : *)--help[display help information]' - '(- : *)--version[display version information]' - ) -else - args+=( - '-f[suppress most error messages]' - '-R[change files and directories recursively]' - ) - case $OSTYPE in - freebsd*|dragonfly*|darwin*) - args+=( '-v[output a diagnostic for every file processed]') +_pick_variant -r variant -b zsh gnu=Free\ Soft $OSTYPE --version +case "$variant" in + zsh) + # Assign, not append because zf_chmod only supports octal modes. + args=( + '-R[change files and directories recursively]' + '-s[enable paranoid behavior]' + '1: :_guard "[0-7]#" "octal mode"' + '*: :->files' + ) + ;; + gnu) + aopts=() + args+=( + '(-v --verbose -c --changes)'{-c,--changes}'[report changes made]' + '(-v --verbose -c --changes)'{-v,--verbose}'[output a diagnostic for every file processed]' + '(-f --silent --quiet)'{-f,--silent,--quiet}'[suppress most error messages]' + '(--no-preserve-root)--preserve-root[fail to operate recursively on /]' + "(--preserve-root)--no-preserve-root[don't treat / specially (default)]" + '(1)--reference=[copy permissions of specified file]:file:_files' + '(-R --recursive)'{-R,--recursive}'[change files and directories recursively]' + '(- : *)--help[display help information]' + '(- : *)--version[display version information]' + ) + ;; + *) + args+=( + '-f[suppress most error messages]' + '-R[change files and directories recursively]' + ) ;| - freebsd*|netbsd*|darwin*|dragonfly*) - args+=( "-h[operate on symlinks them self]" ) + freebsd*|dragonfly*|darwin*) + args+=( + '-v[output a diagnostic for every file processed]' + ) ;| - freebsd*|openbsd*|netbsd*|darwin*|dragonfly*) - args+=( - '(-H -L -P)-L[follow all symlinks]' - '(-H -L -P)-H[follow symlinks on the command line]' - '(-H -L -P)-P[do not follow symlinks (default)]' - ) + freebsd*|netbsd*|darwin*|dragonfly*) + args+=( + '-h[operate on symlinks themselves]' + ) ;| - darwin*) - args+=( - '(1)-C[returns false if any of the named files have ACLs]' - '(1)-N[remove ACLs from specified files]' - '(1)-E[read ACL info from stdin as a sequential list of ACEs]' - '(1)-i[removes inherited bit from all entries in named files ACLs]' - '(1)-I[removes all inherited entries from named files ACLs]' - ) + freebsd*|openbsd*|netbsd*|darwin*|dragonfly*) + args+=( + '(-H -L -P)-L[follow all symlinks]' + '(-H -L -P)-H[follow symlinks on the command line]' + '(-H -L -P)-P[do not follow symlinks (default)]' + ) + ;| + darwin*) + args+=( + '(1)-C[return false if any specified files have ACLs]' + '(1)-N[remove ACLs from specified files]' + '(1)-E[read ACL info from stdin as sequential list of ACEs]' + "(1)-i[remove inherited bit from all entries in specified files' ACLs]" + "(1)-I[remove all inherited entries from specified files' ACLs]" + ) ;; - esac -fi +esac -_arguments -C -s "$args[@]" && ret=0 +_arguments -C -s -S $aopts "$args[@]" && ret=0 case "$state" in files) @@ -62,12 +78,12 @@ case "$state" in local spec who op priv local -a specs for spec in ${(s:,:)line[1]}; do - if [[ ${spec#*[+-=]} != [rwxst]## ]]; then - _files && ret=0 - return ret - fi + if [[ ${spec#*[+-=]} != [rwxst]## ]]; then + _files && ret=0 + return ret + fi - specs+=( ${${(M)spec##[+-=]*}:+a}$spec ) + specs+=( ${${(M)spec##[+-=]*}:+a}$spec ) done _wanted files expl file _files -g "*(-.^f:${(j.,.)specs}:)" && ret=0 fi diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown index a97a0e0bf..9ebbf7bab 100644 --- a/Completion/Unix/Command/_chown +++ b/Completion/Unix/Command/_chown @@ -1,46 +1,72 @@ #compdef chown chgrp gchown=chown gchgrp=chgrp zf_chown=chown zf_chgrp=chgrp -local curcontext="$curcontext" state line expl ret=1 -local suf usr grp req deref pattern arg args +local curcontext="$curcontext" state line expl ret=1 variant +local suf usr grp req deref pattern arg args aopts=( -A '-*' ) -if _pick_variant gnu=Free\ Soft unix --version; then - args=( - '(-c --changes -v --verbose)'{-c,--changes}'[report each change made]' - '(-c --changes -v --verbose)'{-v,--verbose}'[output info for every file processed]' - '(-h --no-dereference)--dereference[dereference symlinks]' - '(-h --no-dereference --dereference)'{-h,--no-dereference}'[operate on symlinks themselves]' - '(-f --silent --quiet)'{-f,--silent,--quiet}"[don't report errors]" - '--preserve-root[fail to operate recursively on /]' - '--reference=[copy ownership of specified file]:file:_files' - '(-R --recursive)'{-R,--recursive}'[change files and directories recursively]' - '(-H -L -P)-L[follow all symlinks]' - '(-H -L -P)-H[follow symlinks on the command line]' - '(-H -L -P)-P[do not follow symlinks (default)]' - '(- : *)--help[display help information]' - '(- : *)--version[display version information]' - ) - [[ $service = chown ]] && - args+=( '--from=[restrict changes to files by current ownership]: :->owner' ) -else - args=( - "-h[operate on symlinks them self]" - '-R[change files and directories recursively]' - '(-H -L -P)-L[follow all symlinks]' - '(-H -L -P)-H[follow symlinks on the command line]' - '(-H -L -P)-P[do not follow symlinks (default)]' - ) - for pattern arg in \ - '(dragonfly|freebsd)*' "-x[don't traverse file systems]" \ - '(darwin|dragonfly|(free|net)bsd|solaris)*' "-f[don't report errors]" \ - '(darwin|dragonfly|(free|net)bsd)*' '-v[output info for every file processed]' \ - 'solaris2.<11->' '-s[owner and/or group are Windows SID strings]' - do - [[ $OSTYPE = $~pattern ]] && args+=( $arg ) - done -fi +_pick_variant -r variant -b zsh gnu=Free\ Soft $OSTYPE --version +case "$variant" in + gnu) + aopts=() + args=( + '(-c --changes -v --verbose)'{-c,--changes}'[report each change made]' + '(-c --changes -v --verbose)'{-v,--verbose}'[output info for every file processed]' + '(-h --no-dereference)--dereference[dereference symlinks]' + '(-h --no-dereference --dereference)'{-h,--no-dereference}'[operate on symlinks themselves]' + '(-f --silent --quiet)'{-f,--silent,--quiet}"[don't report errors]" + '--preserve-root[fail to operate recursively on /]' + '--reference=[copy ownership of specified file]:file:_files' + '(-R --recursive)'{-R,--recursive}'[change files and directories recursively]' + '(-H -L -P)-L[follow all symlinks]' + '(-H -L -P)-H[follow symlinks on the command line]' + '(-H -L -P)-P[do not follow symlinks (default)]' + '(- : *)--help[display help information]' + '(- : *)--version[display version information]' + ) + [[ $service = chown ]] && + args+=( '--from=[restrict changes to files by current ownership]: :->owner' ) + ;; + *) + args=( + '-h[operate on symlinks themselves]' + '-R[change files and directories recursively]' + ) + ;| + zsh) + args+=( + '-s[enable paranoid behavior]' + ) + ;; + *) + args+=( + '(-H -L -P)-L[follow all symlinks]' + '(-H -L -P)-H[follow symlinks on the command line]' + '(-H -L -P)-P[do not follow symlinks (default)]' + ) + ;| + dragonfly*|freebsd*) + args+=( + "-x[don't traverse file systems]" + ) + ;| + darwin*|dragonfly*|freebsd*|netbsd*|solaris*) + args+=( + "-f[don't report errors]" + ) + ;| + darwin*|dragonfly*|freebsd*|netbsd*) + args+=( + '-v[output info for every file processed]' + ) + ;| + solaris2.<11->) + args+=( + '-s[owner and/or group are Windows SID strings]' + ) + ;; +esac (( $+words[(r)--reference*] )) || args+=( '(--reference)1: :->owner' ) -_arguments -C -s "$args[@]" '*: :->files' && ret=0 +_arguments -C -s -S $aopts "$args[@]" '*: :->files' && ret=0 case $state in owner) diff --git a/Completion/Unix/Command/_chsh b/Completion/Unix/Command/_chsh index 006aa82a1..802369807 100644 --- a/Completion/Unix/Command/_chsh +++ b/Completion/Unix/Command/_chsh @@ -50,7 +50,7 @@ case $OSTYPE in args+=( '(-)'{-u,--usage}'[display short usage message]' '(-)--help[display help information]' - '(-D --binddn)'{-D+,--binddn=}'[specify LDAP disingushed name to bind]:binddn' + '(-D --binddn)'{-D+,--binddn=}'[specify LDAP distinguished name to bind]:binddn' '(-P --path)'{-P+,--path=}'[specify path to search for passwd and shadow files]:path:_directories' '(-q --quiet)'{-q,--quiet}"[don't be verbose]" '--service=[use specified name service]:service:(files nis nisplus ldap)' diff --git a/Completion/Unix/Command/_cksum b/Completion/Unix/Command/_cksum index bb2f60ac7..67f2a7896 100644 --- a/Completion/Unix/Command/_cksum +++ b/Completion/Unix/Command/_cksum @@ -91,7 +91,7 @@ case $OSTYPE in openbsd*) args+=( '-b[output in base64]' - '(-h)-C+[verify input files against checksums in specifed file]:checksum file:_files' + '(-h)-C+[verify input files against checksums in specified file]:checksum file:_files' '(-C)-h+[output checksums to specified file]:checksum file:_files' '(-n -r)-q[output checksum only, or suppress check success messages]' ) diff --git a/Completion/Unix/Command/_column b/Completion/Unix/Command/_column index a81684dba..94bdccf0a 100644 --- a/Completion/Unix/Command/_column +++ b/Completion/Unix/Command/_column @@ -1,33 +1,48 @@ #compdef column -local ret=1 -local -a context state line expl args columns MATCH +# Note: BSD and util-linux disagree on how to describe the behaviour of the -x +# option. We use our own wording to avoid confusion + +local variant ret=1 +local -a context state line expl args columns MATCH aopts=( -A '-*' ) local -i MBEGIN MEND local -A opt_args -case $OSTYPE in - linux-gnu) +# Debian and its derivatives (as of 2019) ship with a slightly customised +# version of the BSD column instead of the util-linux one. It can be identified +# by the presence of the custom option -n in the synopsis +_pick_variant -r variant \ + util-linux='(#i)util-linux' \ + debian='\[-[A-Za-z]#n[A-Za-z]#\]' \ + $OSTYPE \ +--version + +case $variant in + util-linux) + aopts=() args=( '(info json -c --output-width)'{-c+,--output-width=}'[format output to fit display of specified width]:width' '(info)'{-L,--table-empty-lines}"[don't ignore empty lines]" + fill - '(info table text json -x --fillrows)'{-x,--fillrows}'[fill rows before filling columns]' + '(info table text json -x --fillrows)'{-x,--fillrows}'[print across before down]' + table '(info fill -t --table)'{-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 -O --table-order)'{-O+,--table-order=}'[specify order of output columns]: :->columns' '(info fill -N --table-columns)'{-N+,--table-columns=}'[specify column names]:names' '(info fill -H --table-hide)'{-H+,--table-hide=}"[don't print specified columns]: :->columns" + text '(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-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 -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 -r --tree)'{-r+,--tree=}'[specify column to format tree-like]: :->column' - '(info fill json -i --tree-id)'{-i+,--tree-id=}'[specify column containing ID for child-parent relations]: :->column' - '(info fill json -p --tree-parent)'{-p+,--tree-parent=}'[specify column containing reference to parent]: :->column' + '(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' + 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]' @@ -36,17 +51,24 @@ case $OSTYPE in '(- *)'{-V,--version}'[display version information]' ) ;; - *) + debian) + aopts=() args=( + "(-x)-n[don't merge multiple adjacent delimiters]" + "-e[don't ignore empty lines]" + ) + ;& # FALL THROUGH + *) + args+=( '(-t -s)-c+[format output to fit display of specified width]:width' '(-c -x)-t[create a table]' '(-c -x)-s+[specify column delimiters in input data]:delimiters' - '(-t -s)-x[fill rows before filling columns]' + '(-n -t -s)-x[print across before down]' ) ;; esac -_arguments -s -S '*:file:_files' $args && ret=0 +_arguments -s -S $aopts '*:file:_files' $args && ret=0 if [[ -n $state ]]; then columns=( ${(s.,.)${(Q)${opt_args[table--N]:-$opt_args[table---table-columns]}//(#m)\\([\\:])/${MATCH[2]}}} ) diff --git a/Completion/Unix/Command/_composer b/Completion/Unix/Command/_composer index 2b9f2cd32..1cd3f3561 100644 --- a/Completion/Unix/Command/_composer +++ b/Completion/Unix/Command/_composer @@ -40,7 +40,7 @@ __composer_call() { __composer_update_work_dir - cmd=( ${_composer_cmd:-composer} -d${_composer_work_dir:-${(q)PWD}} ) + cmd=( ${_composer_cmd:-composer} -d${(q)${_composer_work_dir:-$PWD}} ) (( _composer_is_global )) && cmd+=( global ) _call_program $1 $cmd "${@[2,-1]}" @@ -115,7 +115,7 @@ __composer_prune_global_opts() { (( $+functions[__composer_update_work_dir] )) || __composer_update_work_dir() { if [[ -n ${(v)opt_args[(i)(-d|--working-dir)]} ]]; then - eval _composer_work_dir=${(v)opt_args[(i)(-d|--working-dir)]} + _composer_work_dir=${(Q)${(v)opt_args[(i)(-d|--working-dir)]}} elif [[ -z $_composer_work_dir ]]; then _composer_work_dir=$PWD fi diff --git a/Completion/Unix/Command/_cp b/Completion/Unix/Command/_cp index 88750b330..f7411055b 100644 --- a/Completion/Unix/Command/_cp +++ b/Completion/Unix/Command/_cp @@ -32,7 +32,7 @@ if _pick_variant gnu=GNU unix --version; then '(-v --verbose)'{-v,--verbose}'[explain what is being done]' \ '(-x --one-file-system)'{-x,--one-file-system}'[stay on this file system]' \ '(--context)-Z[set destination SELinux security context]' \ - '(-Z)--context=-[set destination SELinux security context]::context' \ + '(-Z)--context=-[set destination SELinux security context]:: :_selinux_contexts' \ '(- *)--help' '(- *)--version' \ '*:file or directory:_files' else @@ -53,7 +53,7 @@ else 'solaris2.<11->*' '-/[preserve extended attributes and extended system attributes]' \ '(darwin|dragonfly|freebsd)*' "(-f -i)-n[don't overwrite existing file]" \ 'netbsd*' "-N[don't copy file flags]" \ - '(darwin|dragonfly|freebsd|netbsd)*' '-a[archive mode, same as -RpP]' \ + '(darwin|dragonfly|freebsd|netbsd|openbsd)*' '-a[archive mode, same as -RpP]' \ '(dragonfly|freebsd)*' '-l[link files instead of copying]' \ '(darwin|dragonfly|*bsd)*' '-v[show file names as they are copied]' \ 'darwin*' "-X[don't copy extended attributes or resource forks]" \ diff --git a/Completion/Unix/Command/_date b/Completion/Unix/Command/_date index a3e933710..68bd357fb 100644 --- a/Completion/Unix/Command/_date +++ b/Completion/Unix/Command/_date @@ -31,7 +31,7 @@ else freebsd*|dragonfly*|darwin*|netbsd*|openbsd*) opts+=( -A '-*' ) args+=( - '-j[do not try to set date]' + "-j[don't try to set date]" '2:format or date:->fmt_date' ) ;| @@ -40,8 +40,7 @@ else ;| freebsd*|dragonfly*|darwin*|openbsd*) args+=( - '-d+:daylight saving time value' - '-t+:minutes west of GMT' + '-f+[use specified format for input]:parsing format:_date_formats:new date' ) ;| dragonfly*|darwin*|netbsd*|openbsd*) @@ -57,14 +56,16 @@ else ) args+=( '-r+[reference time: file modification or literal time]:reference: _alternative $alts' + '(-R)-I-[display in ISO 8601 format]::precision:(date hours minutes seconds)' ) ;| freebsd*|dragonfly*|darwin*) args+=( - '-f+[use specified format for input]:parsing format:_date_formats:new date:' - '*-v+[adjust and print (but not set) date]:[+-]value[ymwdHMS]:' + '-d+:daylight saving time value' + '-t+:minutes west of GMT' + "*-v+[adjust and print (but don't set) date]:[+-]value[ymwdHMS]" ) - ;; + ;| freebsd*|dragonfly*) args+=( '-R[display in RFC2822 format]' ) ;| diff --git a/Completion/Unix/Command/_dbus b/Completion/Unix/Command/_dbus index 3f106cb5c..37b5458d7 100644 --- a/Completion/Unix/Command/_dbus +++ b/Completion/Unix/Command/_dbus @@ -1,4 +1,4 @@ -#compdef dbus-send dbus-monitor +#compdef dbus-send dbus-monitor dbus-launch local curcontext="$curcontext" state line expl find end ret=1 typeset -A opt_args @@ -27,6 +27,20 @@ case $service in - '(format)' \ --monitor --profile --pcap --binary && ret=0 ;; + dbus-launch) + _arguments -C \ + --version"[print the version of dbus-launch]" \ + --help"[print the help info of dbus-launch]" \ + --sh-syntax"[emit bourne-shell compatible code to set up environment variables]" \ + --csh-syntax"[emit csh compatible code to set up environment variables]" \ + --auto-syntax"[choose --csh-syntax or --sh-syntax based on the SHELL environment variable]" \ + --binary-syntax"[use a nul-terminated syntax with the environment data]" \ + --close-stderr"[close stderr stream before starting the d-bus daemon]" \ + --exit-with-session"[create a persistent \"babysitter\" process]" \ + --exit-with-x11"[create a persistent \"babysitter\" process that will connect to the x server]" \ + --autolaunch="[scan for a previously-started session and reuse the values found there]:machine id:->machine-id" \ + --config-file="[pass --config-file=FILENAME to the bus daemon]" && ret=0 + ;; esac case $state in @@ -85,6 +99,14 @@ case $state in 'arg0namespace:namespace' \ 'eavesdrop:eavesdropping:(true false)' && ret=0 ;; + machine-id) + { local machine_id="$(</var/lib/dbus/machine-id)" } 2>/dev/null + if [[ -n "$machine_id" ]]; then + _wanted machine-ids expl machine-id compadd $machine_id && ret=0 + else + _message "No /var/lib/dbus/machine-id found" && ret=0 + fi + ;; esac return ret diff --git a/Completion/Unix/Command/_dhclient b/Completion/Unix/Command/_dhclient index ee309e1fd..d5ca5b271 100644 --- a/Completion/Unix/Command/_dhclient +++ b/Completion/Unix/Command/_dhclient @@ -6,12 +6,12 @@ case $OSTYPE in (open|free)bsd*) args+=( '-c+[specify configuration file]:file:_files' - '-l+[specify leases file]:file:_files' ) ;| freebsd*) args+=( '(-d)-b[immediately move to the background]' + '-l+[specify leases file]:file:_files' '-p+[specify PID file]:file:_files' '-u[reject leases with unknown options]' '-q[quiet]' @@ -45,7 +45,7 @@ case $OSTYPE in '-g[force giaddr field]:relay:_hosts' '-i[use a DUID with DHCPv4 clients]' '-I[use the standard DDNS scheme]' - '--version[display version number]' + '(-)--version[display version number]' '(-4)-S[use Information-request to get only stateless configuration]' '(-4)*-T[ask for IPv6 temporary addresses]' '(-4)-P[enable IPv6 prefix delegation]' @@ -67,6 +67,10 @@ case $OSTYPE in '--request-options[specify list of options the client is to request from the server]:options' '--timeout[specify time after which dhclient will decide that no DHCP servers can be contacted]:timeout' '--dad-wait-time[specify maximum time to wait for duplicate address detection]:time (seconds)' + '--prefix-len-hint[specify length to request when requesting new prefixes]:length' + '--decline-wait-time[specify time an IPv4 client should wait between declining an address and issuing a discover]:time (seconds)' + '--address-prefix-len[specify length of the prefix for IPv6 addresses]:length' + '(-)'{--help,-h}'[display usage information]' ) ;; esac diff --git a/Completion/Unix/Command/_dig b/Completion/Unix/Command/_dig index d37f18643..d2ffb0a33 100644 --- a/Completion/Unix/Command/_dig +++ b/Completion/Unix/Command/_dig @@ -78,6 +78,7 @@ _arguments -s -C $args \ '*-6[use IPv6 only]' \ '*-t+[specify type]:type:_dns_types' \ '*-q+[specify host name to query]:host:_hosts' \ + "-r[don't read ~/.digrc]" \ '*-x+[reverse lookup]:IP address' \ '*-k+[specify TSIG key file]:file:_files' \ '*-y+[specify TSIG key]:hmac\:name\:key' \ diff --git a/Completion/Unix/Command/_dsh b/Completion/Unix/Command/_dsh index fc7680062..2486b23fd 100644 --- a/Completion/Unix/Command/_dsh +++ b/Completion/Unix/Command/_dsh @@ -10,10 +10,10 @@ _arguments -s -C -S \ '(-M --show-machine-names)'{-M,--show-machine-names}'[prepend the host name on output]' \ '(-i --duplicate-input)'{-i,--duplicate-input}'[duplicate input given to dsh]' \ '(-b --bufsize)'{-b,--bufsize}'[change buffer size used in input duplication]:buffer size for -i (bytes)' \ - '(-m --machine)'{-m,--machine}'[execute on machine]:machine:{_hosts || _user_at_host}' \ + \*{-m,--machine}'[execute on machine]:machine:{_hosts || _user_at_host}' \ '(-n --num-topology)'{-n,--num-topology}'[how to divide the machines]:number' \ '(-a --all)'{-a,--all}'[execute on all machines]' \ - '(-g --group)'{-g,--group}'[execute on group member]:groupname:->groups' \ + \*{-g,--group}'[execute on group member]:groupname:->groups' \ '(-f --file)'{-f,--file}'[use the file as list of machines]:file:_files' \ '(-r --remoteshell)'{-r,--remoteshell}'[execute using shell]:remote shell:(rsh ssh)' \ '(-o --remoteshellopt)'{-o,--remoteshellopt}'[option to give to remote shell ]:option' \ diff --git a/Completion/Unix/Command/_ecasound b/Completion/Unix/Command/_ecasound index 7ad08d0e1..a39e426db 100644 --- a/Completion/Unix/Command/_ecasound +++ b/Completion/Unix/Command/_ecasound @@ -36,7 +36,7 @@ _arguments -C \ '*-eS\:-[audio stamp]:stamp-id (int)' \ '*-ea\:-[amplify signal]:amplification value (percent)' \ '*-eac\:-[amplify signal of channel]: :->eac' \ - '*-eaw\:-[amplify singal (clipping)]: :->eaw' \ + '*-eaw\:-[amplify signal (clipping)]: :->eaw' \ '*-eal\:-[limits audio level]:limit (percent)' \ '*-ec\:-[compressor (a simple one)]: :->ec' \ '*-eca\:-[a more advanced compressor]: :->eca' \ diff --git a/Completion/Unix/Command/_elm b/Completion/Unix/Command/_elm deleted file mode 100644 index 2918a5de0..000000000 --- a/Completion/Unix/Command/_elm +++ /dev/null @@ -1,18 +0,0 @@ -#compdef elm - -_arguments -s \ - '::recipient:_email_addresses' \ - '-a[use the arrow pointer regardless]' \ - '-A+[attach file]:file attachment:_files' \ - '-c[check the given aliases only]:*:alias' \ - '-d+[set debug level]:debug level' \ - '-f+[specify mailbox to load]:mailbox: _mailboxes' \ - '-h[display help]' \ - '-i+[specify file to include in message]:include file:_files' \ - '-m[turn off menu, using more of the screen]' \ - '-s+[specify a subject]:subject:' \ - "-t[don't use termcap/terminfo ti/te entries]" \ - '-V[enable sendmail voyeur mode]' \ - '-v[display elm version]' \ - '-w[write .elm/elmrc]' \ - '-z[start only if new messages]' diff --git a/Completion/Unix/Command/_entr b/Completion/Unix/Command/_entr index e1ba7cf2b..3e2261a18 100644 --- a/Completion/Unix/Command/_entr +++ b/Completion/Unix/Command/_entr @@ -4,11 +4,12 @@ local curcontext="$curcontext" state state_descr line ret=1 typeset -A opt_args _arguments -s -S \ + '(-r)-a[respond to all events rather than consolidating them to avoid looping]' \ '-c[execute clear before invoking utility]' \ '-d[track directories and exit if a new file is added]' \ "-n[non-interactive mode; don't access TTY]" \ '-p[postpone first execution of the utility]' \ - '-r[reload a persistent child process]' \ + '(-a)-r[reload a persistent child process]' \ '(*)-s[evaluate the first argument using interpreter specified by $SHELL]' \ '(-): :->command' \ '*::arguments:_normal' && ret=0 diff --git a/Completion/Unix/Command/_env b/Completion/Unix/Command/_env index 932a7fc89..27978d936 100644 --- a/Completion/Unix/Command/_env +++ b/Completion/Unix/Command/_env @@ -11,6 +11,10 @@ case $variant in '(--ignore-environment -i --help --version)*'{-u+,--unset=}'[remove variable from the environment]:env var to remove:_parameters -g "*export*"' '(-C --chdir)'{-C+,--chdir=}'[change working directory]:directory:_directories' '(-S --split-string)'{-S+,--split-string=}'[perform word splitting]:string to split' + '--block-signal=[block delivery of signals to command]:signal:_sequence _signals' + '--default-signal=[reset handling of signals to the default]:signal:_sequence _signals' + '--ignore-signal=[set handling of signals to do nothing]:signal:_sequence _signals' + '--list-signal-handling[list non default signal handling to stderr]' '(-v --debug)'{-v,--debug}'[print verbose information for each processing step]' "${ign}(- *)--help[display help information]" "${ign}(- *)--version[display version information]" diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find index edd46ac1c..916fcf2e6 100644 --- a/Completion/Unix/Command/_find +++ b/Completion/Unix/Command/_find @@ -1,6 +1,6 @@ #compdef find gfind -local curcontext="$curcontext" state_descr variant default +local curcontext="$curcontext" state_descr variant default ret=1 local -a state line args alts disp smatch _pick_variant -r variant gnu=GNU $OSTYPE -version @@ -98,7 +98,7 @@ case $variant in args+=( '(- *)-help' '(-)--help' '(- *)-version' '(-)--version' - '-D[print diagnostics]:debug option:(help tree search stat rates opt exec)' + '-D[print diagnostics]:debug option:(exec opt rates search stat time tree all help)' '-O+[enable query optimisation]:level:(1 2 3)' '*-daystart' '-regextype:regexp syntax:(help findutils-default awk egrep ed emacs gnu-awk grep posix-awk posix-basic posix-egrep posix-extended posix-minimal-basic sed)' @@ -116,7 +116,7 @@ case $variant in '*-fprintf:output file:_files:output format' '*-printf:output format' ) - [[ $OSTYPE = linux-gnu ]] && args+=( '*-context:SELinux context' ) + [[ $OSTYPE = linux-gnu ]] && args+=( '*-context:SELinux context (glob pattern):_selinux_contexts' ) ;; esac @@ -147,7 +147,8 @@ _arguments -C $args \ '*-user:user:_users' \ '*-xdev' \ '*-a' '*-o' \ - '(-D -E -H -L -O -P -f -s -x --help --version)*:directory:_files -/' + '(-D -E -H -L -O -P -f -s -x --help --version)*:directory:_files -/' \ +&& ret=0 if [[ $state = times ]]; then if ! compset -P '[+-]' || [[ -prefix '[0-9]' ]]; then @@ -164,5 +165,7 @@ if [[ $state = times ]]; then alts=( "senses:sense${default}:compadd -V times -S '' -d disp -a smatch" ) fi alts+=( "times:${state_descr}:_dates -f d" ) - _alternative $alts + _alternative $alts && ret=0 fi + +return ret diff --git a/Completion/Unix/Command/_flasher b/Completion/Unix/Command/_flasher deleted file mode 100644 index d5820e116..000000000 --- a/Completion/Unix/Command/_flasher +++ /dev/null @@ -1,29 +0,0 @@ -#compdef flasher - -_arguments \ - '(--fiasco -F)'{--fiasco,-F}':location of a FIASCO image:_files' \ - '(--kernel -k)'{--kernel,-k}':location of kernel image:_files' \ - '(--initfs -n)'{--initfs,-n}':location of initfs image:_files' \ - '(--rootfs -r)'{--rootfs,-r}':location of root JFFS2 image:_files' \ - '(--xloader -x)'{--xloader,-x}':location of X-Loader image:_files' \ - '(--secondary -s)'{--secondary,-s}':location of NOLO secondary bootloader image:_files' \ - '(--2nd -2)'{--2nd,-2}':location of NOLO cold flasher ("2nd") image:_files' \ - '(--unpack -u)'{--unpack,-u}'::unpack a FIASCO image:_files' \ - '(--flash -f)'{--flash,-f}'[load and flash all supplied images]' \ - '(--load -l)'{--load,-l}'[only load all supplied images]' \ - '(--boot -b)'{--boot,-b}'::kernel cmdline' \ - '(--reboot -R)'{--reboot,-R}'[reboot the board]' \ - '(--read-board-id -i)'{--read-board-id,-i}'[print out the board type]' \ - '(--serial-port -S)'{--serial-port,-S}':serial port used for cold flashing' \ - '(--initialize-port -I)'{--initialize-port,-I}':something' \ - '(--cold-flash -c)'{--cold-flash,-c}'[cold flash the device]' \ - '--enable-rd-mode[enable R&D mode on the device]' \ - '--disable-rd-mode[disable R&D mode on the device]' \ - '--set-rd-flags::R&D mode flags to set' \ - '--clear-rd-flags::R&D mode flags to clear' \ - '--query-rd-mode[query the device R&D mode status and flags]' \ - '--set-root-device:default root device' \ - '--query-root-device[query the default root device]' \ - '--enable-usb-host-mode[set the device into USB host mode]' \ - '--disable-usb-host-mode[set the device into USB peripheral mode]' \ - '--flash-only:components' diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc index 9de0b79b1..9ec09200e 100644 --- a/Completion/Unix/Command/_gcc +++ b/Completion/Unix/Command/_gcc @@ -13,6 +13,11 @@ if [[ "$service" = -value-* ]]; then args2=() fi else + # On some systems (macOS), cc/gcc/g++ are actually clang; treat them accordingly + [[ $service != clang* ]] && + _pick_variant clang=clang unix --version && + service=clang-$service + args2=( '*:input file:_files -g "*.([cCmisSoak]|cc|cpp|cxx|ii|k[ih])(-.)"' ) fi @@ -350,10 +355,12 @@ if [[ "$service" = clang* ]]; then "-nostdinc[Do not search standard system directories or compiler builtin directories for include files]" "-nostdlibinc[Do not search standard system directories for include files]" "-nobuiltininc[Do not search builtin directory for include files]" + "--help[Display this information]" ) else args+=( '-flto=-[Enable link-time optimization]::jobs:' + '*--help=-[Display this information]:class:->help' ) fi @@ -427,7 +434,6 @@ args+=( '*-isystem:second include path directory (system):_files -/' '--sysroot=-[Use <directory> as the root directory for headers and libraries]:directory:_files -/' '-pass-exit-codes[Exit with highest error code from a phase]' - '*--help=-[Display this information]:class:->help' '--target-help[Display target specific command line options]' '-dumpspecs[Display all of the built in spec strings]' '-dumpversion[Display the version of the compiler]' @@ -440,6 +446,7 @@ args+=( '-print-multi-os-directory[Display the relative path to OS libraries]' '-print-sysroot[Display the target libraries directory]' '-print-sysroot-headers-suffix[Display the sysroot suffix used to find headers]' + '-save-stats=-[Save code generation statistics]:location:(cwd obj)' '-save-temps[Do not delete intermediate files]' '-no-canonical-prefixes[Do not canonicalize paths when building relative prefixes to other gcc components]' '-pipe[Use pipes rather than intermediate files]' @@ -675,7 +682,6 @@ args+=( '-Wunderflow[Warn about underflow of numerical constant expressions]' '-Wuninitialized[Warn about uninitialized automatic variables]' '-Wunknown-pragmas[Warn about unrecognized pragmas]' - '-Wunreachable-code[Does nothing. Preserved for backward compatibility]' '-Wunsafe-loop-optimizations[Warn if the loop cannot be optimized due to nontrivial assumptions]' '-Wunsuffixed-float-constants[Warn about unsuffixed float constants]' '-Wunused-but-set-parameter[Warn when a function parameter is only set, otherwise unused]' @@ -729,6 +735,20 @@ args+=( '-Werror=-[Treat specified warning as error (or all if none specified)]::warning:->werror' '-Wfatal-errors[Exit on the first error occurred]' ) +# clang specific warnings +if [[ "$service" = clang* ]]; then + args+=( + '-Wunreachable-code[Warn on code that will not be executed]' + '-Wunreachable-code-aggressive[Controls -Wunreachable-code, -Wunreachable-code-break, -Wunreachable-code-return]' + '-Wunreachable-code-break[Warn when break will never be executed]' + '-Wunreachable-code-loop-increment[Warn when loop will be executed only once]' + '-Wunreachable-code-return[Warn when return will not be executed]' + ) +else + args+=( + '-Wunreachable-code[Does nothing. Preserved for backward compatibility]' + ) +fi # optimizers (from --help=optimizers), except for -O args+=( # --help=optimizers,^joined diff --git a/Completion/Unix/Command/_gcore b/Completion/Unix/Command/_gcore index 4933ffee6..07a65cd9a 100644 --- a/Completion/Unix/Command/_gcore +++ b/Completion/Unix/Command/_gcore @@ -33,11 +33,19 @@ case $OSTYPE in '-c+[write core file to specified file]:file:_files' \ '*:pid:_pids' ;; + dragonfly*) + _arguments -s \ + '-c+[write core file to specified file]:file:_files' \ + '-l+[skip map segments larger than the specified limit]:limit (bytes)' \ + '-s[stop the process while gathering the core image]' \ + '-v[Verbosely print out the map segments being dumped]' \ + '::executable:' \ + ':pid:_pids' + ;; freebsd*) _arguments -s \ '-c+[write core file to specified file]:file:_files' \ '-f[dump all available segments]' \ - '-s[stop process while gathering image]' \ '::executable:' \ ':pid:_pids' ;; diff --git a/Completion/Unix/Command/_gem b/Completion/Unix/Command/_gem index 5b048f86d..b35a5c358 100644 --- a/Completion/Unix/Command/_gem +++ b/Completion/Unix/Command/_gem @@ -28,12 +28,12 @@ if [[ $state = command ]]; then else cmds=( build cert check cleanup contents dependency environment fetch - generate_index help install list lock mirror open outdated owner + generate_index help install info list lock mirror open outdated owner pristine push query rdoc search server signin signout sources specification stale uninstall unpack update which yank ) cmds=( ${(M)cmds:#${words[1]}*} ) - if (( ${#cmds} == 1 )); then + if (( ${#cmds} == 1 )) || [[ $cmds[1] = install ]]; then cmd="$cmds[1]" curcontext="${curcontext%:*:*}:gem-${cmd}:" fi @@ -56,7 +56,7 @@ if [[ $state = command ]]; then check|cleanup|contents|dependency|list|open|pristine|rdoc|uninstall|unpack|update) args+=( '(--all --skip)*:installed gem:->gems-local' ) ;| - fetch|install|lock|owner|push|search|yank) + fetch|install|lock|owner|search|yank) args+=( '*:gem:->gems-remote' ) ;| cleanup|uninstall) @@ -65,15 +65,19 @@ if [[ $state = command ]]; then contents|pristine|rdoc) args+=( '(*)--all[apply to all installed gems]' ) ;| - list|query) def[local]='!' ;| + info|list|query) def[local]='!' ;| search) def[remote]='!' ;| - list|query|search) + info|list|query|search) args+=( ${(e)lropts} '(-a --all)'{-a,--all}'[display all gem versions]' '(-e --exact)'{-e,--exact}'[use exact string matching instead of regex]' '(-I --no-installed -i --installed)'{-i,--installed}'[check if gem is installed]' '(-I --no-installed -i --installed)'{-I,--no-installed}'[check if gem is not installed]' '--no-versions[display only gem names]' + ) + ;| + list|query|search) + args+=( '(-d --details)'{-d,--details}'[display detailed gem information]' '!(-d --details)--no-details' ) @@ -114,11 +118,15 @@ if [[ $state = command ]]; then '--suggestions[suggest alternates when gems are not found]' ) ;| + (un|)install|pristine|update) + args+=( + '(-n --bindir)'{-n,--bindir=}'[specify directory where binary files are located]:directory:_directories' + ) + ;| (un|)install|update) args+=( '--ignore-dependencies[ignore dependency requirements]' '(-i --install-dir)'{-i,--install-dir=}'[specify gem repository directory to get installed gems]:directory:_directories' - '(-n --bindir)'{-n,--bindir=}'[specify directory where binary files are located]:directory:_directories' ) ;| owner|push) @@ -130,13 +138,18 @@ if [[ $state = command ]]; then owner|push|signin|yank) args+=( '--host=[use another gemcutter-compatible host]:host:_urls' ) ;| + owner|push|signin) + args+=( '--otp=[specify digit code for multifactor authentication]:code' ) + ;| install|pristine|update) args+=( '(-E --env-shebang)'{-E,--env-shebang}'[rewrite executables with a shebang of /usr/bin/env]' ) ;| - build) args+=( - '--force[skip validation of the spec]' + '(--strict)--force[skip validation of the spec]' + '(--force)--strict[consider warnings as errors when validating the spec]' + '(-o --output)'{-o+,--output=}'[output gem with the given filename]:file:_files' + '-C+[run as if specified directory was the current directory]:directory:_directories' '1:gemspec file:_files -g "*.gemspec(-.)"' ) ;; @@ -150,6 +163,7 @@ if [[ $state = command ]]; then '(-K --private-key)'{-K,--private-key=}'[specify key for --sign or --build]:key' '(-s --sign)'{-s,--sign=}'[sign specified certificate with the key from -K and the certificate from -C]:certificate' '(-d --days)'{-d,--days=}'[specify days before certificate expires]:days' + '(-R --re-sign)'{-R,--re-sign}'[re-sign the certificate]' ) ;; check) @@ -161,7 +175,10 @@ if [[ $state = command ]]; then ) ;; cleanup) - args+=( '(-n -d --dryrun)'{-n,-d,--dryrun}"[don't uninstall gems]" ) + args+=( + '(-n -d --dryrun)'{-n,-d,--dryrun}"[don't uninstall gems]" + "--user-install[cleanup in user's home directory instead of GEM_HOME]" + ) ;; contents) args+=( @@ -214,7 +231,7 @@ if [[ $state = command ]]; then ) ;; push) - args+=( '*:gem:_files -g "*.gem(-.)"' ) + args+=( '1:gem file:_files -g "*.gem(-.)"' ) ;; query) args+=( diff --git a/Completion/Unix/Command/_getconf b/Completion/Unix/Command/_getconf index f2c713a52..36f58226c 100644 --- a/Completion/Unix/Command/_getconf +++ b/Completion/Unix/Command/_getconf @@ -1,6 +1,8 @@ #compdef getconf -local expl ret=1 +local variant list_cmd ret=1 +local -a context expl line state state_descr args +local -A opt_args local -a syskeys posixkeys confkeys pathkeys1 pathkeys2 allkeys mykeys restkeys syskeys=(ARG_MAX BC_BASE_MAX BC_DIM_MAX BC_SCALE_MAX @@ -23,38 +25,85 @@ pathkeys1=(PIPE_BUF _POSIX_CHOWN_RESTRICTED pathkeys2=(LINK_MAX MAX_CANON MAX_INPUT NAME_MAX PATH_MAX PIPE_BUF) mykeys=($syskeys $posixkeys $confkeys $pathkeys1 $pathkeys2) -if [[ CURRENT -eq 2 ]]; then - _tags syswideconfig pathconfig standardsconfig confstring restconfig +if _pick_variant -r variant gnu='(Free Soft|GLIBC)' $OSTYPE --version; then + # GNU getconf doesn't use getopt(3), strangely + args+=( + '(: * -)--help[display help information]' + '(: * -)--version[display version information]' + '(1 -)-a[display all configuration variables and their values]' + '(-)-v[specify programming environment]: :->env' + ) + : ${list_cmd:='$words[1] -a'} - allkeys=(${${(f)"$(getconf -a 2>/dev/null)"}%%[: ]*}) - restkeys=(${allkeys:|mykeys}) +else + [[ $variant == (netbsd*|solaris*) ]] && { + args+=( '(1 -)-a[display all configuration variables and their values]' ) + : ${list_cmd:='$words[1] -a'} + } - while _tags; do - _requested -V syswideconfig expl 'systemwide configuration variables' \ - compadd -S '' $syskeys && ret=0 + [[ $variant == openbsd* ]] && { + args+=( + '(: - *)-l[display all system (non-path) configuration variables]' + '(: - *)-L[display all path configuration variables]' + ) + : ${list_cmd:='$words[1] -l; $words[1] -L'} + } - _requested -V standardsconfig \ - expl 'system-standards configuration variables' \ - compadd -S '' $posixkeys && ret=0 + [[ $variant == netbsd* ]] || + args+=( '(-)-v+[specify programming environment]: :->env' ) - _requested -V confstring \ - expl 'configuration-dependent string variables' \ - compadd -S '' $confkeys && ret=0 + # This is a bit silly, but actually pretty accurate, where available + : ${list_cmd:=' + command strings -- ${${(Q)words[1]}:c} | + LC_ALL=C GREP_OPTIONS= command grep -xE \ + "_*[A-Z][A-Z0-9_]*_[A-Z0-9_]*|NZERO|PATH|[A-Z]+(BITS|SIZE)" + '} +fi - _requested pathconfig && - while _next_label -V pathconfig expl 'system path configuration variables'; do - compadd "$expl[@]" -S '' $pathkeys1 && ret=0 - compadd "$expl[@]" -S ' ' $pathkeys2 && ret=0 - done +_arguments -S -A '-*' : $args '1: :->var' '2: :_files' && ret=0 - if (( ${#restkeys} )); then - _requested -V restconfig \ - expl 'remaining unclassified configuration variables' \ - compadd -S '' $restkeys && ret=0 - fi +case $state in + env) + _wanted environments expl 'programming environment' compadd - \ + POSIX_V{6,7}_ILP32_OFF32 \ + POSIX_V{6,7}_ILP32_OFFBIG \ + POSIX_V{6,7}_LP64_OFF64 \ + POSIX_V{6,7}_LPBIG_OFFBIG \ + && ret=0 + ;; + var) + _tags syswideconfig pathconfig standardsconfig confstring restconfig - (( ret )) || return 0 - done -else - _files -/ -fi + allkeys=(${${(f)"$( _call_program variables $list_cmd )"}%%[=:[:space:]]*}) + restkeys=(${allkeys:|mykeys}) + + while _tags; do + _requested -V syswideconfig expl 'system-wide configuration variable' \ + compadd -S '' $syskeys && ret=0 + + _requested -V standardsconfig \ + expl 'system-standards configuration variable' \ + compadd -S '' $posixkeys && ret=0 + + _requested -V confstring \ + expl 'configuration-dependent string variable' \ + compadd -S '' $confkeys && ret=0 + + _requested pathconfig && + while _next_label -V pathconfig expl 'system path configuration variable'; do + compadd "$expl[@]" -S '' $pathkeys1 && ret=0 + compadd "$expl[@]" -S ' ' $pathkeys2 && ret=0 + done + + if (( ${#restkeys} )); then + _requested -V restconfig \ + expl 'remaining unclassified configuration variable' \ + compadd -S '' $restkeys && ret=0 + fi + + (( ret )) || break + done + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_getent b/Completion/Unix/Command/_getent index 7f4e8bc9c..b96852db3 100644 --- a/Completion/Unix/Command/_getent +++ b/Completion/Unix/Command/_getent @@ -5,24 +5,28 @@ local services databases keys local -a args typeset -A opt_args -if _pick_variant -r is_gnu gnu='(GNU|EGLIBC|Gentoo)' unix --version; then +if _pick_variant -r is_gnu gnu='(Free Soft|GNU|GLIBC|Gentoo)' unix --version; then args+=( '(- 1 *)'{-\?,--help}'[display help information]' '(- 1 *)--usage[display a short usage message]' '(- 1 *)'{-V,--version}'[display version information]' - {-s,--service=}'[specify service configuration to use]:service:->services' + '*'{-s+,--service=}'[specify service configuration to use]: :->services' '(-i --no-idn)'{-i,--no-idn}'[disable IDN encoding]' ) fi -_arguments -C "$args[@]" \ +_arguments -s -S -C "$args[@]" \ '1:database:->databases' \ '*:key:->keys' && ret=0 case $state in services) - services=( /lib/libnss*(-.:fr:t:s/libnss_//) ) - _wanted services expl service compadd ${services%-*} && ret=0 + # @todo GNU getent supports both `-s svc` and `-s db:svc`; we only complete + # the former here + services=( {,/usr}/lib/{,*-linux-gnu/}libnss_*(N-.:fr:t:s/libnss_//) ) + _wanted services expl 'service or database:service' \ + compadd ${(u)services%-*} \ + && ret=0 ;; databases) if [[ $is_gnu = gnu ]]; then @@ -46,6 +50,13 @@ case $state in aliases|passwd|shadow|group) _wanted keys expl key compadd ${keys%%:*} && ret=0 ;; + utmpx) + if (( CURRENT > 3 )); then + _files && ret=0 + else + _wanted keys expl key compadd active lastlogin log && ret=0 + fi + ;; *) _message -e keys key;; esac ;; diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b3e54f7f9..97ab26512 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -53,7 +53,7 @@ _git-add () { ignore_missing='--ignore-missing[check if files (even missing) are ignored in dry run]' fi - _arguments -C -S -s \ + _arguments -C -S -s $endopt \ '(-n --dry-run)'{-n,--dry-run}'[do not actually add files; only show which ones would be added]' \ '(-v --verbose)'{-v,--verbose}'[show files as they are added]' \ '(-f --force)'{-f,--force}'[allow adding otherwise ignored files]' \ @@ -100,7 +100,7 @@ _git-am () { # TODO: --patch-format is undocumented. # TODO: --rerere-autoupdate and --no-rerere-autoupdate are # undocumented (and not implemented here). - _arguments -S \ + _arguments -s -S $endopt \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ @@ -155,7 +155,7 @@ _git-archive () { esac fi - _arguments -C -S -s \ + _arguments -C -S -s $endopt \ '--format=-[format of the resulting archive]:archive format:__git_archive_formats' \ '(- :)'{-l,--list}'[list available archive formats]' \ '(-v --verbose)'{-v,--verbose}'[report progress to stderr]' \ @@ -177,18 +177,6 @@ _git-archive () { return ret } -(( $+functions[_git-applymbox] )) || -_git-applymbox () { - _arguments -A '-*' \ - '-k[do not modify "Subject:" header]' \ - '-m[apply patches with "git-apply" and fail if patch is unclean]' \ - '-q[apply patches interactively]' \ - '-u[encode commit information in UTF-8]' \ - '(1)-c[restart command after fixing an unclean patch]:patch:_files -g ".dotest/0*"' \ - ':mbox file:_files' \ - '::signoff file:__git_signoff_file' -} - (( $+functions[_git-bisect] )) || _git-bisect () { # TODO: next subcommand is undocumented. Git-bisect.sh mentions that the @@ -294,9 +282,9 @@ _git-bisect () { _git-branch () { declare l c m d e - l='--color --no-color -r --remotes -a -v --verbose --abbrev --no-abbrev --list --points-at --sort' + l='--color --no-color -r --remotes -a -v --verbose --abbrev --no-abbrev -l --list --points-at --sort' c='--create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --no-contains --merged --no-merged' - m='-c --copy -C -m --move -M --edit-description' + m='-c --copy -C -m --move -M --edit-description --show-current' d='-d --delete -D' declare -a dependent_creation_args @@ -326,17 +314,18 @@ _git-branch () { '::new branch name:__git_branch_names') fi - _arguments -S -s \ + _arguments -S -s $endopt \ "($c $m $d --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \ "($c $m $d : --color)--no-color[turn off branch coloring]" \ - "($c $m $d --no-column)"'--column=[display tag listing in columns]:column.branch option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \ + "($c $m $d --no-column)--column=-[display tag listing in columns]:: :_git_column_layouts" \ "($c $m $d --column)--no-column[don't display in columns]" \ - "($c $m $d )*--list[list only branches matching glob]:pattern" \ + "($c $m $d)*"{-l,--list}'[list only branches matching glob]:pattern' \ "($c $m -a)"{-r,--remotes}'[list or delete only remote-tracking branches]' \ "($c $m $d : -r --remotes)-a[list both remote-tracking branches and local branches]" \ "($c $m $d : -v -vv --verbose)"{-v,-vv,--verbose}'[show SHA1 and commit subject line for each head]' \ "($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \ "($c $m $d :)--no-abbrev[don't abbreviate sha1s]" \ + "(- :)--show-current[show current branch name]" \ "($l $m $d)--create-reflog[create the branch's reflog]" \ "($l $m $d -f --force)"{-f,--force}'[force the creation of a new branch]' \ "($l $m $d -t --track)"{-t,--track}'[setup configuration so that pull merges from the start point]' \ @@ -418,9 +407,15 @@ _git-bundle () { return ret } +(( $+functions[_git-version] )) || +_git-version () { + _arguments -S $endopt \ + '--build-options[also print build options]' +} + (( $+functions[_git-check-ignore] )) || _git-check-ignore () { - _arguments \ + _arguments -s -S $endopt \ '(-q --quiet)'{-q,--quiet}'[do not output anything, just set exit status]' \ '(-v --verbose)'{-v,--verbose}'[output details about the matching pattern (if any) for each pathname]' \ '--stdin[read file names from stdin instead of from the command-line]' \ @@ -432,7 +427,7 @@ _git-check-ignore () { (( $+functions[_git-check-mailmap] )) || _git-check-mailmap () { - _arguments \ + _arguments -S $endopt \ '--stdin[read contacts from stdin after those given on the command line]' } @@ -450,24 +445,27 @@ _git-checkout () { declare -A opt_args _arguments -C -s \ - '(-q --quiet --progress)'{-q,--quiet}'[suppress progress reporting]' \ + '(-q --quiet)'{-q,--quiet}'[suppress progress reporting]' \ '(-f --force -m --merge --conflict --patch)'{-f,--force}'[force branch switch/ignore unmerged entries]' \ '(-q --quiet -2 --ours -3 --theirs --patch)'{-2,--ours}'[check out stage #2 for unmerged paths]' \ '(-q --quiet -2 --ours -3 --theirs --patch)'{-3,--theirs}'[check out stage #3 for unmerged paths]' \ - '( -B --orphan -2 --ours -3 --theirs --conflict --patch --detach)-b+[create a new branch based at given commit]: :__git_branch_names' \ - '(-b --orphan -2 --ours -3 --theirs --conflict --patch --detach)-B+[create or update branch based at given commit]: :__git_branch_names' \ - '(-t --track --orphan --patch --detach)'{-t,--track}'[set up configuration so pull merges from the base commit]' \ + '( -B --orphan -2 --ours -3 --theirs --conflict --patch -d --detach)-b+[create a new branch based at given commit]: :__git_branch_names' \ + '(-b --orphan -2 --ours -3 --theirs --conflict --patch -d --detach)-B+[create or update branch based at given commit]: :__git_branch_names' \ + '(-t --track --orphan --patch -d --detach)'{-t,--track}'[set up configuration so pull merges from the base commit]' \ '(--patch)--no-track[override the branch.autosetupmerge configuration variable]' \ $new_branch_reflog_opt \ - '(-b -B -t --track --patch --orphan)--detach[detach the HEAD at named commit]' \ - '(-b -B -t --track --patch --detach)--orphan=[create a new orphan branch based at given commit]: :__git_branch_names' \ + '(-b -B -t --track --patch --orphan -d --detach)'{-d,--detach}'[detach the HEAD at named commit]' \ + '(-b -B -t --track --patch -d --detach)--orphan=[create a new orphan branch based at given commit]: :__git_branch_names' \ '(-q --quiet -f --force -m --merge --conflict --patch)'{-m,--merge}'[3way merge current branch, working tree and new branch]' \ '(-q --quiet -f --force -m --merge --patch)--conflict=[same as --merge, using given merge style]:style:(merge diff3)' \ '(-)'{-p,--patch}'[interactively select hunks in diff between given tree-ish and working tree]' \ "--ignore-skip-worktree-bits[don't limit pathspecs to sparse entries only]" \ + "--no-guess[don't second guess 'git checkout <no-such-branch>']" '!(--no-guess)--guess' \ "--ignore-other-worktrees[don't check if another worktree is holding the given ref]" \ '--recurse-submodules=-[control recursive updating of submodules]::checkout:__git_commits' \ - '(-q --quiet)--progress[force progress reporting]' \ + '--no-overlay[remove files from index or working tree that are not in the tree-ish]' \ + '(-q --quiet --progress)--no-progress[suppress progress reporting]' \ + '--progress[force progress reporting]' \ '(-)--[start file arguments]' \ '*:: :->branch-or-tree-ish-or-file' && ret=0 @@ -481,7 +479,6 @@ _git-checkout () { if (( CURRENT == 1 )) && [[ -z $opt_args[(I)--] ]]; then # TODO: Allow A...B local \ - remote_branch_noprefix_arg='remote-branch-names-noprefix::__git_remote_branch_names_noprefix' \ tree_ish_arg='tree-ishs::__git_commits_prefer_recent' \ file_arg='modified-files::__git_modified_files' @@ -489,13 +486,13 @@ _git-checkout () { _alternative $tree_ish_arg && ret=0 elif [[ -n $opt_args[(I)--track] ]]; then _alternative remote-branches::__git_remote_branch_names && ret=0 - elif [[ -n ${opt_args[(I)--ours|--theirs|-m|--conflict|--patch]} ]]; then + elif [[ -n ${opt_args[(I)--ours|--theirs|-m|--conflict|--patch|--no-guess]} ]]; then _alternative $tree_ish_arg $file_arg && ret=0 else _alternative \ $file_arg \ $tree_ish_arg \ - $remote_branch_noprefix_arg \ + 'remote-branch-names-noprefix::__git_remote_branch_names_noprefix' \ && ret=0 fi @@ -519,7 +516,9 @@ _git-cherry-pick () { _arguments \ '(- :)--quit[end revert or cherry-pick sequence]' \ '(- :)--continue[resume revert or cherry-pick sequence]' \ + '(- :)--skip[skip current commit and continue]' \ '(- :)--abort[cancel revert or cherry-pick sequence]' \ + '--cleanup=[specify how to strip spaces and #comments from message]:mode:_git_cleanup_modes' \ '--allow-empty[preserve initially empty commits]' \ '--allow-empty-message[allow replaying a commit with an empty message]' \ '--keep-redundant-commits[keep cherry-picked commits that will become empty]' \ @@ -547,7 +546,7 @@ _git-clean () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -C -S -s \ + _arguments -C -S -s $endopt \ '-d[also remove untracked directories]' \ '(-f --force)'{-f,--force}'[required when clean.requireForce is true (default)]' \ '(-i --interactive)'{-i,--interactive}'[show what would be done and clean files interactively]' \ @@ -607,7 +606,7 @@ _git-clone () { # TODO: Argument to -o should be a remote name. # TODO: Argument to -b should complete branch names in the repository being # cloned (see __git_references()) - _arguments -C -S -s \ + _arguments -C -S -s $endopt \ '(-l --local --no-local)'{-l,--local}'[clone locally, hardlink refs and objects if possible]' \ '(-l --local --no-local)--no-local[override --local, as if file:/// URL was given]' \ '--no-hardlinks[copy files instead of hardlinking when doing a local clone]' \ @@ -637,9 +636,11 @@ _git-clone () { '--recursive[initialize all contained submodules]' \ '--recurse-submodules=-[initialize submodules in the clone]::file:__git_files' \ '--separate-git-dir[place .git dir outside worktree]:path to .git dir:_path_files -/' \ + \*--server-option='[send specified string to the server when using protocol version 2]:option' \ '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \ '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \ '--filter=[object filtering]:filter:_git_rev-list_filters' \ + '--remote-submodules[any cloned submodules will use their remote-tracking branch]' \ ': :->repository' \ ': :_directories' && ret=0 @@ -657,15 +658,15 @@ _git-clone () { } (( $+functions[_git-column] )) || -_git-column () { +_git-column() { _arguments -s \ - '--command=[look up layout mode using config vars column.<name> and column.ui]' \ - '--mode=[specify layout mode. See configuration variable column.ui for option syntax]' \ - '--raw-mode=[same as --mode but take mode encoded as a number]' \ - '--width=[specify the terminal width]' \ - '--indent=[string to be printed at the beginning of each line]' \ - '--nl[string to be printed at the end of each line, including newline character]' \ - '--padding[the number of spaces between columns. One space by default]' + '--command=[look up layout mode using in config vars using specified command]:command:(branch clean status tag ui)' \ + '--mode=[specify layout mode]: :_git_column_layouts' \ + '--raw-mode=[same as --mode but take mode encoded as a number]:mode' \ + "--width=[specify the terminal width]:width [${COLUMNS:-80}]" \ + '--indent=[specify string to be printed at the beginning of each line]:string' \ + '--nl=[specify string to be printed at the end of each line, including newline character]:string' \ + '--padding=[specify number of spaces between columns]:spaces [1]' } (( $+functions[_git-commit] )) || @@ -681,7 +682,7 @@ _git-commit () { fi # TODO: --interactive isn't explicitly listed in the documentation. - _arguments -S -s \ + _arguments -S -s $endopt \ '(-a --all --interactive -o --only -i --include *)'{-a,--all}'[stage all modified and deleted paths]' \ '--fixup=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_recent_commits' \ '--squash=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_recent_commits' \ @@ -699,11 +700,7 @@ _git-commit () { '(-n --no-verify)'{-n,--no-verify}'[bypass pre-commit and commit-msg hooks]' \ '--allow-empty[allow recording an empty commit]' \ '--allow-empty-message[allow recording a commit with an empty message]' \ - '--cleanup=[specify how the commit message should be cleaned up]:mode:((verbatim\:"do not change the commit message at all" - whitespace\:"remove leading and trailing whitespace lines" - strip\:"remove both whitespace and commentary lines" - scissors\:"same as whitespace but cut from scissor line" - default\:"act as '\''strip'\'' if the message is to be edited and as '\''whitespace'\'' otherwise"))' \ + '--cleanup=[specify how the commit message should be cleaned up]:mode:_git_cleanup_modes' \ '(-e --edit --no-edit)'{-e,--edit}'[edit the commit message before committing]' \ '(-e --edit --no-edit)--no-edit[do not edit the commit message before committing]' \ '--no-post-rewrite[bypass the post-rewrite hook]' \ @@ -714,7 +711,7 @@ _git-commit () { all\:"show individual files in untracked directories"))' \ '(-q --quiet -v --verbose)'{-v,--verbose}'[show unified diff of all file changes]' \ '(-q --quiet -v --verbose)'{-q,--quiet}'[suppress commit summary message]' \ - '--dry-run[only show list of paths that are to be commited or not, and any untracked]' \ + '--dry-run[only show list of paths that are to be committed or not, and any untracked]' \ '( --no-status)--status[include the output of git status in the commit message template]' \ '(--status )--no-status[do not include the output of git status in the commit message template]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \ @@ -732,7 +729,7 @@ _git-commit () { (( $+functions[_git-describe] )) || _git-describe () { - _arguments -S -s \ + _arguments -S -s $endopt \ '(*)--dirty=-[describe HEAD, adding mark if dirty]::mark' \ '(*)--broken=-[describe HEAD, adding mark if broken]::mark' \ '--all[use any ref found in "$GIT_DIR/refs/"]' \ @@ -759,7 +756,7 @@ _git-diff () { __git_setup_diff_options __git_setup_diff_stage_options - _arguments -C -s \ + _arguments -C -s $endopt \ $* \ $diff_options \ '(--exit-code)--quiet[disable all output]' \ @@ -863,7 +860,7 @@ _git-fetch () { local -a fetch_options __git_setup_fetch_options - _arguments -C -S -s \ + _arguments -C -S -s $endopt \ $fetch_options \ '--shallow-since=[deepen history of shallow repository based on time]:time' \ '*--shallow-exclude=[deepen history of shallow clone by excluding revision]:revision' \ @@ -874,6 +871,7 @@ _git-fetch () { \*{-o+,--server-option=}'[send specified string to the server when using protocol version 2]:option' \ '--negotiation-tip=[only report refs reachable from specified object to the server]:commit:__git_commits' \ '--filter=[object filtering]:filter:_git_rev-list_filters' \ + "--auto-gc[run 'gc --auto' after fetching]" \ '*:: :->repository-or-group-or-refspec' && ret=0 case $state in @@ -904,7 +902,7 @@ _git-format-patch () { # TODO: -- is wrong. # TODO: Should filter out --name-only, --name-status, and --check from # $diff_options. - _arguments -C -S -s \ + _arguments -C -S -s $endopt \ $diff_options \ '--[limit the number of patches to prepare]: :__git_guard_number "number of patches to prepare"' \ '(-o --output-directory --stdout)'{-o+,--output-directory=}'[store resulting files in given directory]: :_directories' \ @@ -941,6 +939,9 @@ _git-format-patch () { '--root[treat the revision argument as a range]' \ '--zero-commit[output all-zero hash in From header]' \ '--progress[show progress while generating patches]' \ + '--interdiff=[insert interdiff against previous patch series in cover letter or single patch]:reference to tip of previous series:__git_revisions' \ + '--range-diff=[insert range-diff against previous patch series in cover letter or single patch]:reference to tip ot previous series:__git_revisions' \ + '--creation-factor=[for range-diff, specify weighting for creation]:weighting (percent)' \ ': :->commit-or-commit-range' && ret=0 case $state in @@ -958,7 +959,7 @@ _git-format-patch () { (( $+functions[_git-gc] )) || _git-gc () { - _arguments -S -s \ + _arguments -S -s $endopt \ '--aggressive[more aggressively optimize]' \ '--auto[check whether housekeeping is required]' \ '( --no-prune)--prune=-[prune loose objects older than given date]::date [2 weeks ago]:__git_datetimes' \ @@ -983,7 +984,7 @@ _git-grep () { declare -A opt_args # TODO: Need to implement -<num> as a shorthand for -C<num> - _arguments -C -A '-*' \ + _arguments -C -A '-*' $endopt \ '(-O --open-files-in-pager --no-index)--cached[search blobs registered in index file instead of working tree]' \ '(--cached)--no-index[search files in current directory, not just tracked files]' \ '(--exclude-standard)--no-exclude-standard[search also in ignored files]' \ @@ -996,6 +997,7 @@ _git-grep () { "(--textconv --no-textconv)--no-textconv[don't honor textconv filter settings]" \ '(-i --ignore-case)'{-i,--ignore-case}'[ignore case when matching]' \ "-I[don't match pattern in binary files]" \ + '!-r' '!--recursive' \ '--max-depth=[descend at most given levels of directories]: :__git_guard_number depth' \ '(-w --word-regexp)'{-w,--word-regexp}'[match only whole words]' \ '(-v --invert-match)'{-v,--invert-match}'[select non-matching lines]' \ @@ -1132,7 +1134,7 @@ _git-gui () { (( $+functions[_git-init] )) || _git-init () { - _arguments -S -s \ + _arguments -S -s $endopt \ '(-q --quiet)'{-q,--quiet}'[do not print any results to stdout]' \ '--bare[create a bare repository]' \ '--template=[directory to use as a template for the object database]: :_directories' \ @@ -1143,7 +1145,7 @@ _git-init () { (( $+functions[_git-interpret-trailers] )) || _git-interpret-trailers() { - _arguments \ + _arguments -S $endopt \ '--in-place[edit files in place]' \ '--trim-empty[trim empty trailers]' \ '--where[specify where to place the new trailer]' \ @@ -1153,6 +1155,7 @@ _git-interpret-trailers() { "--only-input[don't apply config rules]" \ '--unfold[join whitespace-continued values]' \ '--parse[set parsing options]' \ + "--no-divider[don't treat --- as the end of the commit message]" \ '--trailer[specify trailer(s) to add]' \ '*:file:_files' } @@ -1166,7 +1169,7 @@ _git-log () { __git_setup_log_options __git_setup_revision_options - _arguments -C -s \ + _arguments -C -s $endopt \ $log_options \ $revision_options \ '(-)--[start file arguments]' \ @@ -1190,7 +1193,7 @@ _git-log () { fi # TODO: Write a wrapper function that checks whether we have a - # committish range or comittish and calls __git_tree_files + # committish range or committish and calls __git_tree_files # appropriately. if __git_is_committish_range $line[1]; then __git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0 @@ -1211,17 +1214,18 @@ _git-merge () { __git_setup_merge_options local -a git_commit_opts=(--all --not HEAD --not) - _arguments -S -s \ + _arguments -S -s $endopt \ $merge_options \ \*{-m+,--message=}'[set the commit message to be used for the merge commit]:merge message' \ \*{-F+,--file=}'[read commit message from a file]:file' \ '(--edit --no-edit)-e[open an editor to change the commit message]' \ '( --no-rerere-autoupdate)--rerere-autoupdate[allow the rerere mechanism to update the index]' \ '(--rerere-autoupdate )--no-rerere-autoupdate[do not allow the rerere mechanism to update the index]' \ - '--abort[restore the original branch and abort the merge operation]' \ - '--continue[continue the current in-progress merge]' \ + '(--quit --continue)--abort[restore the original branch and abort the merge operation]' \ + '(--abort --continue)--quit[--abort but leave index and working tree alone]' \ + '(--abort --quit)--continue[continue the current in-progress merge]' \ '--progress[force progress reporting]' \ - '--verify[verify commit-msg hook]' \ + '--no-verify[verify commit-msg hook]' \ '*: : __git_commits -O expl:git_commit_opts' } @@ -1230,7 +1234,7 @@ _git-mv () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -C -S -s \ + _arguments -C -S -s $endopt \ '(-v --verbose)'{-v,--verbose}'[output additional information]' \ '(-f --force)'{-f,--force}'[rename/move even if targets exist]' \ '-k[skip rename/move that would lead to errors]' \ @@ -1254,7 +1258,7 @@ _git-notes () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -C \ + _arguments -C $endopt \ '--ref=[manipulate the notes tree in given ref]: :__git_notes_refs' \ ': :->command' \ '*:: :->option-or-argument' && ret=0 @@ -1283,13 +1287,13 @@ _git-notes () { case $line[1] in (list|show) - _arguments \ + _arguments -S $endopt \ ': :__git_commits' && ret=0 ;; (add) # TODO: Only complete commits that don't have notes already, unless # -f or --force has been given. - _arguments -S -s \ + _arguments -S -s $endopt \ '*'{-m+,--message=}'[use given note message]:message' \ '*'{-F+,--file=}'[take note message from given file]:note message file:_files' \ '(-C --reuse-message)'{-C+,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \ @@ -1299,7 +1303,7 @@ _git-notes () { ;; (copy) # TODO: --for-rewrite is undocumented. - _arguments -S -s \ + _arguments -S -s $endopt \ '(-f --force)'{-f,--force}'[replace existing note]' \ '(:)--stdin[read objects from stdin]' \ '(:--stdin)--for-rewrite=[load rewriting config for given command]:command:(amend rebase)' \ @@ -1307,10 +1311,10 @@ _git-notes () { ': :__git_commits' && ret=0 ;; (edit) - _arguments --allow-empty ':object:__git_commits' && ret=0 + _arguments -S $endopt --allow-empty ':object:__git_commits' && ret=0 ;; (merge) - _arguments -S -s \ + _arguments -S -s $endopt \ '(-s --strategy)--abort[abort an in-progress notes merge]' \ '(-s --strategy)--commit[finalize an in-progress notes merge]' \ '(-q --quiet)'{-q,--quiet}'[be quiet]' \ @@ -1319,24 +1323,27 @@ _git-notes () { ': :__git_notes_refs' && ret=0 ;; (prune) - _arguments -s \ + _arguments -s -S $endopt \ '(-v --verbose)'{-v,--verbose}'[be more verbose]' \ '(-n --dry-run)'{-n,--dry-run}"[don't remove anything, just report what would be deleted]" && ret=0 ;; (remove) - _arguments --ignore-missing --stdin ':object:__git_commits' && ret=0 + _arguments -S $endopt --ignore-missing --stdin ':object:__git_commits' && ret=0 ;; (append) - _arguments -S -s \ + _arguments -S -s $endopt \ '*'{-m+,--message=}'[use given note message]:message' \ '*'{-F+,--file=}'[take note message from given file]:note message file:_files' \ '(-C --reuse-message)'{-C+,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \ '(-c --reedit-message)'{-c+,--reedit-message=}'[take note message from given blob object and edit it]: :__git_blobs' \ ': :__git_commits' && ret=0 ;; - (*) + (get-ref) _nothing ;; + (*) + _default && ret=0 + ;; esac ;; esac @@ -1350,7 +1357,7 @@ _git-pull () { __git_setup_merge_options __git_setup_fetch_options - _arguments \ + _arguments -S -s $endopt \ $merge_options \ '(-r --rebase --no-rebase)'{-r=-,--rebase=-}'[perform a rebase after fetching]::rebase after fetching:(( true\:"rebase after fetching" @@ -1380,7 +1387,7 @@ _git-push () { # only complete files on the local end, not the remote end. Still, it may be # helpful to get some sort of completion going, perhaps modifying the path # later on to match the remote end. - _arguments -S -s \ + _arguments -S -s $endopt \ '--all[push all refs under refs/heads/]' \ '--prune[remove remote branches that do not have a local counterpart]' \ '--mirror[push all refs under refs/heads/ and refs/tags/ and delete non-existing refs]' \ @@ -1435,7 +1442,7 @@ _git-range-diff () { local -a diff_options __git_setup_diff_options - _arguments -s \ + _arguments -s -S $endopt \ '--creation-factor=[specify weighting for creation]:weighting (percent)' \ '--no-dual-color[use simple diff colors]' \ $diff_options \ @@ -1454,7 +1461,7 @@ _git-rebase () { '(--autosquash )--no-autosquash[do not check for auto-squash boundaries]') fi - _arguments \ + _arguments -s -S $endopt \ - actions \ '(-)--continue[continue after resolving merge conflict]' \ '(-)--abort[abort current rebase]' \ @@ -1470,7 +1477,8 @@ _git-rebase () { '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-q,--quiet}'[suppress all output]' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-v,--verbose}'[output additional information]' \ - '--rerere-autoupdate[allow rerere to update index with resolved conflicts]' \ + '(-n --no-stat)'{-n,--no-stat}"[don't show diffstat of what changed upstream]" \ + '--rerere-autoupdate[update the index with reused conflict resolution if possible]' \ '--no-verify[bypass the pre-rebase hook]' \ '-C-[ensure that given lines of surrounding context match]: :__git_guard_number "lines of context"' \ '(-f --force-rebase)'{-f,--force-rebase}'[force rebase even if current branch descends from commit rebasing onto]' \ @@ -1479,19 +1487,21 @@ _git-rebase () { '(-i --interactive)--committer-date-is-author-date[use author date as committer date]' \ '(-i --interactive --ignore-whitespace --whitespace --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \ '(-r --rebase-merges)'{-r-,--rebase-merges=-}'[try to rebase merges instead of skipping them]::option:(rebase-cousins no-rebase-cousins)' \ - '(-p --preserve-merges --interactive)'{-p,--preserve-merges}'[try to recreate merges instead of ignoring them]' \ + '!(-p --preserve-merges --interactive)'{-p,--preserve-merges} \ {-x+,--exec=}'[with -i\: append "exec <cmd>" after each line]:command:_command_names -e' \ '(-k --keep-empty)'{-k,--keep-empty}'[keep empty commits in the result]' \ '--allow-empty-message[allow rebasing commits with empty messages]' \ '(1)--root[rebase all reachable commits]' \ $autosquash_opts \ '(--autostash --no-autostash)--autostash[stash uncommitted changes before rebasing and apply them afterwards]' \ - '(--autostash --no-autostash)--no-autostash[do not stash uncommitted changes before rebasing and apply them afterwards]' \ + "(--autostash --no-autostash)--no-autostash[don't stash uncommitted changes before rebasing and apply them afterwards]" \ '--fork-point[use merge-base --fork-point to refine upstream]' \ '--ignore-date[use current timestamp for author date]' \ '--signoff[add Signed-off-by: line to the commit message]' \ '--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \ - '--onto=[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \ + '(--keep-base)--onto=[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \ + '(--onto)--keep-base[use the merge-base of upstream and branch as the current base]' \ + "--reschedule-failed-exec[automatically re-schedule any 'exec' that fails]" \ ':upstream branch:__git_revisions' \ '::working branch:__git_revisions' } @@ -1501,7 +1511,7 @@ _git-reset () { local curcontext=$curcontext state line ret=1 typeset -A opt_args - _arguments -C -s -S \ + _arguments -C -s -S $endopt \ '( --mixed --hard --merge --keep -p --patch -- *)--soft[do not touch the index file nor the working tree]' \ '(--soft --hard --merge --keep -p --patch -- *)--mixed[reset the index but not the working tree (default)]' \ '(--soft --hard --merge --keep -p --patch -- *)'{-N,--intent-to-add}'[record only the fact that removed paths will be added later]' \ @@ -1532,12 +1542,58 @@ _git-reset () { return ret } +(( $+functions[_git-restore] )) || +_git-restore() { + local curcontext="$curcontext" state line expl ret=1 + local -A opt_args + + _arguments -C -s -S $endopt \ + '(-s --source)'{-s,--source}'[specify which tree-ish to checkout from]:source tree:->sources' \ + '(-S --staged)'{-S,--staged}'[restore the index]' \ + '(-W --worktree)'{-W,--worktree}'[restore the working tree (default)]' \ + '--ignore-unmerged[ignore unmerged entries]' \ + '--overlay[never remove files when restoring]' '!(--overlay)--no-overlay' \ + '(-q --quiet --no-progress)'{-q,--quiet}'[suppress feedback messages]' \ + '--recurse-submodules=-[control recursive updating of submodules]::checkout:__git_commits' \ + '(-q --quiet --progress)--no-progress[suppress progress reporting]' \ + '(--no-progress)--progress[force progress reporting]' \ + '(-m --merge)'{-m,--merge}'[perform a 3-way merge with the new branch]' \ + '--conflict=[change how conflicting hunks are presented]:conflict style [merge]:(merge diff3)' \ + '(-2 --ours -3 --theirs -m --merge)'{-2,--ours}'[checkout our version for unmerged files]' \ + '(-2 --ours -3 --theirs -m --merge)'{-3,--theirs}'[checkout their version for unmerged files]' \ + '(-p --patch)'{-p,--patch}'[select hunks interactively]' \ + "--ignore-skip-worktree-bits[don't limit pathspecs to sparse entries only]" \ + '*:path spec:->pathspecs' && ret=0 + + case $state in + pathspecs) + if [[ -z ${opt_args[(I)-s|--source|-S|--staged]} ]] && + # use index as a default base unless -S is specified + __git_ignore_line __git_modified_files + then + ret=0 + else + __git_ignore_line __git_tree_files ${PREFIX:-.} ${(Qv)opt_args[(i)-s|--source]:-HEAD} && ret=0 + fi + ;; + sources) + # if a path has already been specified, use it to select commits + git_commit_opts=(-- $line) + __git_commits_prefer_recent -O expl:git_commit_opts && ret=0 + ;; + esac + + return ret +} + (( $+functions[_git-revert] )) || _git-revert () { - _arguments -S -s \ + _arguments -S -s $endopt \ '(- :)--quit[end revert or cherry-pick sequence]' \ '(- :)--continue[resume revert or cherry-pick sequence]' \ '(- :)--abort[cancel revert or cherry-pick sequence]' \ + '(- :)--skip[skip current commit and continue]' \ + '--cleanup=[specify how to strip spaces and #comments from message]:mode:_git_cleanup_modes' \ '(-e --edit --no-edit)'{-e,--edit}'[edit the commit before committing the revert]' \ '(-e --edit --no-edit)--no-edit[do not edit the commit message before committing the revert]' \ '(-m --mainline)'{-m+,--mainline=}'[pick which parent is mainline]:parent number' \ @@ -1556,7 +1612,7 @@ _git-rm () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -C -S -s \ + _arguments -C -S -s $endopt \ '(-f --force)'{-f,--force}'[override the up-to-date check]' \ '(-n --dry-run)'{-n,--dry-run}'[do not actually remove the files, just show if they exist in the index]' \ '-r[allow recursive removal when a leading directory-name is given]' \ @@ -1584,7 +1640,7 @@ _git-shortlog () { # TODO: should take all arguments found in setup_revisions() (probably more # or less what git-rev-list takes). - _arguments -C -S -s \ + _arguments -C -S -s $endopt \ '(: -)'{-h,--help}'[print a short usage message and exit]' \ '(-n --numbered)'{-n,--numbered}'[sort according to number of commits]' \ '(-s --summary)'{-s,--summary}'[suppress commit description]' \ @@ -1621,7 +1677,7 @@ _git-shortlog () { ;; (*) # TODO: Write a wrapper function that checks whether we have a - # committish range or comittish and calls __git_tree_files + # committish range or committish and calls __git_tree_files # appropriately. if __git_is_committish_range $line[1]; then __git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0 @@ -1646,7 +1702,7 @@ _git-show () { __git_setup_log_options __git_setup_revision_options - _arguments -C -s \ + _arguments -C -s $endopt \ $log_options \ $revision_options \ '(-q --quiet)'{-q,--quiet}'[suppress diff output]' \ @@ -1708,12 +1764,12 @@ _git-stash () { case $line[1] in (save) - _arguments -S \ + _arguments -S $endopt \ $save_arguments \ ':: :_guard "([^-]?#|)" message' && ret=0 ;; (push) - _arguments -S \ + _arguments -S $endopt \ $save_arguments \ '(-m --message)'{-m,--message}'[specify stash description]' \ ':: :__git_modified_files' && ret=0 @@ -1734,12 +1790,12 @@ _git-stash () { local diff_options __git_setup_diff_options - _arguments -S -s \ + _arguments -S -s $endopt \ $diff_options \ ':: :__git_stashes' && ret=0 ;; (pop|apply) - _arguments \ + _arguments -S $endopt \ '--index[try to reinstate the changes added to the index as well]' \ '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ ':: :__git_stashes' && ret=0 @@ -1753,7 +1809,7 @@ _git-stash () { _nothing ;; (drop) - _arguments \ + _arguments -S $endopt \_git-notes '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ ':: :__git_stashes' && ret=0 ;; @@ -1778,7 +1834,7 @@ _git-status () { branch_opts=('(-b --branch)'{-b,--branch}'[show branch and tracking info]') fi - _arguments -S -s \ + _arguments -S -s $endopt \ '(-s --short --column --no-column --show-stash)'{-s,--short}'[output in short format]' \ $branch_opts \ '(-s --short)--porcelain=-[produce machine-readable output]:version:(v1)' \ @@ -1791,7 +1847,7 @@ _git-status () { '--ignore-submodules[ignore changes to submodules]:: :__git_ignore_submodules_whens' \ '--ignored=-[show ignored files as well]:mode [traditional]:(traditional matching no)' \ '(-z --null --column --no-column)'{-z,--null}'[use NUL termination on output]' \ - '(--no-column -z --null)--column=-[display in columns]::column.status option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \ + '(--no-column -z --null)--column=-[display in columns]:: :_git_column_layouts' \ "(--column)--no-column[don't display in columns]" \ "(--no-renames -M --find-renames)--no-renames[don't detect renames]" \ '(--no-renames -M --find-renames)-M[detect renames]' \ @@ -1819,6 +1875,7 @@ _git-submodule () { init:'initialize a submodule' deinit:'unregister a submodule' update:'update a submodule' + set-branch:'set the default remote tracking branch for the submodule' summary:'show commit summary between given commit and working tree/index' foreach:'evaluate shell command in each checked-out submodule' absorbgitdirs:'move the git directory of a submodule into its superprojects' @@ -1875,7 +1932,13 @@ _git-submodule () { '--force[discard local changes by checking out the current up-to-date version]' \ '--init[initialize uninitialized submodules]' \ '*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0 - ;; + ;; + (set-branch) + _arguments -C -A '-*' \ + '(-d --default)'{-d,--default}'[remove config key to cause the tracking branch to default to master]' \ + '(-b --branch)'{-b,--branch=}'[specify the remote branch]:remote branch' \ + '1:path:_directories' + ;; (summary) _arguments -C -A '-*' \ '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ @@ -2015,9 +2078,61 @@ _git-subtree () { return ret } +(( $+functions[_git-switch] )) || +_git-switch() { + local curcontext="$curcontext" state line expl ret=1 + local -A opt_args + + _arguments -C -s -S $endopt \ + '(-c --create -C --force-create -d --detach --orphan --ignore-other-worktrees 1)'{-c,--create}'[create and switch to a new branch]:branch:->branches' \ + '(-c --create -C --force-create -d --detach --orphan --ignore-other-worktrees 1)'{-C,--force-create}'[create/reset and switch to a branch]:branch:->branches' \ + "(--guess --orphan 2)--no-guess[don't second guess 'git switch <no-such-branch>']" \ + "(--no-guess -t --track -d --detach --orphan 2)--guess[second guess 'git switch <no-such-branch> (default)]" \ + '(-f --force --discard-changes -m --merge --conflict)'{-f,--force,--discard-changes}'[throw away local modifications]' \ + '(-q --quiet --no-progress)'{-q,--quiet}'[suppress feedback messages]' \ + '--recurse-submodules=-[control recursive updating of submodules]::checkout:__git_commits' \ + '(-q --quiet --progress)--no-progress[suppress progress reporting]' \ + '--progress[force progress reporting]' \ + '(-m --merge --discard-changes --orphan)'{-m,--merge}'[perform a 3-way merge with the new branch]' \ + '(--discard-changes --orphan)--conflict=[change how conflicting hunks are presented]:conflict style [merge]:(merge diff3)' \ + '(-d --detach -c --create -C --force-create --ignore-other-worktrees --orphan --guess --no-guess 1)'{-d,--detach}'[detach HEAD at named commit]' \ + '(-t --track --no-track --guess --orphan 1)'{-t,--track}'[set upstream info for new branch]' \ + "(-t --track --guess --orphan 1)--no-track[don't set upstream info for a new branch]" \ + '(-c --create -C --force-create -d --detach --ignore-other-worktrees -m --merge --conflict -t --track --guess --no-track -t --track)--orphan[create new unparented branch]: :__git_branch_names' \ + '!--overwrite-ignore' \ + "(-c --create -C --force-create -d --detach --orphan)--ignore-other-worktrees[don't check if another worktree is holding the given ref]" \ + '1: :->branches' \ + '2:start point:->start-points' && ret=0 + + case $state in + branches) + if [[ -n ${opt_args[(i)--guess]} ]]; then + # --guess is the default but if it has been explicitly specified, + # we'll only complete remote branches + __git_remote_branch_names_noprefix && ret=0 + else + _alternative \ + 'branches::__git_branch_names' \ + 'remote-branch-names-noprefix::__git_remote_branch_names_noprefix' && ret=0 + fi + ;; + start-points) + if [[ -n ${opt_args[(I)-t|--track|--no-track]} ]]; then + # with an explicit --track, stick to remote branches + # same for --no-track because it'd be meaningless with anything else + __git_heads_remote && ret=0 + else + __git_revisions && ret=0 + fi + ;; + esac + + return ret +} + (( $+functions[_git-tag] )) || _git-tag () { - _arguments \ + _arguments -s -S $endopt \ - creation \ '(-a --annotate -s --sign -u --local-user)'{-a,--annotate}'[create an unsigned, annotated tag]' \ '(-e --edit)'{-e,--edit}'[force edit of tag message]' \ @@ -2025,7 +2140,7 @@ _git-tag () { '(-a --annotate -s --sign)'{-u+,--local-user=}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \ '(-f --force)'{-f,--force}'[replace existing tag]' \ '--create-reflog[create a reflog]' \ - '--cleanup=[cleanup message]:mode:((verbatim\:"no cleanup" whitespace\:"remove leading and trailing whitespace" strip\:"remove leading and trailing whitespace and comments"))' \ + '--cleanup=[specify how to strip spaces and #comments from message]:mode:_git_cleanup_modes' \ '(-m --message -F --file)'{-F+,--file=}'[read tag message from given file]:message file:_files' \ '(-m --message -F --file)'{-m+,--message=}'[specify tag message]:message' \ ': :__git_tags' \ @@ -2036,7 +2151,7 @@ _git-tag () { - listing \ '-n+[limit line output of annotation]: :__git_guard_number "limit"' \ '(-l --list)'{-l,--list}'[list tags matching pattern]' \ - '(--no-column)--column=-[display tag listing in columns]::column.tag option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \ + '(--no-column)--column=-[display tag listing in columns]:: :_git_column_layouts' \ '(--column)--no-column[do not display in columns]' \ '*--contains=[only list tags that contain the specified commit]: :__git_commits' \ "*--no-contains=[only list tags that don't contain the specified commit]: :__git_commits" \ @@ -2087,7 +2202,7 @@ _git-worktree() { else args=( ':commit:__git_commits' ) fi - _arguments -S \ + _arguments -S $endopt \ '(-f --force)'{-f,--force}'[checkout branch even if already checked out in another worktree]' \ '(-B --detach)-b+[create a new branch]: :__git_branch_names' \ '(-b --detach)-B+[create or reset a branch]: :__git_branch_names' \ @@ -2097,16 +2212,16 @@ _git-worktree() { ':path:_directories' $args && ret=0 ;; (prune) - _arguments -S \ + _arguments -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]:time' && ret=0 ;; (list) - _arguments -S '--porcelain[machine-readable output]' && ret=0 + _arguments -S $endopt '--porcelain[machine-readable output]' && ret=0 ;; (lock) - _arguments -C -S '--reason=[specify reason for locking]:reason' ': :->worktrees' && ret=0 + _arguments -C -S $endopt '--reason=[specify reason for locking]:reason' ': :->worktrees' && ret=0 ;; (move) _arguments -C \ @@ -2114,7 +2229,7 @@ _git-worktree() { ':location:_directories' && ret=0 ;; (remove) - _arguments -C -S '--force[remove working trees that are not clean or that have submodules]' \ + _arguments -C -S $endopt '--force[remove working trees that are not clean or that have submodules]' \ ': :->worktrees' && ret=0 ;; (unlock) @@ -2167,12 +2282,13 @@ _git-config () { value_arg=': :->value' fi - _arguments -C -S -s \ - '( --system --local -f --file --blob)--global[use user-global config file]' \ - '(--global --local -f --file --blob)--system[use system-wide config file]' \ - '(--global --system -f --file --blob)--local[use local config file]' \ - '(--global --system --local --blob)'{-f+,--file=}'[use given config file]:config file:_files' \ - '(--global --system --local -f --file)--blob=[read config from given blob object]:blob:__git_blobs' \ + _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 --path --expiry-date)'{-t+,--type=}'[ensure that incoming and outgoing values are canonicalize-able as the given type]:type:(bool int bool-or-int path expiry-date color)' \ '(-t --type --int --bool-or-int --path --expiry-date)--bool[setting is a boolean]' \ '(-t --type --bool --bool-or-int --path --expiry-date)--int[setting is an integer]' \ @@ -2241,32 +2357,46 @@ __git_config_option-or-value () { # TODO: .path options should take absolute paths. declare -a git_options git_options=( + advice.fetchShowForcedUpdates:'show advice when git-fetch takes time to calculate forced updates::->bool:true' advice.pushNonFastForward:'show advice when git push refuses non-fast-forward refs::->bool:true' advice.pushUpdateRejected:'combined setting for advice.push*::->bool:true' advice.pushNonFFCurrent:'show advice when git push fails due to a non-fast-forward update to the current branch::->bool:true' - advice.pushNonFFDefault:'show advice to set push.default to "upstream" or "current" after running git-push::->bool:true' advice.pushNonFFMatching:'show advice when running git-push and pushed matching refs explicitly::->bool:true' advice.pushAlreadyExists:'show advice when git-push rejects an update that does not qualify for fast-forwarding::->bool:true' advice.pushFetchFirst:'show advice when git-push rejects an update that tries to overwrite a remote ref that points at unknown object::->bool:true' advice.pushNeedsForce:'show advice when git-push rejects an update that tries to overwrite a remote ref that points a non-commitish::->bool:true' + advice.pushUnqualifiedRefname:'show advice when git-push gives up trying to guess a remote ref::->bool:true' advice.statusHints:'show advice in output of git status::->bool:true' advice.statusUoption:'show advice to consider using the "-u" option to git-status when it takes more than 2 seconds::->bool:true' advice.commitBeforeMerge:'show advice when git merge refuses to merge::->bool:true' + advice.resetQuiet:'show advice to consider using the --quiet option to git-reset::->bool:true' advice.resolveConflict:'show advice when conflict prevents operation from being performed::->bool:true' + advice.sequencerInUse:'show advice shown when a sequencer command is already in progress::->bool:true' advice.implicitIdentity:'show advice when identity is guessed from system settings::->bool:true' advice.detachedHead:'show advice when entering detached-HEAD state::->bool:true' + advice.checkoutAmbiguousRemoteBranchName:'show advice when argument for a remote tracking branch is ambiguous::->bool:true' advice.amWorkDir:'show the location of the patch file when git-am fails to apply it::->bool:true' advice.rmHints:'show directions in case of failure in the output of git-rm(1)::->bool:true' + advice.addEmbeddedRepo:"show advice on what to do when you’ve accidentally added one git repo inside of another::->bool:true" + advice.ignoredHook:'show advice if a hook is ignored because the hook is not set as executable::->bool:true' + advice.waitingForEditor:'print a message to the terminal whenever Git is waiting for editor input from the user::->bool:true' + advice.nestedTag:'show advice if a user attempts to recursively tag a tag object::->bool:true' + author.email:'email address used for author in commits::_email_addresses -c' + author.name:'full name used for author in commits:name:->string' blame.blankboundary:'show blank SHA-1 for boundary commits::->bool:false' + blame.coloring:'determine the coloring scheme to be applied to blame output:scheme [none]:->string' blame.showroot:'show root commits as normal commits::->bool:false' + blame.ignoreRevsFile:'ignore revisions listed in the file:file:_files' blame.date:'date format to use in output::__git_date_formats:iso' 'branch.*.description:branch description:branch description:->string' cvsexportcommit.cvsdir:'the default location of the CVS checkout to use for the export:cvs export dir:_directories' column.ui:'specify whether supported commands should output in columns.::->column:never' - column.branch:'specify whether to output branch listing in git branch in columns::->column:never' - column.clean:'specify the layout when listing items in git clean -i::->column:never' - column.status:'specify whether to output untracked files in git status in columns::->column:never' - column.tag:'specify whether to output tag listing in git tag in columns::->column:never' + column.branch:'specify whether to output branch listing in git branch in columns::_git_column_layouts:never' + column.clean:'specify the layout when listing items in git clean -i::_git_column_layouts:never' + column.status:'specify whether to output untracked files in git status in columns::_git_column_layouts:never' + column.tag:'specify whether to output tag listing in git tag in columns::_git_column_layouts:never' + committer.email:'email address used for committer in commits::_email_addresses -c' + committer.name:'full name used for committer in commits:name:->string' core.fileMode:'track changes to the executable bit of files::->bool:true' core.attributesfile:'look into this file for attributes in addition to .gitattributes:additional attributes file:_files' core.abbrev:'set the length object names are abbreviated to:length:->int:7' @@ -2379,7 +2509,7 @@ __git_config_option-or-value () { color.status.untracked:'color of files not currently being tracked::->color' color.status.nobranch:'color of no-branch warning::->color' color.ui:'color output of capable git commands::->color-bool:auto' - commit.cleanup:'default --cleanup option::->commit.cleanup:default' + commit.cleanup:'default --cleanup option::_git_cleanup_modes' commit.gpgsign:'always GPG-sign commits::->bool:false' commit.status:'include status information in commit message template::->bool:true' commit.template:'template file for commit messages:template:_files' @@ -2409,10 +2539,14 @@ __git_config_option-or-value () { difftool.prompt:'prompt before each invocation of the diff tool::->bool:true' diff.wordRegex:'regex used to determine what a word is when performing word-by-word diff:regular expression:->string' diff.guitool:'diff tool with gui to use::__git_difftools' + feature.experimental:'enable config options that are new to Git::->bool:false' + feature.manyFiles:'enable config options that optimize for repos with many files::->bool:false' + fetch.parallel:'specify maximum number of fetch operations to run in parallel:number:->int' fetch.prune:'remove any remote tracking branches that no longer exist remotely::->bool:false' fetch.unpackLimit:'maximum number of objects to unpack when fetching:unpack limit:->int' fetch.recurseSubmodules:'recurse into submodules (as needed) when fetching::->fetch.recurseSubmodules:on-demand' fetch.fsckObjects:'check all fetched objects::->bool:false' + fetch.writeCommitGraph:'write a commit-graph after every git fetch command that downloads a pack-file from a remote::->bool:false' 'filter.*.clean:command which is used to convert the content of a worktree file to a blob upon checkin::_cmdstring' 'filter.*.smudge:command which is used to convert the content of a blob object to a worktree file upon checkout::_cmdstring' format.attach:'use multipart/mixed attachments::->bool:false' @@ -2629,6 +2763,8 @@ __git_config_option-or-value () { receive.updateserverinfo:'run git update-server-info after receiving data::->bool:false' 'remote.pushdefault:URL of a remote repository to pushto::__git_any_repositories' 'remote.*.url:URL of a remote repository::__git_any_repositories' + 'remote.*.partialclonefilter:filter applied when fetching from this promisor remote:filter:->string' + 'remote.*.promisor:use this remote to fetch promisor objects::->bool:false' 'remote.*.pushurl:push URL of a remote repository::__git_any_repositories' 'remote.*.proxy:URL of proxy to use for a remote repository::_urls' 'remote.*.prune:remove any remote tracking branches that no longer exist remotely::->bool:false' @@ -2754,9 +2890,16 @@ __git_config_option-or-value () { declare -a git_present_options # 'present' is an adjective git_present_options=( ${${${(0)"$(_call_program gettable-options git config -z --list)"}%%$'\n'*}//:/\\:} + + # Remove the "'git help config' for more information" line. + # + # Change literal 'foo.<bar>.baz' to 'foo.*.baz'. With that, completing + # at foo.lorem.<TAB> will offer foo.lorem.baz. + ${${${(f)"$(_call_program all-known-options "git help -c")"}:#* *}/<*>/*} ) - # Add to $git_options options from the config file that aren't already in $git_options. + # Add to $git_options options from the config file, and from 'git help -c', + # that aren't already in $git_options. () { local -a -U sections_that_permit_arbitrary_subsection_names=( alias @@ -2936,12 +3079,15 @@ __git_config_option-or-value () { else sections=( advice:'options controlling advice' + author:'options controlling author identity' + committer:'options controlling committer identity' core:'options controlling git core' credential:'credential options' add:'git add options' alias:'command aliases' am:'git am options' apply:'git apply options' + blame:'git blame options' branch:'branch options' browser:'browser options' clean:'git clean options' @@ -2950,6 +3096,7 @@ __git_config_option-or-value () { commit:'git commit options' diff:'diff options' difftool:'difftools' + feature:'options modifying defaults for a group of other settings' fetch:'git fetch options' format:'format options' gc:'git gc options' @@ -3129,22 +3276,6 @@ __git_config_option-or-value () { always:"always $parts[2]" \ {auto,true,yes,on}:$parts[2] && ret=0 ;; - (column) - __git_config_values -- "$current" "$parts[5]" \ - always:'always show in columns' \ - never:'never show in columns' \ - auto:'show in columns if the output is to the terminal' \ - column:'fill columns before rows (implies "always")' \ - row:'fill rows before columns (implies "always")' \ - plain:'show in one column (implies "always")' && ret=0 - ;; - (commit.cleanup) - __git_config_values -- "$current" "$parts[5]" \ - strip:'remove both whitespace and commentary lines' \ - whitespace:'remove leading and trailing whitespace lines' \ - verbatim:'no not change the commit message at all' \ - default:'act as '\''strip'\'' if the message is to be edited and as '\''whitespace'\'' otherwise' && ret=0 - ;; (compression) __git_compression_levels && ret=0 ;; @@ -3411,7 +3542,7 @@ __git_config_option-or-value () { (( $+functions[_git-fast-export] )) || _git-fast-export () { # TODO: * should be git-rev-arg and git-rev-list arguments. - _arguments -S -s \ + _arguments -S -s $endopt \ '--progress=[insert progress statements]: :__git_guard_number interval' \ '--signed-tags=[specify how to handle signed tags]:action:((verbatim\:"silently export" warn\:"export, but warn" @@ -3423,9 +3554,10 @@ _git-fast-export () { rewrite\:"tag ancestor commit"))' \ '-M-[detect moving lines in the file as well]: : :__git_guard_number "number of characters"' \ '-C-[detect copies as well as renames with given scope]: :__git_guard_number size' \ + '--reencode=[specify how to handle encoding header in commit objects]:mode [abort]:(yes no abort)' \ '--export-marks=[dump internal marks table when complete]: :_files' \ '--import-marks=[load marks before processing input]: :_files' \ - '--import-marks-if-exists=[silently skip if files does not exist]: :_files' \ + '--import-marks-if-exists=[load marks from file if it exists]: :_files' \ '--fake-missing-tagger=[fake a tagger when tags lack them]' \ '--use-done-feature[start with a "feature done" stanza, and terminate with a "done" command]' \ '--no-data[do not output blocb objects, instead referring to them via their SHA-1 hash]' \ @@ -3433,12 +3565,15 @@ _git-fast-export () { '(--get --get-all)--name-only[show variable names only]' \ '*--refspec=[apply refspec to exported refs]:refspec' \ '--anonymize[anonymize output]' \ + '--reference-excluded-parents[reference parents not in fast-export stream by object id]' \ + '--show-original-ids[show original object ids of blobs/commits]' \ + '--mark-tags[label tags with mark ids]' \ '*: :__git_commit_ranges' } (( $+functions[_git-fast-import] )) || _git-fast-import () { - _arguments -S -A '-*' \ + _arguments -S -A '-*' $endopt \ '--cat-blob-fd=-[write responses to cat-blob and ls queries to <fd> instead of stdout]:file descriptor' \ '--date-format=-[type of dates used in input]:format:((raw\:"native Git format" rfc2822\:"standard email format from RFC 2822" @@ -3464,7 +3599,7 @@ _git-filter-branch () { # TODO: --original should take subdirectory under .git named refs/* or some # such. # TODO: * should be git-rev-arg and git-rev-list arguments. - _arguments -S -A '-*' \ + _arguments -S -A '-*' $endopt \ '--setup[specify one time setup command]: :_cmdstring' \ '--env-filter[filter for modifying environment in which commit will be performed]: :_cmdstring' \ '--tree-filter[filter for rewriting tree and its contents]: :_cmdstring' \ @@ -3473,7 +3608,7 @@ _git-filter-branch () { '--msg-filter[filter for rewriting commit messages]: :_cmdstring' \ '--commit-filter[filter for rewriting commit]: :_cmdstring' \ '--tag-name-filter[filter for rewriting tag names]: :_cmdstring' \ - '--subdirectory-filter[only look at histor that touches given directory]: :_directories' \ + '--subdirectory-filter[only look at history that touches given directory]: :_directories' \ '--prune-empty[ignore empty generated commits]' \ '--original[namespace where original commits will be stored]:namespace:_directories' \ '-d[temporary directory used for rewriting]: :_directories' \ @@ -3490,13 +3625,15 @@ _git-mergetool () { '--tool-help[print a list of merge tools that may be used with "--tool"]' \ '(-y --no-prompt --prompt)'{-y,--no-prompt}'[do not prompt before invocation of merge resolution program]' \ '(-y --no-prompt)--prompt[prompt before invocation of merge resolution program]' \ + '(-g --gui)'{-g,--gui}'[use merge.guitool variable instead of merge.tool]' \ + '!(-g --gui)--no-gui' \ '-O-[process files in the order specified in file]:order file:_files' \ '*:conflicted file:_files' } (( $+functions[_git-pack-refs] )) || _git-pack-refs () { - _arguments \ + _arguments -S $endopt \ '( --no-all)--all[pack all refs]' \ '(--all )--no-all[do not pack all refs]' \ '( --no-prune)--prune[remove loose refs after packing them]' \ @@ -3505,7 +3642,7 @@ _git-pack-refs () { (( $+functions[_git-prune] )) || _git-prune () { - _arguments -S \ + _arguments -s -S $endopt \ '(-n --dry-run)'{-n,--dry-run}'[do not remove anything; just report what would be removed]' \ '(-v --verbose)'{-v,--verbose}'[report all removed objects]' \ '--progress[show progress]' \ @@ -3631,7 +3768,7 @@ _git-remote () { case $line[1] in (add) # TODO: -t and --track should really list branches at url. - _arguments -S -s \ + _arguments -S -s $endopt \ '(-f --fetch)'{-f,--fetch}'[run git fetch on new remote after it has been created]' \ '( --no-tags)--tags[tell git fetch to import every tag from remote repository]' \ '(--tags )--no-tags[tell git fetch to not import every tag from remote repository]' \ @@ -3642,7 +3779,7 @@ _git-remote () { ':repository:__git_repositories_or_urls' && ret=0 ;; (get-url) - _arguments -S -s \ + _arguments -S -s $endopt \ '--push[list push URL instead of fetch URL]' \ '--all[list all URLs for the remote]' \ ': :__git_remotes' && ret=0 @@ -3654,7 +3791,7 @@ _git-remote () { ;; (set-head) # TODO: Second argument should be a branch at url for remote. - _arguments -S -s \ + _arguments -S -s $endopt \ '(- 2)'{-d,--delete}'[delete default branch]' \ '(- 2)'{-a,--auto}'[determine default branch automatically]' \ ': :__git_remotes' \ @@ -3662,13 +3799,13 @@ _git-remote () { ;; (set-branches) # TODO: Branches should be at url. - _arguments -S -s \ + _arguments -S -s $endopt \ '--add[add branches to those already defined]' \ ': :__git_remotes' \ '*: :__git_branch_names' && ret=0 ;; (set-url) - _arguments -S \ + _arguments -S $endopt \ '--push[manipulate push URLs instead of fetch URLs]' \ '(3)--add[add URL to those already defined]' \ '(2)--delete[delete all matching URLs]' \ @@ -3677,17 +3814,17 @@ _git-remote () { '3:old url: __git_current_remote_urls ${(k)opt_args[--push]} $line[1]' && ret=0 ;; (show) - _arguments -S \ + _arguments -S $endopt \ '-n[do not contact the remote for a list of branches]' \ '*: :__git_remotes' && ret=0 ;; (prune) - _arguments -S -s \ + _arguments -S -s $endopt \ '(-n --dry-run)'{-n,--dry-run}'[do not actually prune, only list what would be done]' \ '*: :__git_remotes' && ret=0 ;; (update) - _arguments -S -s \ + _arguments -S -s $endopt \ '(-p --prune)'{-p,--prune}'[prune all updated remotes]' \ ': :__git_remote-groups' && ret=0 ;; @@ -3715,6 +3852,7 @@ _git-repack () { '(-q --quiet)'{-q,--quiet}'[pass -q option to git pack-objects]' \ '(-l --local)'{-l,--local}'[pass --local option to git pack-objects]' \ '(-b --write-bitmap-index)'{-b,--write-bitmap-index}'[write a bitmap index]' \ + '(-i --delta-islands)'{-i,--delta-islands}'[pass --delta-islands to git-pack-objects]' \ "--unpack-unreachable=[with -A, don't loosen objects older than specified time]:time" \ '(-k --keep-unreachable)'{-k,--keep-unreachable}'[with -a, repack unreachable objects]' \ '--window=[number of objects to consider when doing delta compression]:number of objects' \ @@ -3728,7 +3866,7 @@ _git-repack () { (( $+functions[_git-replace] )) || _git-replace () { - _arguments -S -s \ + _arguments -S -s $endopt \ '(-d --delete -l --list -g --graft *)'{-f,--force}'[overwrite existing replace ref]' \ "(-d --delete -l --list -g --graft 2 *)--raw[don't pretty-print contents for --edit]" \ '(-d --delete -e --edit -g --graft --raw)--format=[use specified format]:format:(short medium long)' \ @@ -3759,7 +3897,7 @@ _git-blame () { __git_setup_revision_options # TODO: Not sure about __git_cached_files. - _arguments -C -S -s \ + _arguments -C -S -s $endopt \ '-b[show blank SHA-1 for boundary commits]' \ '--root[do not treat root commits as boundaries]' \ '--show-stats[include additional statistics at the end of blame output]' \ @@ -3781,6 +3919,8 @@ _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]' \ + '--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]' \ '(--color-lines)--color-by-age[color lines by age]' \ '--indent-heuristic[use indent-based heuristic to improve diffs]' \ @@ -3809,7 +3949,7 @@ _git-blame () { (( $+functions[_git-cherry] )) || _git-cherry () { # TODO: --abbrev is undocumented. - _arguments \ + _arguments -S $endopt \ '(-v --verbose)'{-v,--verbose}'[output additional information]' \ '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ ':upstream commit:__git_commits' \ @@ -3819,7 +3959,7 @@ _git-cherry () { (( $+functions[_git-count-objects] )) || _git-count-objects () { - _arguments \ + _arguments -s -S $endopt \ '(-v --verbose)'{-v,--verbose}'[also report number of in-pack objects and objects that can be removed]' \ {-H,--human-readable}'[print sizes in human readable format]' } @@ -3828,7 +3968,7 @@ _git-count-objects () { _git-difftool () { # TODO: Is this fine, or do we need to modify the context or similar? _git-diff \ - '(-d --dir-diff)'{-d,--dir-diff}'[diff a whole tree by preparing a temporary copy]' \ + '(-d --dir-diff --no-index)'{-d,--dir-diff}'[diff a whole tree by preparing a temporary copy]' \ '(-y --no-prompt --prompt)'{-y,--no-prompt}'[do not prompt before invocation of diff tool]' \ '(-y --no-prompt)--prompt[prompt before invocation of diff tool]' \ '(-t --tool -x --extcmd)'{-t,--tool=-}'[merge resolution program to use]: :__git_difftools' \ @@ -3842,8 +3982,7 @@ _git-difftool () { (( $+functions[_git-fsck] )) || _git-fsck () { - # TODO: -v is undocumented. - _arguments -S -s \ + _arguments -S -s $endopt \ '--unreachable[show objects that are unreferenced in the object database]' \ '(--dangling --no-dangling)--dangling[print dangling objects (default)]' \ '(--dangling --no-dangling)--no-dangling[do not print dangling objects]' \ @@ -3876,7 +4015,7 @@ _git-help () { '(-a --all -g --guides -c --config -i --info -m --man)'{-w,--web}'[display manual for the command in HTML format]' \ '(-g --guides -c --config -i --info -m --man -w --web)'{-g,--guides}'[prints a list of useful guides on the standard output]' \ '(-v --verbose)'{-v,--verbose}'[print command descriptions]' \ - ': : _alternative commands:command:_git_commands "guides:git guides:(attributes glossary ignore modules revisions tutorial workflows)"' + ': : _alternative commands:command:_git_commands "guides:git guides:(attributes cli core-tutorial cvs-migration diffcore everyday glossary hooks ignore modules namespaces repository-layout revisions tutorial tutorial-2 workflows)"' } (( $+functions[_git-instaweb] )) || @@ -3884,7 +4023,7 @@ _git-instaweb () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -C -S -s \ + _arguments -C -S -s $endopt \ '(-l --local)'{-l,--local}'[bind the web server to 127.0.0.1]' \ '(-d --httpd)'{-d,--httpd=}'[HTTP-daemon command-line that will be executed]:command line' \ '(-m --module-path)'{-m,--module-path=}'[module path for the Apache HTTP-daemon]:module path:_directories' \ @@ -3925,7 +4064,7 @@ _git-rerere () { declare -A opt_args # TODO: --rerere-autoupdate is undocumented. - _arguments -C -S -s \ + _arguments -C -S -s $endopt \ '--rerere-autoupdate[register clean resolutions in index]' \ ': :->command' && ret=0 @@ -4024,7 +4163,7 @@ _git-show-branch () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -C -S -s -A '-*' \ + _arguments -C -S -s $endopt \ '(--more --merge-base --independent)--list[do not show any ancestry (--more=-1)]' \ - branches \ '(-r --remotes -a --all)'{-r,--remotes}'[show remote-tracking branches]' \ @@ -4063,7 +4202,7 @@ _git-show-branch () { (( $+functions[_git-verify-commit] )) || _git-verify-commit () { - _arguments -S -s \ + _arguments -S -s $endopt \ '(-v --verbose)'{-v,--verbose}'[print contents of the commit object before validating it]' \ '--raw[print raw gpg status output]' \ '*: :__git_commits' @@ -4071,7 +4210,7 @@ _git-verify-commit () { (( $+functions[_git-verify-tag] )) || _git-verify-tag () { - _arguments -S -s \ + _arguments -S -s $endopt \ '(-v --verbose)'{-v,--verbose}'[print contents of the tag object before validating it]' \ '--raw[print raw gpg status output]' \ '--format=[specify format to use for the output]:format:__git_format_ref' \ @@ -4083,7 +4222,7 @@ _git-whatchanged () { local -a revision_options __git_setup_revision_options - _arguments -S \ + _arguments -s -S $endopt \ $revision_options \ '1:: :__git_commits' \ '*: :__git_cached_files' @@ -4169,7 +4308,7 @@ _git-cvsserver () { (( $+functions[_git-imap-send] )) || _git-imap-send () { - _arguments \ + _arguments -S $endopt \ '--curl[use libcurl to communicate with the IMAP server]' \ - '(out)' \ {-v,--verbose}'[be more verbose]' \ @@ -4178,16 +4317,17 @@ _git-imap-send () { (( $+functions[_git-quiltimport] )) || _git-quiltimport () { - _arguments -S \ + _arguments -S $endopt \ '(-n --dry-run)'{-n,--dry-run}'[check patches and warn if they cannot be imported]' \ '--author[default author name and email address to use for patches]: :_email_addresses' \ '--patches[set directory containing patches]:patch directory:_directories' \ - '--series[specify quilt series file]:series file:_files' + '--series[specify quilt series file]:series file:_files' \ + '--keep-non-patch[pass -b to git mailinfo]' } (( $+functions[_git-request-pull] )) || _git-request-pull () { - _arguments -S \ + _arguments -S $endopt \ '-p[display patch text]' \ ':start commit:__git_commits' \ ': :_urls' \ @@ -4196,7 +4336,7 @@ _git-request-pull () { (( $+functions[_git-send-email] )) || _git-send-email () { - _arguments -S \ + _arguments -S $endopt \ '--annotate[review and edit each patch before sending it]' \ '--bcc=[Bcc: value for each email]: :_email_addresses' \ '--cc=[starting Cc: value for each email]: :_email_addresses' \ @@ -4218,10 +4358,11 @@ _git-send-email () { '--smtp-pass=[specify password to use for SMTP-AUTH]::password' \ '--smtp-server=[specify SMTP server to connect to, or sendmail command]: : __git_sendmail_smtpserver_values' \ '--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]:SMPT server option' \ + '--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-user=[specify user to use for SMTP-AUTH]:smtp user:_users' \ - '--smtp-auth=[specify allowed AUTH mechanisms]:space-separated list of mechanisms' \ + '(--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"))' \ '--batch-size=[specify maximum number of messages per connection]:number' \ '--relogin-delay=[specify delay between successive logins]:delay (seconds)' \ @@ -4552,7 +4693,7 @@ _git-apply () { local -a apply_options __git_setup_apply_options - _arguments -S -s \ + _arguments -S -s $endopt \ $apply_options \ '(--index --cached --reject)'{-3,--3way}'[fall back on 3-way merge if patch fails]' \ '--stat[output diffstat for input (turns off "apply")]' \ @@ -4582,7 +4723,7 @@ _git-checkout-index () { z_opt='-z[paths are separated with NUL character when reading from standard input]' fi - _arguments -S -s \ + _arguments -S -s $endopt \ '(-u --index)'{-u,--index}'[update stat information in index]' \ '(-q --quiet)'{-q,--quiet}'[no warning for existing files and files not in index]' \ '(-f --force)'{-f,--force}'[force overwrite of existing files]' \ @@ -4596,9 +4737,35 @@ _git-checkout-index () { '*: :__git_cached_files' } +(( $+functions[_git-commit-graph] )) || +_git-commit-graph() { + local -a args progress + progress=( "--no-progress[don't show progress]" ) + if [[ $words[2] = write ]]; then + args=( $progress + '(--split --size-multiple --max-commits --expire-time)--append[include all commits present in existing commit-graph file]' + '(--append)--split[write the commit-graph as a chain of multiple commit-graph files]' + '(--stdin-packs --stdin-commits)--reachable[walk commits starting at all refs]' + '(--reachable --stdin-commits)--stdin-packs[only walk objects in pack-indexes read from input]' + '(--reachable --stdin-packs)--stdin-commits[walk commits starting at commits read from input]' + '(--append)--size-multiple=:commits [2]' + '(--append)--max-commits=:commits' + '(--append)--expire-time=:date/time:__git_datetimes' + ) + elif [[ $words[2] = verify ]]; then + args=( $progress + '--shallow[only check the tip commit-graph file in a chain of split commit-graphs]' + ) + fi + + _arguments -S $endopt $args \ + '--object-dir=[specify location of packfiles and commit-graph file]:directory:_directories' \ + '(-h)1:verb:(read verify write)' +} + (( $+functions[_git-commit-tree] )) || _git-commit-tree () { - _arguments \ + _arguments -S $endopt \ '-h[display usage]' \ '*-p+[specify parent commit]:parent commit:__git_objects' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ @@ -4610,7 +4777,7 @@ _git-commit-tree () { (( $+functions[_git-hash-object] )) || _git-hash-object () { - _arguments -S \ + _arguments -s -S $endopt \ '-t[type of object to create]:object type:((blob\:"a blob of data" commit\:"a tree with parent commits" tag\:"a symbolic name for another object" @@ -4705,6 +4872,14 @@ _git-mktree () { '--batch[allow creation of more than one tree]' } +(( $+functions[_git-multi-pack-index] )) || +_git-multi-pack-index() { + _arguments \ + '--object-dir=[specify location of git objects]:directory:_directories' \ + '--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)' +} + (( $+functions[_git-pack-objects] )) || _git-pack-objects () { local thin_opt= @@ -4740,6 +4915,7 @@ _git-pack-objects () { '(--unpack-unreachable)--keep-unreachable[keep unreachable ]' \ '--pack-loose-unreachable[pack loose unreachable objects]' \ '(--keep-unreachable)--unpack-unreachable=-[unpack unreachable objects newer than specified time]::time' \ + '--sparse[use sparse reachability algorithm]' \ '--include-tag[include tag objects that refer to objects to be packed]' \ $thin_opt \ '--shallow[create packs suitable for shallow fetches]' \ @@ -4752,6 +4928,7 @@ _git-pack-objects () { '--filter=[omit certain objects from pack file]:filter:_git_rev-list_filters' \ '--missing=[specify how missing objects are handled]:action:(error allow-any allow-promisor print)' \ "--exclude-promisor-objects[don't pack objects in promisor packfiles]" \ + '--delta-islands[respect islands during delta compression]' \ ':base-name:_files' } @@ -4800,6 +4977,7 @@ _git-read-tree () { '--no-sparse-checkout[display sparse checkout support]' \ '--debug-unpack[debug unpack-trees]' \ '--recurse-submodules=-[control recursive updating of submodules]::checkout:__git_commits' \ + '(-q --quiet)'{-q,--quiet}'[suppress feedback messages]' \ '--empty[instead of reading tree object(s) into the index, just empty it]' \ '1:first tree-ish to be read/merged:__git_tree_ishs' \ '2::second tree-ish to be read/merged:__git_tree_ishs' \ @@ -4845,7 +5023,7 @@ _git-update-index () { '--ignore-missing[ignore missing files when refreshing the index]' \ '*--cacheinfo[insert information directly into the cache]: :_guard "[0-7]#" "octal file mode": :_guard "[[\:xdigit\:]]#" "object id": :_files' \ '(: -)--index-info[read index information from stdin]' \ - '--chmod=-[set execute permissions on updated files]:permission:((-x\:executable +x\:"not executable"))' \ + '--chmod=-[set execute permissions on updated files]:permission:((+x\:executable -x\:"not executable"))' \ '( --no-assume-unchanged)--assume-unchanged[set "assume unchanged" bit for given paths]' \ '(--assume-unchanged )--no-assume-unchanged[unset "assume unchanged" bit for given paths]' \ '(-q --unmerged --ignore-missing --refresh)--really-refresh[refresh index, unconditionally checking stat information]' \ @@ -4970,7 +5148,7 @@ _git-diff-tree () { _arguments -C -S -s \ $revision_options \ '-r[recurse into subdirectories]' \ - '(-r )-t[disply tree objects in diff output]' \ + '(-r )-t[display tree objects in diff output]' \ '--root[display root diff]' \ '-m[do not ignore merges]' \ '-s[do not show differences]' \ @@ -4978,6 +5156,7 @@ _git-diff-tree () { '--no-commit-id[do not display commit IDs]' \ '(-c --cc)-c[show differences from each of parents to merge result]' \ '(-c --cc)--cc[how differences from each of parents and omit differences from only one parent]' \ + '--combined-all-paths[show name of file in all parents for combined diffs]' \ '--always[always show commit itself and commit log message]' \ ': :__git_tree_ishs' \ '*:: :->files' && ret=0 @@ -5041,7 +5220,7 @@ _git-ls-files () { # TODO: --resolve-undo is undocumented. # TODO: Replace _files with something more intelligent based on seen options. # TODO: Apply excludes like we do for git-clean. - _arguments -S -s \ + _arguments -S -s $endopt \ '(-c --cached)'{-c,--cached}'[show cached files in output]' \ '(-d --deleted)'{-d,--deleted}'[show deleted files in output]' \ '(-m --modified)'{-m,--modified}'[show modified files in output]' \ @@ -5072,7 +5251,7 @@ _git-ls-files () { (( $+functions[_git-ls-remote] )) || _git-ls-remote () { # TODO: repository needs fixing - _arguments \ + _arguments -S -s $endopt \ '(-q --quiet)'{-q,--quiet}"[don't print remote URL]" \ '--upload-pack=[specify path to git-upload-pack on remote side]:remote path' \ '(-h --heads)'{-h,--heads}'[show only refs under refs/heads]' \ @@ -5092,7 +5271,7 @@ _git-ls-tree () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -C -S -s \ + _arguments -C -S -s $endopt \ '(-t)-d[do not show children of given tree (implies -t)]' \ '-r[recurse into subdirectories]' \ '-t[show tree entries even when going to recurse them]' \ @@ -5116,7 +5295,7 @@ _git-ls-tree () { (( $+functions[_git-merge-base] )) || _git-merge-base () { - _arguments -S -s \ + _arguments -S -s $endopt \ '(-a --all)'{-a,--all}'[display all common ancestors]' \ '--octopus[compute best common ancestors of all supplied commits]' \ '--is-ancestor[tell if A is ancestor of B (by exit status)]' \ @@ -5128,7 +5307,7 @@ _git-merge-base () { (( $+functions[_git-name-rev] )) || _git-name-rev () { - _arguments -S \ + _arguments -S $endopt \ '--tags[only use tags to name commits]' \ '*--refs=[only use refs matching given pattern]: :_guard "?#" "shell pattern"' \ '--no-refs[clear any previous ref patterns given]' \ @@ -5158,7 +5337,7 @@ _git-rev-list () { declare -a revision_options __git_setup_revision_options - _arguments -C -S \ + _arguments -C -S $endopt \ $revision_options \ '--no-filter[turn off any previous --filter argument]' \ '--filter-print-omitted[print a list of objects omitted by --filter]' \ @@ -5168,6 +5347,8 @@ _git-rev-list () { '--use-bitmap-index[try to speed traversal using pack bitmap index if available]' \ '--progress=-[show progress reports as objects are considered]:header' \ '(--pretty --quiet)--header[display contents of commit in raw-format]' \ + "--no-object-names[don't print the names of the object IDs that are found]" \ + '!(--no-object-names)--object-names)' \ '--timestamp[print raw commit timestamp]' \ '( --bisect-vars --bisect-all)--bisect[show only middlemost commit object]' \ '(--bisect)--bisect-vars[same as --bisect, displaying shell-evalable code]' \ @@ -5196,7 +5377,7 @@ _git_rev-list_filters() { 'blob\:none[omit all blobs]' \ 'blob\:limit[omit blobs larger than specified size]:size' \ 'sparse\:oid[uses a sparse-checkout specification contained in the blob]:blob-ish' \ - 'sparse\:path[uses a sparse-checkout specification contained in path]:path:_directories' + 'tree\:0[omit blobs and trees with depth exceeding limit]' } (( $+functions[_git-show-index] )) || @@ -5206,7 +5387,7 @@ _git-show-index () { (( $+functions[_git-show-ref] )) || _git-show-ref () { - _arguments -S \ + _arguments -S $endopt \ - list \ '--head[show the HEAD reference, even if it would normally be filtered out]' \ '--tags[show only refs/tags]' \ @@ -5240,13 +5421,13 @@ _git-var () { (( $+functions[_git-verify-pack] )) || _git-verify-pack () { - _arguments -S -s \ + _arguments -S -s $endopt \ '(-v --verbose)'{-v,--verbose}'[show objects contained in pack]' \ '(-s --stat-only)'{-s,--stat-only}'[do not verify pack contents; only display histogram of delta chain length]' \ - '*:index file:_files -g "*.idx"' + '*:index file:_files -g "*.idx(-.)"' } -# Synching Repositories +# Syncing Repositories (( $+functions[_git-daemon] )) || _git-daemon () { @@ -5257,7 +5438,7 @@ _git-daemon () { '--strict-paths[match paths exactly]' \ '--access-hook=-[allow an external tool to accept or decline service]:path:_directories' \ '--base-path=-[remap all the path requests as relative to the given path]:path:_directories' \ - '--base-path-relaxed[allow lookup of base path witout prefix]' \ + '--base-path-relaxed[allow lookup of base path without prefix]' \ '--interpolated-path=-[dynamically construct alternate paths]:path:_directories' \ '--export-all[allow pulling from all repositories without verification]' \ '(--port --listen --user --group)--inetd[run server as an inetd service]' \ @@ -5316,7 +5497,7 @@ _git-send-pack () { {no,false}'\:never' if-asked'\:iff\ supported\ by\ server' ) - _arguments -A '-*' \ + _arguments -S -A '-*' $endopt \ '(-v --verbose)'{-v,--verbose}'[produce verbose output]' \ '(-q --quiet)'{-q,--quiet}'[be more quiet]' \ '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[specify path to git-receive-pack on remote side]:remote path' \ @@ -5342,13 +5523,13 @@ _git-send-pack () { (( $+functions[_git-update-server-info] )) || _git-update-server-info () { - _arguments -S -s \ + _arguments -S -s $endopt \ '(-f --force)'{-f,--force}'[update the info files from scratch]' } (( $+functions[_git-http-fetch] )) || _git-http-fetch () { - _arguments \ + _arguments -s \ '-c[fetch commit objects]' \ '-t[fetch trees associated with commit objects]' \ '-a[fetch all objects]' \ @@ -5379,7 +5560,7 @@ _git-http-push () { _git-receive-pack () { # TODO: --advertise-refs is undocumented. # TODO: --stateless-rpc is undocumented. - _arguments -A '-*' \ + _arguments -S -A '-*' $endopt \ '(-q --quiet)'{-q,--quiet}'[be quiet]' \ '--advertise-refs[undocumented]' \ '--stateless-rpc[undocumented]' \ @@ -5439,7 +5620,7 @@ _git-upload-archive () { (( $+functions[_git-upload-pack] )) || _git-upload-pack () { - _arguments -S -A '-*' \ + _arguments -S -A '-*' $endopt \ '--stateless-rpc[quit after a single request/response exchange]' \ '--advertise-refs[exit immediately after initial ref advertisement]' \ "--strict[don't try <directory>/.git/ if <directory> is not a git directory]" \ @@ -5510,7 +5691,7 @@ _git-check-ref-format () { (( $+functions[_git-fmt-merge-msg] )) || _git-fmt-merge-msg () { - _arguments -S -s \ + _arguments -S -s $endopt \ '( --no-log)--log=-[display one-line descriptions from actual commits being merged]::number of commits [20]' \ '(--log )--no-log[do not display one-line descriptions from actual commits being merged]' \ '(-m --message)'{-m+,--message=}'[use given message instead of branch names for first line in log message]:message' \ @@ -5562,8 +5743,8 @@ _git-patch-id () { (( $+functions[_git-stripspace] )) || _git-stripspace () { _arguments \ - '(-s --strip-comments)'{-s,--strip-comments}'[also strip lines starting with #]' \ - '(-c --comment-lines)'{-c,--comment-lines}'[prepend comment character and blank to each line]' + '(-s --strip-comments -c --comment-lines)'{-s,--strip-comments}'[also strip lines starting with #]' \ + '(-c --comment-lines -s --strip-comments)'{-c,--comment-lines}'[prepend comment character and blank to each line]' } # INTERNAL GIT COMPLETION FUNCTIONS @@ -5652,7 +5833,7 @@ __git_describe_branch () { local __c local -a __commits for __c in ${(P)__commits_in}; do - __commits+=("${__c}:${$(_call_program describe git log -1 --oneline $__c)//:/\\:}") + __commits+=("${__c}:${$(_call_program describe git rev-list -1 --oneline $__c)//:/\\:}") done _describe -t $__tag $__desc __commits "$@" else @@ -5688,7 +5869,7 @@ __git_ignore_line () { __git_ignore_line_inside_arguments () { declare -a compadd_opts - zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F: + zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F: __git_ignore_line $* $compadd_opts } @@ -5737,6 +5918,7 @@ _git_commands () { range-diff:'compare two commit ranges' rebase:'forward-port local commits to the updated upstream head' reset:'reset current HEAD to specified state' + restore:'restore working tree files' revert:'revert existing commits' rm:'remove files from the working tree and from the index' shortlog:'summarize git log output' @@ -5745,6 +5927,7 @@ _git_commands () { status:'show working-tree status' 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' worktree:'manage multiple working dirs attached to the same repository' ) @@ -5763,21 +5946,19 @@ _git_commands () { ancillary_interrogator_commands=( blame:'show what revision and author last modified each line of a file' - cherry:'find commits not merged upstream' count-objects:'count unpacked objects and display their disk consumption' difftool:'show changes using common diff tools' fsck:'verify connectivity and validity of objects in database' - get-tar-commit-id:'extract commit ID from an archive created using git archive' help:'display help information about git' instaweb:'instantly browse your working repository in gitweb' interpret-trailers:'add or parse structured information in commit messages' merge-tree:'show three-way merge without touching index' rerere:'reuse recorded resolution of conflicted merges' - rev-parse:'pick out and massage parameters for other git commands' show-branch:'show branches and their commits' verify-commit:'check GPG signature of commits' verify-tag:'check GPG signature of tags' - whatchanged:'show commit-logs and differences they introduce') + whatchanged:'show commit-logs and differences they introduce' + version:'show git version') interaction_commands=( archimport:'import an Arch repository into git' @@ -5793,6 +5974,7 @@ _git_commands () { plumbing_manipulator_commands=( apply:'apply patch to files and/or to index' checkout-index:'copy files from index to working directory' + commit-graph:'write and verify Git commit-graph files' commit-tree:'create new commit object' hash-object:'compute object ID and optionally create a blob from a file' index-pack:'build pack index file for an existing packed archive' @@ -5800,6 +5982,7 @@ _git_commands () { merge-index:'run merge for files needing merging' mktag:'create tag object' mktree:'build tree-object from git ls-tree formatted text' + multi-pack-index:'write and verify multi-pack-indexes' pack-objects:'create packed archive of objects' prune-packed:'remove extra objects that are already in pack files' read-tree:'read tree information into directory index' @@ -5811,10 +5994,12 @@ _git_commands () { plumbing_interrogator_commands=( cat-file:'provide content or type information for repository objects' + cherry:'find commits not merged upstream' diff-files:'compare files in working tree and index' diff-index:'compare content and mode of blobs between index and repository' diff-tree:'compare content and mode of blobs found via two tree objects' for-each-ref:'output information on each ref' + get-tar-commit-id:'extract commit ID from an archive created using git archive' ls-files:'information about files in index/working directory' ls-remote:'show references in a remote repository' ls-tree:'list contents of a tree object' @@ -5822,6 +6007,7 @@ _git_commands () { name-rev:'find symbolic names for given revisions' pack-redundant:'find redundant pack files' 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' show-ref:'list references in a local repository' unpack-file:'create temporary file with blob'\''s contents' @@ -5849,6 +6035,7 @@ _git_commands () { check-ignore:'debug gitignore/exclude files' check-mailmap:'show canonical names and email addresses of contacts' check-ref-format:'ensure that a reference name is well formed' + column:'display data in columns' fmt-merge-msg:'produce merge commit message' mailinfo:'extract patch and authorship from a single email message' mailsplit:'split mbox file into a list of files' @@ -5912,30 +6099,97 @@ __git_extract_aliases () { fi } +(( $+functions[_git_column_layouts] )) || +_git_column_layouts() { + _values -s , 'column layout [always,column,nodense]' \ + '(never auto)always[always show in columns]' \ + '(always auto)never[never show in columns]' \ + '(always never)auto[show in columns if the output is to the terminal]' \ + '(row plain)column[fill columns before rows]' \ + '(column plain)row[fill rows before columns]' \ + '(column row)plain[show in one column]' \ + '(nodense)dense[make unequal size columns to utilize more space]' \ + '(dense)nodense[make equal size columns]' +} + (( $+functions[__git_date_formats] )) || __git_date_formats () { declare -a date_formats - if compset -P 'format:'; then + if compset -P 'format(-local|):'; then _strftime return fi date_formats=( relative:'show dates relative to the current time' - local:'show timestamps in local timezone' + local:'show timestamps in the local timezone' iso{,8601}:'show timestamps in ISO 8601 format' + iso{,8601}-local:'show timestamps in ISO 8601 format in the local timezone' iso-strict:'show timestamps in strict ISO 8601 format' + iso-strict-local:'show timestamps in strict ISO 8601 format in the local timezone' rfc{,2822}:'show timestamps in RFC 2822 format' + rfc{,2822}-local:'show timestamps in RFC 2822 format in the local timezone' short:'show only date but not time' + short-local:'show only date but not time in the local timezone' raw:'show date in internal raw git format (%s %z)' + raw-local:'show date in internal raw git format (%s %z) in the local timezone' + human:'elide some current and recent date elements' + human-local:'elide some current and recent date elements in the local timezone' unix:'show date as a Unix epoch timestamp' - default:'show timestamp in the original timezone' + default:'show timestamp in rfc-like format' + default-local:'show timestamp in rfc-like format in the local timezone' ) _describe -t date-formats 'date format' date_formats -- '( format\:custom\ format )' -S : } +(( $+functions[_git_diff_filters] )) || +_git_diff_filters() { + local sep + local -a dispinc dispexc exclude + typeset -A filters + exclude=( ${(s..)PREFIX:u} ${(s..)SUFFIX:u} ${(s..)PREFIX:l} ${(s..)SUFFIX:l} ) + compset -P \* + compset -S \* + filters=( A added C copied D deleted M modified R renamed T changed b "pairing broken" ) + if zstyle -T ":completion:${curcontext}:" verbose; then + zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- + print -v dispinc -f "%s $sep %s" ${(kv)filters} + print -v dispexc -f "%s $sep %s" ${(kv)filters:l} + else + dispinc=() + fi + _alternative \ + "included-file-types:included file type:compadd -S '' -d dispinc -F exclude -k filters" \ + "excluded-file-types:excluded file type:compadd -S '' -d dispexc -F exclude ${(k)filters:l}" +} + +(( $+functions[_git_dirstat_params] )) || +_git_dirstat_params() { + + _alternative \ + "limits: :_guard '(*,|)[0-9]#' 'minimum cut-off limit (percent)'" \ + "parameters: :_values -s , 'method for computing stats [changes]' + '(lines files)changes[count added/removed lines, ignoring moves]' + '(changes files)lines[count added/removed lines]' + '(changes lines)files[count number of files changed]' + 'cumulative[count changes in a child directory for the parent directory as well]'" +} + +(( $+functions[_git_cleanup_modes] )) || +_git_cleanup_modes() { + declare -a cleanup_modes + cleanup_modes=( + strip:'remove both whitespace and commentary lines' + whitespace:'remove leading and trailing whitespace lines' + verbatim:"don't change the commit message at all" + scissors:"same as whitespace but cut from scissor line" + default:'act as '\''strip'\'' if the message is to be edited and as '\''whitespace'\'' otherwise' + ) + _describe -t modes mode cleanup_modes +} + (( $+functions[__git_gpg_secret_keys] )) || __git_gpg_secret_keys () { local expl @@ -6160,7 +6414,7 @@ __git_ref_fields () { local match mbegin mend local -a cfields fields append opts all - zparseopts -D -E -a opts x: X: J: V: a=all + zparseopts -D -E -a opts M+: x+: X+: J+: V+: o+: 1 2 a=all if compset -P 1 '(#b)(*):'; then case $match[1] in @@ -6221,6 +6475,7 @@ __git_ref_fields () { fields=( 'objecttype:the type of the object' 'objectsize:the size of the object' + 'deltabase:object name of the delta base of the object' 'HEAD:* if HEAD matches ref or space otherwise' 'tree:the tree header-field' 'parent:the parent header-field' @@ -6407,8 +6662,8 @@ __git_recent_branches() { # 4. Obtain log messages for all of them in one shot. # TODO: we'd really like --sort=none here... but git doesn't support such a thing. - # The \n removal is because for-each-ref prints a \n after each entry. - descriptions=( ${(0)"$(_call_program all-descriptions "git --no-pager for-each-ref --format='%(refname)%00%(subject)%00'" refs/heads/${(q)^branches} "--")"//$'\n'} ) + local z=$'\0' + descriptions=( "${(0)"$(_call_program all-descriptions "git --no-pager for-each-ref --format='%(refname)%00%(subject)'" refs/heads/${(q)^branches} "--")"//$'\n'/$z}" ) # 5. Synthesize the data structure _describe wants. local -a branches_colon_descriptions @@ -6422,7 +6677,12 @@ __git_recent_branches() { (( $+functions[__git_commits_prefer_recent] )) || __git_commits_prefer_recent () { - _alternative 'recent-branches::__git_recent_branches' 'commits::__git_commits' + local -a argument_array_names + zparseopts -D -E O:=argument_array_names + + _alternative \ + 'recent-branches::__git_recent_branches' \ + "commits::__git_commits $argument_array_names" } (( $+functions[__git_commits] )) || @@ -6493,8 +6753,9 @@ __git_commit_objects () { # Note: the after-the-colon part must be unique across the entire array; # see workers/34768 - commits=(${(f)"$(_call_program commits git --no-pager log -1000 --all --reflog --format='%h:\[%h\]\ %s\ \(%cr\)')"}) + commits=(${(f)"$(_call_program commits git --no-pager rev-list -1000 --all --reflog --format='%h:\[%h\]\ %s\ \(%cr\)' HEAD)"}) __git_command_successful $pipestatus || return 1 + commits=(${commits:#commit [[:xdigit:]](#c40,)}) _describe -Vx -t commits 'commit object name' commits } @@ -6503,7 +6764,7 @@ __git_commit_objects () { __git_recent_commits () { local gitdir expl start declare -a descr tags heads commits argument_array_names commit_opts - local i j k ret + local h i j k ret integer distance_from_head local label local parents @@ -6517,10 +6778,11 @@ __git_recent_commits () { # Careful: most %d will expand to the empty string. Quote properly! # NOTE: we could use %D directly, but it's not available in git 1.9.1 at least. - commits=("${(f)"$(_call_program commits git --no-pager log ${(q)commit_opts} -20 --format='%h%n%d%n%s\ \(%cr\)%n%p')"}") + commits=("${(f)"$(_call_program commits git --no-pager rev-list -20 --format='%h%n%d%n%s\ \(%cr\)%n%p' HEAD ${(q)commit_opts})"}") __git_command_successful $pipestatus || return 1 - for i j k parents in "$commits[@]" ; do + # h => hard-coded 'commit abcdef1234567890...' -- just discarded + for h i j k parents in "$commits[@]" ; do # Note: the after-the-colon part must be unique across the entire array; # see workers/34768 if (( $#commit_opts )); then @@ -6582,7 +6844,7 @@ __git_recent_commits () { _wanted commit-tags expl 'commit tag' compadd "$@" -a - tags && ret=0 expl=() _wanted heads expl 'head' compadd -M "r:|/=* r:|=*" "$@" -a - heads && ret=0 - return $ret + return ret } (( $+functions[__git_blob_objects] )) || @@ -6729,7 +6991,7 @@ __git_tags_of_type () { tags=(${${(M)${(f)"$(_call_program ${(q)type}-tag-refs "git for-each-ref --format='%(*objecttype)%(objecttype) %(refname)' refs/tags 2>/dev/null")"}:#$type(tag|) *}#$type(tag|) refs/tags/}) __git_command_successful $pipestatus || return 1 - _wanted $type-tags expl "$type tag" compadd -M 'r:|/=* r:|=*' "$@" -a - tags + _wanted $type-tags expl "$type tag" compadd -M 'r:|/=* r:|=*' "$@" -o numeric -a - tags } # Reference Argument Types @@ -6824,7 +7086,7 @@ __git_files_relative () { __git_files () { local compadd_opts opts tag description gitcdup gitprefix files expl - zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F: + zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F: zparseopts -D -E -a opts -- -cached -deleted -modified -others -ignored -unmerged -killed x+: --exclude+: tag=$1 description=$2; shift 2 @@ -6955,7 +7217,7 @@ __git_tree_files () { shift fi - zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F: + zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F: [[ "$1" == */ ]] && Path="$1" || Path="${1:h}/" shift @@ -7035,7 +7297,7 @@ __git_any_repositories_or_references () { __git_guard () { declare -A opts - zparseopts -K -D -A opts M: J: V: 1 2 n F: X: + zparseopts -K -D -A opts M+: J+: V+: 1 2 o+: n F: x+: X+: [[ "$PREFIX$SUFFIX" != $~1 ]] && return 1 @@ -7073,7 +7335,7 @@ __git_guard_diff-stat-width () { __git_guard_number () { declare -A opts - zparseopts -K -D -A opts M: J: V: 1 2 n F: X: + zparseopts -K -D -A opts M+: J+: V+: 1 2 o+: n F: x+: X+: _guard '[[:digit:]]#' ${1:-number} } @@ -7131,15 +7393,21 @@ __git_setup_diff_options () { '(--minimal --patience --histogram --diff-algorithm)--minimal[spend extra time to make sure the smallest possible diff is produced]' '(--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"))' '--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' + '--stat-count=[generate diffstat with limited lines]:lines' + '--compact-summary[generate compact summary in diffstat]' '--numstat[generate more machine-friendly diffstat]' '--shortstat[generate summary diffstat]' - '--dirstat=-[generate dirstat by amount of changes]:: :__git_guard_number limit' + '--dirstat=-[generate dirstat by amount of changes]:: :_git_dirstat_params' + '--cumulative[synonym for --dirstat=cumulative]' '--dirstat-by-file=-[generate dirstat by number of files]:: :__git_guard_number limit' '--summary[generate condensed summary of extended header information]' '--patch-with-stat[generate patch and prepend its diffstat]' @@ -7163,18 +7431,25 @@ __git_setup_diff_options () { blocks\:"greedily detect blocks of moved text of at least 20 characters" zebra\:"like blocks, with alternating colors between different blocks" dimmed-zebra\:"like zebra, uninteresting parts are dimmed"))' + '(--no-color-moved-ws)--color-moved-ws=[configure how whitespace is ignored when performing move detection for --color-moved]:mode:_sequence compadd - no ignore-space-at-eol ignore-space-change ignore-all-space allow-indentation-change' + "(--color-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" '--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]' '(--full-index)--binary[in addition to --full-index, output binary diffs for git-apply]' + '--ws-error-highlight=[specify where to highlight whitespace errors]: :_values -s , "kind of line" all default none context old new' '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' '(-B --break-rewrites)'{-B-,--break-rewrites=-}'[break complete rewrite changes into pairs of given size]:: :__git_guard_number size' '(-M --find-renames)'{-M-,--find-renames=-}'[detect renames with given scope]:: :__git_guard_number size' '(-C --find-copies)'{-C-,--find-copies=-}'[detect copies as well as renames with given scope]:: :__git_guard_number size' '--find-copies-harder[try harder to find copies]' '(-D --irreversible-delete)'{-D,--irreversible-delete}'[omit the preimage for deletes]' + '--rename-empty[use empty blobs as rename source]' + '--follow[continue listing the history of a file beyond renames]' '-l-[limit number of rename/copy targets to run]: :__git_guard_number' - '--diff-filter=-[select certain kinds of files for diff]: :_guard "[AaCcDdMmRrTtUuXxBb*]#" kinds' + '--diff-filter=-[select certain kinds of files for diff]: :_git_diff_filters' '-S-[look for differences that add or remove the given string]:string' '-G-[look for differences whose added or removed line matches the given regex]:pattern' '--find-object=[look for differences that change the number of occurrences of the specified object]:object:__git_blobs' @@ -7185,10 +7460,15 @@ __git_setup_diff_options () { '--relative=-[exclude changes outside and output relative to given directory]:: :_directories' '(-a --text)'{-a,--text}'[treat all files as text]' '--ignore-space-at-eol[ignore changes in whitespace at end of line]' + '--ignore-cr-at-eol[ignore carriage-return at end of line]' '(-b --ignore-space-change -w --ignore-all-space)'{-b,--ignore-space-change}'[ignore changes in amount of white space]' '(-b --ignore-space-change -w --ignore-all-space)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' '--ignore-blank-lines[do not show hunks that add or remove blank lines]' + '--no-indent-heuristic[disable heuristic that shifts diff hunk boundaries to make patches easier to read]' '--inter-hunk-context=[combine hunks closer than n lines]:n' + '--output-indicator-new=[specify the character to indicate a new line]:character [+]' + '--output-indicator-old=[specify the character to indicate a old line]:character [-]' + '--output-indicator-context=[specify the character to indicate a context line]:character [ ]' '--exit-code[report exit code 1 if differences, 0 otherwise]' '( --no-ext-diff)--ext-diff[allow external diff helper to be executed]' '(--ext-diff )--no-ext-diff[disallow external diff helper to be executed]' @@ -7197,6 +7477,7 @@ __git_setup_diff_options () { '--ignore-submodules[ignore changes to submodules]:: :__git_ignore_submodules_whens' '(--no-prefix)--src-prefix=[use given prefix for source]:prefix' '(--no-prefix)--dst-prefix=[use given prefix for destination]:prefix' + '--line-prefix=[prepend additional prefix to every line of output]:prefix' '(--src-prefix --dst-prefix)--no-prefix[do not show any source or destination prefix]' '(-c --cc)'{-c,--cc}'[combined diff format for merge commits]' @@ -7238,6 +7519,8 @@ __git_format_placeholders() { 'G?:indicate [G]ood, [B]ad, [U]ntrusted or [N]o signature' 'GS:name of signer' 'GK:signing key' + 'GF:fingerprint of signing key' + 'GP:fingerprint of primary key whose subkey was used to sign' ) disp=( -l ) elif [[ -prefix %g ]]; then @@ -7245,6 +7528,7 @@ __git_format_placeholders() { gD:'reflog selector' gd:'short reflog selector' gn:'reflog identity' + gN:'reflog identity name' ge:'reflog identity email' gE:'reflog identity email (use .mailmap)' gs:'reflog subject' @@ -7276,6 +7560,7 @@ __git_format_placeholders() { c:'committer details' d:'ref name in brackets' D:'ref name' + S:'ref name used to reach commit' e:encoding s:subject f:'sanitized subject' @@ -7409,6 +7694,7 @@ __git_setup_merge_options () { '(--commit )--no-commit[perform the merge but do not commit the result]' '( --no-edit -e)--edit[open an editor to change the commit message]' "(--edit -e)--no-edit[don't open an editor to change the commit message]" + '--cleanup=[specify how to strip spaces and #comments from message]:mode:_git_cleanup_modes' '( --no-ff)--ff[do not generate a merge commit if the merge resolved as a fast-forward]' '(--ff )--no-ff[generate a merge commit even if the merge resolved as a fast-forward]' '( --no-log)--log=-[add entries from shortlog to merge commit message]::entries to add' @@ -7444,7 +7730,7 @@ __git_setup_fetch_options () { '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' '--dry-run[show what would be done, without making any changes]' - '(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]' + '(-f --force)'{-f,--force}'[force overwrite of local reference]' '(-k --keep)'{-k,--keep}'[keep downloaded pack]' '(-p --prune)'{-p,--prune}'[remove any remote tracking branches that no longer exist remotely]' '(--no-tags -t --tags)'{-t,--tags}'[fetch remote tags]' @@ -7459,7 +7745,10 @@ __git_setup_fetch_options () { '--submodule-prefix=-[prepend <path> to paths printed in informative messages]:submodule prefix path:_files -/' '(-q --quiet -v --verbose --progress)'{-q,--quiet}'[suppress all output]' '(-q --quiet -v --verbose)'{-v,--verbose}'[output additional information]' - '(-q --quiet)--progress[force progress reporting]') + '(-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]' + ) } (( $+functions[__git_setup_apply_options] )) || @@ -7658,6 +7947,7 @@ __git_diff-or-merge-tools () { p4merge tkdiff tortoisemerge + smerge vimdiff vimdiff2 vimdiff3 @@ -7761,6 +8051,7 @@ __git_sendemail_suppresscc_values () { cccmd:'avoid running --cc-cmd' \ tocmd:'avoid running --to-cmd' \ body:'equivalent to sob + bodycc' \ + misc-by:'avoid including anyone mentioned in various "-by" lines in the patch body' \ all:'avoid all auto Cc values' } @@ -7791,6 +8082,7 @@ _git() { local -a aliases local -A git_aliases local a k v + local endopt='!(-)--end-of-options' aliases=(${(0)"$(_call_program aliases git config -z --get-regexp '\^alias\.')"}) for a in ${aliases}; do k="${${a/$'\n'*}/alias.}" @@ -7835,7 +8127,7 @@ _git() { '(-p --paginate -P --no-pager)'{-P,--no-pager}"[don't pipe git output into a pager]" \ '--git-dir=-[path to repository]: :_directories' \ '--work-tree=-[path to working tree]: :_directories' \ - '--namespace=-[set the Git namespace]: :_directories' \ + '--namespace=-[set the Git namespace]:namespace' \ '--bare[use $PWD as repository]' \ '--no-replace-objects[do not use replacement refs to replace git objects]' \ '--literal-pathspecs[treat pathspecs literally, rather than as glob patterns]' \ diff --git a/Completion/Unix/Command/_gnutls b/Completion/Unix/Command/_gnutls index 1c14de791..6c9956b10 100644 --- a/Completion/Unix/Command/_gnutls +++ b/Completion/Unix/Command/_gnutls @@ -38,6 +38,8 @@ case "$service" in '*--x509keyfile=[specify X.509 key file to use]:file:_files' '*--x509certfile=[specify X.509 certificate file to use]:file:_files' '(-l --list -p --port)'{-l,--list}'[print list of the supported algorithms/modes]' + '--keymatexport=[specify label used for exporting keying material]:label' + '--keymatexportsize=[specify size of the exported keying material]:size' ) ;| gnutls-cli|gnutls-serv|certtool) @@ -60,6 +62,7 @@ case "$service" in '--no-ca-verification[disable CA certificate verification]' '!--ca-verification' '--ocsp[enable OCSP certificate verification]' '!--no-oscp' '(-r --resume)'{-r,--resume}'[establish a session and resume]' + '--earlydata=[send early data on resumption from the specified file]:file:_files' '(-e --rehandshake)'{-e,--rehandshake}'[connect, establish a session and rehandshake immediately]' "--verify-hostname-str=[specify server's hostname to use for validation]:hostname" '(-s --starttls)'{-s,--starttls}'[start TLS on EOF or SIGALRM]' @@ -82,13 +85,14 @@ case "$service" in '--benchmark-tls-ciphers[benchmark TLS ciphers]' '--priority-list[print list of the supported priority strings]' '*--alpn=[enable application layer protocol]:string' - '--recordsize=[specify maximum record size to advertize]:record size' + '--recordsize=[specify maximum record size to advertise]:record size (0-4096)' "--disable-sni[don't send a Server Name]" '--single-key-share[send a single key share under TLS1.3]' '--post-handshake-auth[enable post-handshake authentication under TLS1.3]' '--inline-commands[inline commands of the form ^<cmd>^]' '--inline-commands-prefix=[change delimiter used for inline commands]:delimiter [^]' '--fips140-mode[report status of FIPS140-2 mode in gnutls library]' + '--logfile=[redirect informational messages to a specific file]:file:_files' ) ;; @@ -97,6 +101,8 @@ case "$service" in '--sni-hostname-fatal[send fatal alert on sni-hostname mismatch]' '*--alpn=[specify ALPN protocol to be enabled by the server]:protocol' '--alpn-fatal[send fatal alert on non-matching ALPN name]' + '--earlydata[accept early data]' + '--maxearlydata=[specify maximum early data size to accept]:size' "--nocookie[don't require cookie on DTLS sessions]" '(-g --generate)'{-g,--generate}'[generate Diffie-Hellman parameters]' '(-q --quiet)'{-q,--quiet}'[suppress some messages]' @@ -113,6 +119,8 @@ case "$service" in '--pskhint=[specify PSK identity hint to use]:string' '*--ocsp-response=[specify OCSP response to send to client]:string:_files' '--ignore-ocsp-response-errors[ignore any errors when setting the OCSP response]' + '--recordsize=[specify maximum record size to advertise]:record size (0-16384)' + '--httpdata=[specify data to use as HTTP response]:file:_files' ) ;; @@ -189,6 +197,8 @@ case "$service" in '--stdout-info[print information to stdout instead of stderr]' '--ask-pass[enable interaction for entering password when in batch mode]' '--pkcs-cipher=[specify cipher to use for pkcs operations]:cipher:(3des 3des-pkcs12 aes-128 aes-192 aes-256 rc2-40 arcfour)' + '!(--no-text)--text' + "--no-text[don't output textual information before PEM-encoded certificates, private keys, etc]" ) ;; diff --git a/Completion/Unix/Command/_graphicsmagick b/Completion/Unix/Command/_graphicsmagick index cc541d891..dc799085b 100644 --- a/Completion/Unix/Command/_graphicsmagick +++ b/Completion/Unix/Command/_graphicsmagick @@ -40,7 +40,7 @@ case "$words[2]" in '*-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '*-dither[apply dithering]' \ '*-edge:edge detection factor (0.0 - 99.9%%)' \ - '*-endian:image endianess:(MSB LSB)' \ + '*-endian:image endianness:(MSB LSB)' \ '*+endian' \ '*-enhance[enhance noisy image]' \ '*-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ @@ -162,7 +162,7 @@ case "$words[2]" in '-descend[descend window hierarchy]' \ '-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '-dither[apply dithering]' \ - '(+endian)-endian:image endianess:(MSB LSB)' \ + '(+endian)-endian:image endianness:(MSB LSB)' \ '(-endian)+endian' \ '-frame[include window manager frame]' \ '(- *)-help[display help information]' \ @@ -214,7 +214,7 @@ case "$words[2]" in '*-dither[apply dithering]' \ '*+dither[render Postscript without aliasing]' \ '*-draw:drawing primitive:compadd -S "\\ " - rectangle circle ellipse polygon color matte text image' \ - '*-endian:image endianess:(MSB LSB)' \ + '*-endian:image endianness:(MSB LSB)' \ '*+endian' \ '*-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ '*-frame[draw frame around image]' \ @@ -293,7 +293,7 @@ case "$words[2]" in '-draw:drawing primitive:compadd -S "\\ " - rectangle circle ellipse polygon color matte text image' \ '-edge:edge detection factor (0.0 - 99.9%%)' \ '-emboss[emboss image]' \ - '(+endian)-endian:image endianess:(MSB LSB)' \ + '(+endian)-endian:image endianness:(MSB LSB)' \ '(-endian)+endian' \ '-enhance[enhance image]' \ '-equalize[histogram equalization]' \ diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep index d3e1b1a6e..81516b08a 100644 --- a/Completion/Unix/Command/_grep +++ b/Completion/Unix/Command/_grep @@ -109,7 +109,7 @@ case $variant:$OSTYPE in gpl2:*) arguments=( ${${arguments:#*\)-r}/\)-r/\)-R} ) ;; *:openbsd*) arguments=( - ${(M)arguments:#((#s)|*\))--(context|binary-files|line-buffered)*} + ${(M)arguments:#((#s)|*\))--(context|binary-files|line-buffered|label|max-count)*} ${${arguments:#((#s)|*\))(\*|)-[d-]*}/\)-r/\)-R} "-U[search binary files but don't print them]" '-Z[behave as zgrep]' diff --git a/Completion/Unix/Command/_growisofs b/Completion/Unix/Command/_growisofs index 741a7516b..8f4da4030 100644 --- a/Completion/Unix/Command/_growisofs +++ b/Completion/Unix/Command/_growisofs @@ -208,7 +208,7 @@ else '-G[specify path and file-name of a generic boot-image]:boot image:_files' \ '-hard-disk-boot[specify that the el torito boot-image is a hard-disk image]' \ '-no-emul-boot[specify that the el torito boot-image is a "no emulation" image]' \ - '-no-boot[specify that the el torito CD should be markes an non-bootable]' \ + '-no-boot[specify that the el torito CD should be marked non-bootable]' \ '-boot-load-seg[specify the load-segment address of the boot-image for a "no emulation" image]:segment address' \ '-boot-lead-size[specify the number of 512-byte sectors to load in "no emulation" mode]:load sectors' \ '-boot-info-table[specify that a 56-byte table of CD-ROM-layout information should be written]' \ diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg deleted file mode 100644 index 7b72605b3..000000000 --- a/Completion/Unix/Command/_hg +++ /dev/null @@ -1,1077 +0,0 @@ -#compdef hg - -# Zsh completion script for mercurial. Rename this file to _hg and copy -# it into your zsh function path (/usr/share/zsh/site-functions for -# instance) -# -# If you do not want to install it globally, you can copy it somewhere -# else and add that directory to $fpath. This must be done before -# compinit is called. If the file is copied to ~/.zsh.d, your ~/.zshrc -# file could look like this: -# -# fpath=("$HOME/.zsh.d" $fpath) -# autoload -U compinit -# compinit -# -# Copyright (C) 2005, 2006 Steve Borho <steve@borho.org> -# Copyright (C) 2006-9 Brendan Cully <brendan@kublai.com> -# -# Permission is hereby granted, without written agreement and without -# licence or royalty fees, to use, copy, modify, and distribute this -# software and to distribute modified versions of this software for any -# purpose, provided that the above copyright notice and the following -# two paragraphs appear in all copies of this software. -# -# In no event shall the authors be liable to any party for direct, -# indirect, special, incidental, or consequential damages arising out of -# the use of this software and its documentation, even if the authors -# have been advised of the possibility of such damage. -# -# The authors specifically disclaim any warranties, including, but not -# limited to, the implied warranties of merchantability and fitness for -# a particular purpose. The software provided hereunder is on an "as -# is" basis, and the authors have no obligation to provide maintenance, -# support, updates, enhancements, or modifications. - -emulate -LR zsh -setopt extendedglob - -local curcontext="$curcontext" state line -typeset -A _hg_cmd_globals - -_hg() { - local cmd _hg_root - integer i=2 - _hg_cmd_globals=() - - while (( i < $#words )) - do - case "$words[$i]" in - -R|--repository) - eval _hg_root="$words[$i+1]" - _hg_cmd_globals+=("$words[$i]" "$_hg_root") - (( i += 2 )) - continue - ;; - -R*) - _hg_cmd_globals+="$words[$i]" - eval _hg_root="${words[$i]#-R}" - (( i++ )) - continue - ;; - --cwd|--config) - # pass along arguments to hg completer - _hg_cmd_globals+=("$words[$i]" "$words[$i+1]") - (( i += 2 )) - continue - ;; - -*) - # skip option - (( i++ )) - continue - ;; - esac - if [[ -z "$cmd" ]] - then - cmd="$words[$i]" - words[$i]=() - (( CURRENT-- )) - fi - (( i++ )) - done - - if [[ -z "$cmd" ]] - then - _arguments -s -S : $_hg_global_opts \ - ':mercurial command:_hg_commands' - return - fi - - # resolve abbreviations and aliases - if ! (( $+functions[_hg_cmd_${cmd}] )) - then - local cmdexp - (( $#_hg_cmd_list )) || _hg_get_commands - - cmdexp=$_hg_cmd_list[(r)${cmd}*] - if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]] - then - # might be nice to rewrite the command line with the expansion - cmd="$cmdexp" - fi - if [[ -n $_hg_alias_list[$cmd] ]] - then - cmd=$_hg_alias_list[$cmd] - fi - fi - - curcontext="${curcontext%:*:*}:hg-${cmd}:" - - zstyle -s ":completion:$curcontext:" cache-policy update_policy - - if [[ -z "$update_policy" ]] - then - zstyle ":completion:$curcontext:" cache-policy _hg_cache_policy - fi - - if (( $+functions[_hg_cmd_${cmd}] )) - then - _hg_cmd_${cmd} - else - # complete unknown commands normally - _arguments -s -S : $_hg_global_opts \ - '*:files:_hg_files' - fi -} - -_hg_cache_policy() { - typeset -a old - - # cache for a minute - old=( "$1"(mm+10) ) - (( $#old )) && return 0 - - return 1 -} - -_hg_get_commands() { - typeset -ga _hg_cmd_list - typeset -gA _hg_alias_list - local hline cmd cmdalias - - _call_program hg hg debugcomplete -v | while read -A hline - do - cmd=$hline[1] - _hg_cmd_list+=($cmd) - - for cmdalias in $hline[2,-1] - do - _hg_cmd_list+=($cmdalias) - _hg_alias_list+=($cmdalias $cmd) - done - done -} - -_hg_commands() { - (( $#_hg_cmd_list )) || _hg_get_commands - _describe -t commands 'mercurial command' _hg_cmd_list -} - -_hg_revrange() { - compset -P 1 '*:' - _hg_tags "$@" -} - -_hg_tags_internal() { - local -a expl - typeset -a hgtags - hgtags=( ${(f)"$(_hg_cmd tags -q 2>/dev/null)"} ) - _wanted tags expl 'tags' compadd -a - hgtags -} - -_hg_bookmarks_internal() { - local -a expl - typeset -a hgbookmarks - hgbookmarks=( ${(f)"$(_hg_cmd bookmarks -q 2>/dev/null)"} ) - _wanted bookmarks expl 'bookmarks' compadd -a - hgbookmarks -} - -_hg_branches_internal() { - local -a expl - typeset -a hgbranches - hgbranches=( ${(f)"$(_hg_cmd branches -q 2>/dev/null)"} ) - _wanted branches expl 'branches' compadd -a - hgbranches -} - -_hg_tags() { - _alternative \ - 'bookmarks:bookmark:_hg_bookmarks_internal' \ - 'tags:tag:_hg_tags_internal' -} - -# likely merge candidates -_hg_mergerevs() { - typeset -a heads - local revset='sort(head() and not ., -rev)' - - heads=(${(f)"$(_hg_cmd log -r '$revset' --template '{rev}\\n')"}) - (( $#heads )) && _describe -t heads 'heads' heads -} - -_hg_files() { - if [[ -n "$_hg_root" ]] - then - [[ -d "$_hg_root/.hg" ]] || return - case "$_hg_root" in - /*) - _files -W $_hg_root - ;; - *) - _files -W $PWD/$_hg_root - ;; - esac - else - _files - fi -} - -_hg_status() { - [[ -d $PREFIX ]] || PREFIX=$PREFIX:h - status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX 2>/dev/null)"}) -} - -_hg_unknown() { - typeset -a status_files - _hg_status u - _wanted files expl 'unknown files' _multi_parts / status_files -} - -_hg_missing() { - typeset -a status_files - _hg_status d - _wanted files expl 'missing files' _multi_parts / status_files -} - -_hg_modified() { - typeset -a status_files - _hg_status m - _wanted files expl 'modified files' _multi_parts / status_files -} - -_hg_committable() { - typeset -a status_files - # A file is a candidate for `hg commit` if it is: - # - modified (m), or - # - added (a), or - # - removed (r) - _hg_status mar - _wanted files expl 'committable files' _multi_parts / status_files -} - -_hg_resolve() { - local rstate rpath - - [[ -d $PREFIX ]] || PREFIX=$PREFIX:h - - _hg_cmd resolve -l ./$PREFIX 2> /dev/null | while read rstate rpath - do - [[ $rstate == 'R' ]] && resolved_files+=($rpath) - [[ $rstate == 'U' ]] && unresolved_files+=($rpath) - done -} - -_hg_resolved() { - typeset -a resolved_files unresolved_files - _hg_resolve - _wanted files expl 'resolved files' _multi_parts / resolved_files -} - -_hg_unresolved() { - typeset -a resolved_files unresolved_files - _hg_resolve - _wanted files expl 'unresolved files' _multi_parts / unresolved_files -} - -_hg_config() { - typeset -a items - items=(${${(%f)"$(_call_program hg hg showconfig)"}%%\=*}) - (( $#items )) && _describe -t config 'config item' items -} - -_hg_internal_merge_tools=( - \\:dump \\:fail \\:local \\:merge \\:merge-local \\:merge-other \\:merge3 - \\:other \\:prompt \\:tagmerge \\:union -) - -_hg_merge_tools() { - typeset -a external_tools - _describe -t internal_tools 'internal merge tools' _hg_internal_merge_tools - external_tools=(${(f)"$(_hg_cmd showconfig merge-tools | cut -d . -f 2)"}) - (( $#external_tools )) && _describe -t external_tools 'external merge tools' external_tools -} - -_hg_addremove() { - _alternative 'files:unknown files:_hg_unknown' \ - 'files:missing files:_hg_missing' -} - -_hg_ssh_urls() { - if [[ -prefix */ ]] - then - if zstyle -T ":completion:${curcontext}:files" remote-access - then - local host=${PREFIX%%/*} - typeset -a remdirs - compset -p $(( $#host + 1 )) - local rempath=${(M)PREFIX##*/} - local cacheid="hg:${host}-${rempath//\//_}" - cacheid=${cacheid%[-_]} - compset -P '*/' - if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" - then - remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}" 2> /dev/null)"}##*/}%/}) - _store_cache "$cacheid" remdirs - fi - _describe -t directories 'remote directory' remdirs -S/ - else - _message 'remote directory' - fi - else - if compset -P '*@' - then - _hosts -S/ - else - _alternative 'hosts:remote host name:_hosts -S/' \ - 'users:user:_users -S@' - fi - fi -} - -_hg_urls() { - if compset -P bundle:// - then - _files - elif compset -P ssh:// - then - _hg_ssh_urls - elif [[ -prefix *: ]] - then - _urls - else - local expl - compset -S '[^:]*' - _wanted url-schemas expl 'URL schema' compadd -S '' - \ - http:// https:// ssh:// bundle:// - fi -} - -_hg_paths() { - typeset -a paths pnames - _hg_cmd paths 2> /dev/null | while read -A pnames - do - paths+=($pnames[1]) - done - (( $#paths )) && _describe -t path-aliases 'repository alias' paths -} - -_hg_remote() { - _alternative 'path-aliases:repository alias:_hg_paths' \ - 'directories:directory:_files -/' \ - 'urls:URL:_hg_urls' -} - -_hg_clone_dest() { - _alternative 'directories:directory:_files -/' \ - 'urls:URL:_hg_urls' -} - -# Common options -_hg_global_opts=( - '(--repository -R)'{-R+,--repository=}'[repository root directory or name of overlay bundle file]:repository:_files -/' - '--cwd=[change working directory]:new working directory:_files -/' - '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, automatically pick the first choice for all prompts]' - '(--verbose -v)'{-v,--verbose}'[enable additional output]' - '*--config[set/override config option]:defined config items:_hg_config' - '(--quiet -q)'{-q,--quiet}'[suppress output]' - '(--help -h)'{-h,--help}'[display help and exit]' - '--debug[enable debugging output]' - '--debugger[start debugger]' - '--encoding=[set the charset encoding]:encoding' - '--encodingmode=[set the charset encoding mode]:encoding mode' - '--traceback[always print a traceback on exception]' - '--time[time how long the command takes]' - '--profile[print command execution profile]' - '--version[output version information and exit]' - '--hidden[consider hidden changesets]' -) - -_hg_pat_opts=( - '*'{-I+,--include=}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/' - '*'{-X+,--exclude=}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/') - -_hg_diff_opts=( - '(--text -a)'{-a,--text}'[treat all files as text]' - '(--git -g)'{-g,--git}'[use git extended diff format]' - '--nodates[omit dates from diff headers]' -) - -_hg_mergetool_opts=( - '(--tool -t)'{-t+,--tool=}'[specify merge tool]:merge tool:_hg_merge_tools' -) - -_hg_dryrun_opts=( - '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]') - -_hg_template_opts=( - '--template[display with template]:template' -) - -_hg_commit_opts=( - '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]' - '(-e --edit -l --logfile --message -m)'{-m+,--message=}'[use <text> as commit message]:message:' - '(-e --edit -m --message --logfile -l)'{-l+,--logfile=}'[read the commit message from <file>]:log file:_files') - -_hg_remote_opts=( - '(--ssh -e)'{-e+,--ssh=}'[specify ssh command to use]:command' - '--remotecmd=[specify hg command to run on the remote side]:remote command' - '--insecure[do not verify server certificate (ignoring web.cacerts config)]' -) - -_hg_subrepos_opts=( - '(--subrepos -S)'{-S,--subrepos}'[recurse into subrepositories]' -) - -_hg_cmd() { - _call_program hg hg --config ui.verbose=0 --config defaults."$1"= \ - "$_hg_cmd_globals[@]" "$@" 2> /dev/null -} - -_hg_cmd_add() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts $_hg_subrepos_opts \ - '*:unknown files:_hg_unknown' -} - -_hg_cmd_addremove() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts $_hg_subrepos_opts \ - '(--similarity -s)'{-s+,--similarity=}'[guess renamed files by similarity (0<=s<=100)]:similarity' \ - '*:unknown or missing files:_hg_addremove' -} - -_hg_cmd_annotate() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts \ - '(--rev -r)'{-r+,--rev=}'[annotate the specified revision]:revision:_hg_tags' \ - "--no-follow[don't follow copies and renames]" \ - '(--text -a)'{-a,--text}'[treat all files as text]' \ - '(--user -u)'{-u,--user}'[list the author (long with -v)]' \ - '(--file -f)'{-f,--file}'[list the filename]' \ - '(--date -d)'{-d,--date}'[list the date (short with -q)]' \ - '(--number -n)'{-n,--number}'[list the revision number (default)]' \ - '(--changeset -c)'{-c,--changeset}'[list the changeset]' \ - '(--line-number -l)'{-l,--line-number}'[show line number at the first appearance]' \ - '*:files:_hg_files' -} - -_hg_cmd_archive() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \ - '--no-decode[do not pass files through decoders]' \ - '(--prefix -p)'{-p+,--prefix=}'[directory prefix for files in archive]:prefix' \ - '(--rev -r)'{-r+,--rev=}'[revision to distribute]:revision:_hg_tags' \ - '(--type -t)'{-t+,--type=}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \ - '*:destination:_files' -} - -_hg_cmd_backout() { - _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts $_hg_pat_opts \ - '--merge[merge with old dirstate parent after backout]' \ - '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \ - '--parent[parent to choose when backing out merge]' \ - '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \ - '(--rev -r)'{-r+,--rev=}'[revision]:revision:_hg_tags' \ - '(--message -m)'{-m+,--message=}'[specify commit message]:text' \ - '(--logfile -l)'{-l+,--logfile=}'[read commit message from specified file]:log file:_files' -} - -_hg_cmd_bisect() { - _arguments -s -S : $_hg_global_opts \ - '(-)'{-r,--reset}'[reset bisect state]' \ - '(--extend -e)'{-e,--extend}'[extend the bisect range]' \ - '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_tags \ - '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_tags \ - '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \ - '(--command -c --noupdate -U)'{-c+,--command=}'[use command to check changeset state]':commands:_command_names \ - '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]' -} - -_hg_cmd_bookmarks() { - _arguments -s -S : $_hg_global_opts \ - '(--force -f)'{-f,--force}'[force]' \ - '(--rev -r --delete -d --rename -m)'{-r+,--rev=}'[set bookmark at revision]:revision:_hg_tags' \ - '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \ - '(--rev -r --delete -d --rename -m)'{-m+,--rename=}'[rename given bookmark]:bookmark:_hg_bookmarks_internal' \ - '(--inactive -i)'{-i,--inactive}'[mark a bookmark inactive]' \ - ':bookmark:_hg_bookmarks_internal' -} - -_hg_cmd_branch() { - _arguments -s -S : $_hg_global_opts \ - '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \ - '(--clean -C)'{-C,--clean}'[reset branch name to parent branch name]' -} - -_hg_cmd_branches() { - _arguments -s -S : $_hg_global_opts \ - '(--closed -c)'{-c,--closed}'[show normal and closed branches]' -} - -_hg_cmd_bundle() { - _arguments -s -S : $_hg_global_opts $_hg_remote_opts \ - '(--force -f)'{-f,--force}'[run even when the destination is unrelated]' \ - '(2)*--base[a base changeset assumed to be available at the destination]:revision:_hg_tags' \ - '*'{-b+,--branch=}'[a specific branch you would like to bundle]:branch:_hg_branches_internal' \ - '*'{-r+,--rev=}'[a changeset intended to be added to the destination]:revision:_hg_tags' \ - '--all[bundle all changesets in the repository]' \ - '--type[bundle compression type to use (default: bzip2)]:bundle type' \ - ':output file:_files' \ - ':destination repository:_files -/' -} - -_hg_cmd_cat() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts \ - '(--output -o)'{-o+,--output=}'[print output to file with formatted name]:format string' \ - '(--rev -r)'{-r+,--rev=}'[revision]:revision:_hg_tags' \ - '--decode[apply any matching decode filter]' \ - '*:file:_hg_files' -} - -_hg_cmd_clone() { - _arguments -s -S : $_hg_global_opts $_hg_remote_opts \ - '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \ - '(--rev -r)'{-r+,--rev=}'[include the specified changeset]:revision' \ - '--uncompressed[use uncompressed transfer (fast over LAN)]' \ - ':source repository:_hg_remote' \ - ':destination:_hg_clone_dest' -} - -_hg_cmd_commit() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \ - '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \ - '(--message -m)'{-m+,--message=}'[specify commit message]:text' \ - '(--logfile -l)'{-l+,--logfile=}'[read commit message from specified file]:log file:_files' \ - '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \ - '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \ - '--amend[amend the parent of the working directory]' \ - '--close-branch[mark a branch head as closed]' \ - '(--interactive -i)'{-i,--interactive}'[use interactive mode]' \ - '(--secret -s)'{-s,--secret}'[use the secret phase for committing]' \ - '*:file:_hg_committable' -} - -_hg_cmd_copy() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ - '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \ - '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ - '*:file:_hg_files' -} - -_hg_cmd_diff() { - local context state state_descr line ret=1 - typeset -A opt_args - - _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts $_hg_subrepos_opts \ - '*'{-r+,--rev=}'[revision]:revision:_hg_revrange' \ - '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \ - '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \ - '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \ - '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \ - '*:file:->diff_files' && ret=0 - - if [[ $state == 'diff_files' ]] - then - if [[ -n ${opt_args[(I)-r|--rev]} ]] - then - _hg_files && ret=0 - else - _hg_modified && ret=0 - fi - fi - - return ret -} - -_hg_cmd_export() { - _arguments -s -S : $_hg_global_opts $_hg_diff_opts \ - '(--output -o)'{-o+,--output=}'[print output to file with formatted name]:format string' \ - '--switch-parent[diff against the second parent]' \ - '*:revision:_hg_tags' -} - -_hg_cmd_forget() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts \ - '*:file:_hg_files' -} - -_hg_cmd_grep() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts \ - '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \ - '--all[print all revisions with matches]' \ - '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \ - '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \ - '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \ - '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \ - '*'{-r+,--rev=}'[search in given revision range]:revision:_hg_revrange' \ - '(--user -u)'{-u,--user}'[print user who committed change]' \ - '1:search pattern:' \ - '*:files:_hg_files' -} - -_hg_cmd_heads() { - _arguments -s -S : $_hg_global_opts $_hg_template_opts \ - '(--topo -t)'{-t,--topo}'[show topological heads only]' \ - '(--closed -c)'{-c,--closed}'[show normal and closed branch heads]' \ - '(--rev -r)'{-r+,--rev=}'[show only heads which are descendants of rev]:revision:_hg_tags' -} - -_hg_cmd_help() { - _arguments -s -S : $_hg_global_opts \ - '(--extension -e)'{-e,--extension}'[show only help for extensions]' \ - '(--command -c)'{-c,--command}'[show only help for commands]' \ - '(--keyword -k)'{-k,--keyword}'[show topics matching keyword]' \ - '*:mercurial command:_hg_commands' -} - -_hg_cmd_identify() { - _arguments -s -S : $_hg_global_opts \ - '(--rev -r)'{-r+,--rev=}'[identify the specified rev]:revision:_hg_tags' \ - '(--num -n)'{-n,--num}'[show local revision number]' \ - '(--id -i)'{-i,--id}'[show global revision id]' \ - '(--branch -b)'{-b,--branch}'[show branch]' \ - '(--tags -t)'{-t,--tags}'[show tags]' \ - '(--bookmarks -B)'{-B,--bookmarks}'[show bookmarks]' -} - -_hg_cmd_import() { - _arguments -s -S : $_hg_global_opts \ - '(--strip -p)'{-p+,--strip=}'[directory strip option for patch (default: 1)]:count' \ - '(--message -m)'{-m+,--message=}'[use <text> as commit message]:text:' \ - '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \ - '--bypass[apply patch without touching the working directory]' \ - '--no-commit[do not commit, just update the working directory]' \ - '--partial[commit even if some hunks fail]' \ - '--exact[abort if patch would apply lossily]' \ - '--import-branch[use any branch information in patch (implied by --exact)]' \ - '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \ - '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \ - '(--similarity -s)'{-s+,--similarity=}'[guess renamed files by similarity (0<=s<=100)]:similarity' \ - '*:patch:_files' -} - -_hg_cmd_incoming() { - _arguments -s -S : $_hg_global_opts $_hg_remote_opts $_hg_template_opts $_hg_subrepos_opts \ - '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ - '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ - '(--patch -p)'{-p,--patch}'[show patch]' \ - '*'{-r+,--rev=}'[a remote changeset intended to be added]:revision:_hg_tags' \ - '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ - '--bundle[file to store the bundles into]:bundle file:_files' \ - ':source:_hg_remote' -} - -_hg_cmd_init() { - _arguments -s -S : $_hg_global_opts $_hg_remote_opts \ - ':dir:_files -/' -} - -_hg_cmd_locate() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts \ - '(--rev -r)'{-r+,--rev=}'[search repository as it stood at revision]:revision:_hg_tags' \ - '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ - '(--fullpath -f)'{-f,--fullpath}'[print complete paths from the filesystem root]' \ - '*:search pattern:_hg_files' -} - -_hg_cmd_log() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_template_opts \ - '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \ - '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \ - '(--copies -C)'{-C,--copies}'[show copied files]' \ - '*'{-k+,--keyword=}'[search for a keyword]:keyword' \ - '(--limit -l)'{-l+,--limit=}'[limit number of changes displayed]:limit' \ - '*'{-r+,--rev=}'[show the specified revision or revset]:revision:_hg_revrange' \ - '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \ - '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \ - '(--patch -p)'{-p,--patch}'[show patch]' \ - '*'{-P+,--prune=}'[do not display revision or any of its ancestors]:revision:_hg_tags' \ - '*:files:_hg_files' -} - -_hg_cmd_manifest() { - _arguments -s -S : $_hg_global_opts \ - '--all[list files from all revisions]' \ - ':revision:_hg_tags' -} - -_hg_cmd_merge() { - _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \ - '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \ - '(--rev -r 1)'{-r+,--rev=}'[revision to merge]:revision:_hg_mergerevs' \ - '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \ - ':revision:_hg_mergerevs' -} - -_hg_cmd_outgoing() { - _arguments -s -S : $_hg_global_opts $_hg_remote_opts $_hg_template_opts $_hg_subrepos_opts \ - '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ - '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ - '(--patch -p)'{-p,--patch}'[show patch]' \ - '*'{-r+,--rev=}'[a changeset intended to be included in the destination]:revision:_hg_tags' \ - '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ - ':destination:_hg_remote' -} - -_hg_cmd_parents() { - _arguments -s -S : $_hg_global_opts $_hg_template_opts \ - '(--rev -r)'{-r+,--rev=}'[show parents of the specified rev]:revision:_hg_tags' \ - ':last modified file:_hg_files' -} - -_hg_cmd_paths() { - _arguments -s -S : $_hg_global_opts \ - ':path:_hg_paths' -} - -_hg_cmd_phase() { - _arguments -s -S : $_hg_global_opts \ - '(--public -p --draft -d --secret -s)'{-p,--public}'[set changeset phase to public]' \ - '(--public -p --draft -d --secret -s)'{-d,--draft}'[set changeset phase to draft]' \ - '(--public -p --draft -d --secret -s)'{-s,--secret}'[set changeset phase to secret]' \ - '(--force -f)'{-f,--force}'[allow to move boundary backward]' \ - '*'{-r+,--rev=}'[target revision]:revision:_hg_tags' \ - '*:revision:_hg_tags' -} - -_hg_cmd_pull() { - _arguments -s -S : $_hg_global_opts $_hg_remote_opts \ - '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ - '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \ - '(--rev -r)'{-r+,--rev=}'[a specific revision up to which you would like to pull]:revision' \ - ':source:_hg_remote' -} - -_hg_cmd_push() { - _arguments -s -S : $_hg_global_opts $_hg_remote_opts \ - '(--force -f)'{-f,--force}'[force push]' \ - '*'{-r+,--rev=}'[a changeset intended to be included in the destination]:revision:_hg_tags' \ - '*'{-B,--bookmark=}'[bookmark to push]:bookmark:_hg_bookmarks_internal' \ - '*'{-b,--branch=}'[branch to push]:branch:_hg_branches_internal' \ - '--new-branch[allow pushing a new branch]' \ - ':destination:_hg_remote' -} - -_hg_cmd_remove() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \ - '(--after -A)'{-A,--after}'[record delete for missing files]' \ - '(--force -f)'{-f,--force}'[forget added files, delete modified files]' \ - '*:file:_hg_files' -} - -_hg_cmd_rename() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ - '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \ - '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ - '*:file:_hg_files' -} - -_hg_cmd_resolve() { - local context state state_descr line ret=1 - typeset -A opt_args - - _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \ - '(--all -a)'{-a,--all}'[select all unresolved files]' \ - '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \ - '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \ - '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \ - '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[mark files as unresolved]:*:resolved files:_hg_resolved' \ - '*:file:_hg_unresolved' && ret=0 - - if [[ $state == 'resolve_files' ]] - then - _alternative 'files:resolved files:_hg_resolved' \ - 'files:unresolved files:_hg_unresolved' && ret=0 - fi - - return ret -} - -_hg_cmd_revert() { - local context state state_descr line ret=1 - typeset -A opt_args - - _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ - '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \ - '(--rev -r)'{-r+,--rev=}'[revision to revert to]:revision:_hg_tags' \ - '(--no-backup -C)'{-C,--no-backup}'[do not save backup copies of files]' \ - '(--date -d)'{-d+,--date=}'[tipmost revision matching date]:date' \ - '*:file:->diff_files' && ret=0 - - if [[ $state == 'diff_files' ]] - then - if [[ -n ${opt_args[(I)-r|--rev]} ]] - then - _hg_files && ret=0 - else - typeset -a status_files - _hg_status mard - _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files && ret=0 - fi - fi - - return ret -} - -_hg_cmd_serve() { - _arguments -s -S : $_hg_global_opts $_hg_subrepos_opts \ - '(--accesslog -A)'{-A+,--accesslog=}'[name of access log file to write to]:log file:_files' \ - '(--errorlog -E)'{-E+,--errorlog=}'[name of error log file to write to]:log file:_files' \ - '(--daemon -d)'{-d,--daemon}'[run server in background]' \ - '(--port -p)'{-p+,--port=}'[port to listen on (default: 8000)]:listen port' \ - '(--address -a)'{-a+,--address=}'[address to listen on (default: all interfaces)]:interface address' \ - '--prefix[prefix path to serve from (default: server root)]:prefix' \ - '(--name -n)'{-n+,--name=}'[name to show in web pages (default: working directory)]:repository name' \ - '--web-conf=[name of the hgweb config file]:config file:_files' \ - '--pid-file=[name of file to write process ID to]:pid file:_files' \ - '--cmdserver[for remote clients]' \ - '(--templates -t)'{-t+,--templates=}'[web template directory]:template dir:_files -/' \ - '--style=[web template style]:style' \ - '--stdio[for remote clients]' \ - '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]' \ - '--certificate=[SSL certificate file]:certificate file:_files' -} - -_hg_cmd_showconfig() { - _arguments -s -S : $_hg_global_opts \ - '(--untrusted -u)'{-u,--untrusted}'[show untrusted configuration options]' \ - '(--edit -e)'{-e,--edit}'[edit user config]' \ - '(--local -l --global -g)'{-l,--local}'[edit repository config]' \ - '(--local -l --global -g)'{-g,--global}'[edit global config]' \ - ':config item:_hg_config' -} - -_hg_cmd_status() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \ - '(--all -A)'{-A,--all}'[show status of all files]' \ - '(--modified -m)'{-m,--modified}'[show only modified files]' \ - '(--added -a)'{-a,--added}'[show only added files]' \ - '(--removed -r)'{-r,--removed}'[show only removed files]' \ - '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \ - '(--clean -c)'{-c,--clean}'[show only files without changes]' \ - '(--unknown -u)'{-u,--unknown}'[show only unknown (not tracked) files]' \ - '(--ignored -i)'{-i,--ignored}'[show ignored files]' \ - '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \ - '(--copies -C)'{-C,--copies}'[show source of copied files]' \ - '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ - '*--rev=[show difference from revision]:revision:_hg_tags' \ - '--change=[list the changed files of a revision]:revision:_hg_tags' \ - '*:files:_files' -} - -_hg_cmd_summary() { - _arguments -s -S : $_hg_global_opts \ - '--remote[check for push and pull]' -} - -_hg_cmd_tag() { - _arguments -s -S : $_hg_global_opts \ - '(--local -l)'{-l,--local}'[make the tag local]' \ - '(--message -m)'{-m+,--message=}'[message for tag commit log entry]:message' \ - '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \ - '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \ - '(--rev -r)'{-r+,--rev=}'[revision to tag]:revision:_hg_tags' \ - '(--force -f)'{-f,--force}'[force tag]' \ - '--remove[remove a tag]' \ - ':tag name:' -} - -_hg_cmd_tip() { - _arguments -s -S : $_hg_global_opts $_hg_template_opts \ - '(--patch -p)'{-p,--patch}'[show patch]' -} - -_hg_cmd_unbundle() { - _arguments -s -S : $_hg_global_opts \ - '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \ - '*:files:_files' -} - -_hg_cmd_update() { - _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \ - '(--clean -C)'{-C,--clean}'[discard uncommitted changes (no backup)]' \ - '(--check -c)'{-c,--check}'[require clean working directory]' \ - '(--date -d)'{-d+,--date=}'[tipmost revision matching date]:date' \ - '(--rev -r)'{-r+,--rev=}'[revision]:revision:_hg_tags' \ - ':revision:_hg_tags' -} - -# HGK -_hg_cmd_view() { - _arguments -s -S : $_hg_global_opts \ - '(--limit -l)'{-l+,--limit=}'[limit number of changes displayed]:limit' \ - ':revision range:_hg_tags' -} - -# MQ -_hg_qseries() { - typeset -a patches - patches=(${(f)"$(_hg_cmd qseries 2> /dev/null)"}) - (( $#patches )) && _describe -t hg-patches 'patches' patches -} - -_hg_qapplied() { - typeset -a patches - patches=(${(f)"$(_hg_cmd qapplied 2> /dev/null)"}) - if (( $#patches )) - then - patches+=(qbase qtip) - _describe -t hg-applied-patches 'applied patches' patches - fi -} - -_hg_qunapplied() { - typeset -a patches - patches=(${(f)"$(_hg_cmd qunapplied 2> /dev/null)"}) - (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches -} - -# unapplied, including guarded patches -_hg_qdeletable() { - typeset -a unapplied - unapplied=(${(f)"$(_hg_cmd qseries 2> /dev/null)"}) - for p in $(_hg_cmd qapplied) - do - unapplied=(${unapplied:#$p}) - done - - (( $#unapplied )) && _describe -t hg-allunapplied-patches 'all unapplied patches' unapplied -} - -_hg_qguards() { - typeset -a guards - local guard - compset -P "+|-" - _hg_cmd qselect -s 2> /dev/null | while read guard - do - guards+=(${guard#(+|-)}) - done - (( $#guards )) && _describe -t hg-guards 'guards' guards -} - -_hg_qseries_opts=( - '(--summary -s)'{-s,--summary}'[print first line of patch header]') - -_hg_cmd_qapplied() { - _arguments -s -S : $_hg_global_opts $_hg_qseries_opts -} - -_hg_cmd_qdelete() { - _arguments -s -S : $_hg_global_opts \ - '(--keep -k)'{-k,--keep}'[keep patch file]' \ - '*'{-r+,--rev=}'[stop managing a revision]:applied patch:_hg_revrange' \ - '*:unapplied patch:_hg_qdeletable' -} - -_hg_cmd_qdiff() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts \ - '*:pattern:_hg_files' -} - -_hg_cmd_qfold() { - _arguments -s -S : $_hg_global_opts $_h_commit_opts \ - '(--keep -k)'{-k,--keep}'[keep folded patch files]' \ - '*:unapplied patch:_hg_qunapplied' -} - -_hg_cmd_qgoto() { - _arguments -s -S : $_hg_global_opts \ - '(--force -f)'{-f,--force}'[overwrite any local changes]' \ - ':patch:_hg_qseries' -} - -_hg_cmd_qguard() { - _arguments -s -S : $_hg_global_opts \ - '(--list -l)'{-l,--list}'[list all patches and guards]' \ - '(--none -n)'{-n,--none}'[drop all guards]' \ - ':patch:_hg_qseries' \ - '*:guards:_hg_qguards' -} - -_hg_cmd_qheader() { - _arguments -s -S : $_hg_global_opts \ - ':patch:_hg_qseries' -} - -_hg_cmd_qimport() { - _arguments -s -S : $_hg_global_opts \ - '(--existing -e)'{-e,--existing}'[import file in patch dir]' \ - '(--name -n 2)'{-n+,--name=}'[patch file name]:name:' \ - '(--force -f)'{-f,--force}'[overwrite existing files]' \ - '*'{-r+,--rev=}'[place existing revisions under mq control]:revision:_hg_revrange' \ - '*:patch:_files' -} - -_hg_cmd_qnew() { - _arguments -s -S : $_hg_global_opts $_hg_commit_opts \ - '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \ - ':patch:' -} - -_hg_cmd_qnext() { - _arguments -s -S : $_hg_global_opts $_hg_qseries_opts -} - -_hg_cmd_qpop() { - _arguments -s -S : $_hg_global_opts \ - '(--all -a :)'{-a,--all}'[pop all patches]' \ - '(--name -n)'{-n+,--name=}'[queue name to pop]:' \ - '(--force -f)'{-f,--force}'[forget any local changes]' \ - ':patch:_hg_qapplied' -} - -_hg_cmd_qprev() { - _arguments -s -S : $_hg_global_opts $_hg_qseries_opts -} - -_hg_cmd_qpush() { - _arguments -s -S : $_hg_global_opts \ - '(--all -a :)'{-a,--all}'[apply all patches]' \ - '(--list -l)'{-l,--list}'[list patch name in commit text]' \ - '(--merge -m)'{-m+,--merge=}'[merge from another queue]:' \ - '(--name -n)'{-n+,--name=}'[merge queue name]:' \ - '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \ - ':patch:_hg_qunapplied' -} - -_hg_cmd_qrefresh() { - _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \ - '(--git -g)'{-g,--git}'[use git extended diff format]' \ - '(--short -s)'{-s,--short}'[short refresh]' \ - '*:files:_hg_files' -} - -_hg_cmd_qrename() { - _arguments -s -S : $_hg_global_opts \ - ':patch:_hg_qseries' \ - ':destination:' -} - -_hg_cmd_qselect() { - _arguments -s -S : $_hg_global_opts \ - '(--none -n :)'{-n,--none}'[disable all guards]' \ - '(--series -s :)'{-s,--series}'[list all guards in series file]' \ - '--pop[pop to before first guarded applied patch]' \ - '--reapply[pop and reapply patches]' \ - '*:guards:_hg_qguards' -} - -_hg_cmd_qseries() { - _arguments -s -S : $_hg_global_opts $_hg_qseries_opts \ - '(--missing -m)'{-m,--missing}'[print patches not in series]' -} - -_hg_cmd_qunapplied() { - _arguments -s -S : $_hg_global_opts $_hg_qseries_opts -} - -_hg_cmd_qtop() { - _arguments -s -S : $_hg_global_opts $_hg_qseries_opts -} - -_hg_cmd_strip() { - _arguments -s -S : $_hg_global_opts \ - '*'{-r+,--rev=}'[revision]:revision:_hg_tags' \ - '(--force -f)'{-f,--force}'[force removal of changesets, discard uncommitted changes (no backup)]' \ - '--no-backup[no backups]' \ - '(--keep -k)'{-k,--keep}'[do not modify working directory during strip]' \ - '*'{-B+,--bookmark=}'[remove revs only reachable from given bookmark]:bookmark:_hg_bookmarks_internal' \ - '*:revision:_hg_tags' -} - -_hg "$@" diff --git a/Completion/Unix/Command/_iconv b/Completion/Unix/Command/_iconv index d040be756..bf04acfe4 100644 --- a/Completion/Unix/Command/_iconv +++ b/Completion/Unix/Command/_iconv @@ -2,7 +2,7 @@ local expl curcontext="$curcontext" state line variant ret=1 -if _pick_variant -r variant libiconv='GNU*libiconv' glibc='(GNU*libc|EGLIBC|Gentoo)' unix --version; then +if _pick_variant -r variant libiconv='GNU*libiconv' glibc='(Free Soft|GNU*libc|GLIBC|Gentoo)' unix --version; then local -a args local exargs="-l --list -? --help --usage --version -V" @@ -38,7 +38,7 @@ if _pick_variant -r variant libiconv='GNU*libiconv' glibc='(GNU*libc|EGLIBC|Gent _arguments -C -S -s : $args && return 0 if [[ $state = *_codeset ]]; then - # suffix is meaningfull only for output encoding + # suffix is meaningful only for output encoding if [[ $state = to_codeset ]] && compset -P '*[^/]/'; then _wanted suffix expl suffix compadd "$@" /TRANSLIT /IGNORE && ret=0 else diff --git a/Completion/Unix/Command/_ifconfig b/Completion/Unix/Command/_ifconfig index c5b5af8d4..25ddd55bd 100644 --- a/Completion/Unix/Command/_ifconfig +++ b/Completion/Unix/Command/_ifconfig @@ -36,6 +36,9 @@ case $OSTYPE in {,-}wep {,-}nwkey add delete ether {,-}link{0,1,2} list wme wmm roam roam:rssi roam:rate roaming ) + ;| + dragonfly*) + args+=( '-n[disable auto-loading of kernel network interface driver]' ) ;; irix5*) opts=( $debug ) ;; irix6*) diff --git a/Completion/Unix/Command/_imagemagick b/Completion/Unix/Command/_imagemagick index c2c9dc478..3afa108ae 100644 --- a/Completion/Unix/Command/_imagemagick +++ b/Completion/Unix/Command/_imagemagick @@ -44,7 +44,7 @@ case "$service" in '*-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '*-dither[apply dithering]' \ '*-edge:edge detection factor (0.0 - 99.9%%)' \ - '*-endian:image endianess:(MSB LSB)' \ + '*-endian:image endianness:(MSB LSB)' \ '*+endian' \ '*-enhance[enhance noisy image]' \ '*-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ @@ -166,7 +166,7 @@ case "$service" in '-descend[descend window hierarchy]' \ '-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '-dither[apply dithering]' \ - '(+endian)-endian:image endianess:(MSB LSB)' \ + '(+endian)-endian:image endianness:(MSB LSB)' \ '(-endian)+endian' \ '-frame[include window manager frame]' \ '(- *)-help[display help information]' \ @@ -218,7 +218,7 @@ case "$service" in '*-dither[apply dithering]' \ '*+dither[render Postscript without aliasing]' \ '*-draw:drawing primitive:compadd -S "\\ " - rectangle circle ellipse polygon color matte text image' \ - '*-endian:image endianess:(MSB LSB)' \ + '*-endian:image endianness:(MSB LSB)' \ '*+endian' \ '*-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ '*-frame[draw frame around image]' \ @@ -297,7 +297,7 @@ case "$service" in '-draw:drawing primitive:compadd -S "\\ " - rectangle circle ellipse polygon color matte text image' \ '-edge:edge detection factor (0.0 - 99.9%%)' \ '-emboss[emboss image]' \ - '(+endian)-endian:image endianess:(MSB LSB)' \ + '(+endian)-endian:image endianness:(MSB LSB)' \ '(-endian)+endian' \ '-enhance[enhance image]' \ '-equalize[histogram equalization]' \ @@ -511,7 +511,7 @@ case "$service" in '-file:output file:_files' \ '-get[get files]' \ '-port:port: _ports' \ - '-proxy:host of proxy ftp deamon:_hosts' \ + '-proxy:host of proxy ftp daemon:_hosts' \ '-print[print files]' \ '-prune[process files from remote directory]' \ '-put[put files]' \ diff --git a/Completion/Unix/Command/_initctl b/Completion/Unix/Command/_initctl index 9d444c6d1..2d7c2494b 100644 --- a/Completion/Unix/Command/_initctl +++ b/Completion/Unix/Command/_initctl @@ -18,7 +18,7 @@ _initctl_fillarray_events_args () _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 remaing strings and try again + # 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]) diff --git a/Completion/Unix/Command/_install b/Completion/Unix/Command/_install index 80a1b0c00..5ad84645e 100644 --- a/Completion/Unix/Command/_install +++ b/Completion/Unix/Command/_install @@ -25,7 +25,7 @@ if _pick_variant gnu='Free Soft' unix --version; then args+=( $common_args '(-b --backup)--backup=[create backup; optionally specify method]:: :->controls' - "${lx}--context=[like -Z, or specify SELinux security context to set]::SELinux security context" + "${lx}--context=-[like -Z, or specify SELinux security context to set]::SELinux security context:_selinux_contexts" '-D[create all leading destination path components]' '(: -)--help[display help information]' "${lx}--preserve-context[preserve SELinux security context]" @@ -64,14 +64,16 @@ else [[ $OSTYPE == (darwin|dragonfly)* ]] && args+=( '-M[disable use of mmap(2)]' ) + [[ $OSTYPE == (dragonfly|freebsd|netbsd)* ]] && args+=( + '(-C -c --compare)-l+[link files (rather than copy) using specified method]: :->linkflags' + '+N+[use user/group database files from specified directory]: :_directories' + '-U[indicate that install is unprivileged]' + ) [[ $OSTYPE == (freebsd|netbsd)* ]] && args+=( '-D+[specify destination directory used for metadata log]: :_directories' '-h+[store digest in metadata log using specified method]: :->digests' - '(-C -c --compare)-l+[link files (rather than copy) using specified method]: :->linkflags' '-M+[log mtree(8) metadata for installed files to specified file]:metadata log file:_files' - '+N+[use user/group database files from specified directory]: :_directories' '-T+[specify mtree(8) tags to store in metadata log]:mtree(8) tags' - '-U[indicate that install is unprivileged]' ) [[ $OSTYPE == netbsd* ]] || args+=( '-S[use temporary files to perform safe copy]' diff --git a/Completion/Unix/Command/_iostat b/Completion/Unix/Command/_iostat index 8909ae311..f5291a19b 100644 --- a/Completion/Unix/Command/_iostat +++ b/Completion/Unix/Command/_iostat @@ -4,42 +4,53 @@ local -a args parser parser=( -s -S -A '-*' ) case $OSTYPE:l in - *bsd*) + *bsd*|dragonfly*) args+=( - '-c[repeat the display N times]:count' + '-c+[repeat the display N times]:count' '-C[display CPU statistics]' '-d[display only device statistics]' '-I[display total statistics for a given period, rather than average]' - '-M[extract values of the name list from specified file]:core:_files' - '-N[extract the name list from the specified file]:system:_files' '-T[display TTY statistics]' - '-w[specify the duration of pauses between each display]:duration' + '-w+[specify the duration of pauses between each display]:duration' + '*: :_bsd_disks' ) ;| - freebsd*) + freebsd*|openbsd*|dragonfly*) + args+=( + '-M+[extract values of the name list from specified file]:core:_files' + '-N+[extract the name list from the specified file]:system:_files' + ) + ;| + freebsd*|dragonfly*) args+=( '-h[top mode]' '-K[display block count in kilobytes, not block size]' + '-n+[display up to the specified number fo devices]:number of disks' '-o[display old-style iostat device statistics]' - '-t[specify which type of device to display]: :->devicetype' + '*-t+[specify which type of device to display]: :_fbsd_device_types' + ) + ;| + freebsd*) + args+=( '-x[show extended disk statistics]' '-z[omit lines for devices with no activity]' - '-?[display a usage statement and exit]' - '*:drives:( ${${(M)${(f)"$(geom disk list)"}\:#Geom name\:*}#*\: } )' + '(* -)-?[display a usage statement and exit]' ) ;; - openbsd*) + dragonfly*) args+=( - '-D[display alternate disk statistics]' - '*:drives:( ${${(s.,.)"$(sysctl -n hw.disknames)"}%\:*} )' + '-D[display more details]' ) ;; - netbsd*) + openbsd*|netbsd*) args+=( '-D[display alternate disk statistics]' + ) + ;| + netbsd*) + args+=( '-x[show extended disk statistics]' '-y[report data on waiting and active requests]' - '*:drives:( $(sysctl -n hw.disknames) )' ) ;; aix*) @@ -97,16 +108,17 @@ case $OSTYPE:l in ;; darwin*) args=( + '(- *)-?[display usage statement and exit]' '-C[display CPU statistics]' - '-c[number of times to display statistics]' + '-c+[number of times to display statistics]:count' '-d[display only device statistics]' - '-l[total statistics for a given time period]' + '-I[display total statistics for a given period, rather than average]' '-K[display block count in kilobytes]' - '-n[limit the number of disks included in the report]:number of disks' + '-n+[limit the number of disks included in the report]:number of disks' '-o[display old-style iostat device statistics]' '-T[display TTY statistics]' '-U[display system load averages]' - '-w[specify the duration of pauses between each display]:duration' + '-w+[specify the duration of pauses between each display]:duration' '*::device:_files -W /dev -g "disk*"' ) ;; diff --git a/Completion/Unix/Command/_ip b/Completion/Unix/Command/_ip index 74101c646..9a7cbd821 100644 --- a/Completion/Unix/Command/_ip +++ b/Completion/Unix/Command/_ip @@ -542,6 +542,7 @@ _regex_words options "ip options" \ '-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' \ diff --git a/Completion/Unix/Command/_java b/Completion/Unix/Command/_java index 30231c5ee..ee0441d97 100644 --- a/Completion/Unix/Command/_java +++ b/Completion/Unix/Command/_java @@ -111,7 +111,7 @@ javadoc) '-bottom[specify bottom text]:bottom text:' \ '-link[generate a link to external reference classes]:document URL:' \ '-linkoffline[generate a link for external reference class names]:document URL::package list URL:' \ - '-group[generate tables for each groupes]:group heading::package patterns:' \ + '-group[generate tables for each group]:group heading::package patterns:' \ '-nodeprecated[do not document deprecated API]' \ '-nodeprecatedlist[do not generate deprecated API list]' \ '-notree[do not generate class and interface hierarchy]' \ diff --git a/Completion/Unix/Command/_killall b/Completion/Unix/Command/_killall index 6fdb0f277..36accb2e0 100644 --- a/Completion/Unix/Command/_killall +++ b/Completion/Unix/Command/_killall @@ -32,7 +32,7 @@ if _pick_variant psmisc=PSmisc unix --version; then "*: :_process_names $opts" ) [[ $CURRENT = 2 || ( $CURRENT = 3 && $words[2] = (-Z|--context) ) ]] && \ - args+=( '(-Z --context)'{-Z+,--context=}'[specify SELinux security context]:regex pattern: ' ) + args+=( '(-Z --context)'{-Z+,--context=}'[specify SELinux security context]:regex pattern:_selinux_contexts' ) _arguments -s -S -C : $args && ret=0 diff --git a/Completion/Unix/Command/_ldconfig b/Completion/Unix/Command/_ldconfig index 3c3fca538..16ce3d680 100644 --- a/Completion/Unix/Command/_ldconfig +++ b/Completion/Unix/Command/_ldconfig @@ -62,7 +62,7 @@ case $OSTYPE in );| openbsd*) args+=( - '(-m)-U[unconfigure specified directories or inaccessable directories if none specified]' + '(-m)-U[unconfigure specified directories or inaccessible directories if none specified]' );| esac diff --git a/Completion/Unix/Command/_ldd b/Completion/Unix/Command/_ldd index 1de1659a5..3c7b088df 100644 --- a/Completion/Unix/Command/_ldd +++ b/Completion/Unix/Command/_ldd @@ -1,6 +1,6 @@ #compdef ldd -if _pick_variant gnu='(Free Soft|GNU|EGLIBC|Gentoo)' unix --version; then +if _pick_variant gnu='(Free Soft|GNU|GLIBC|Gentoo)' unix --version; then args=( '(- *)--version[display version information]' '(- *)--help[display help information]' diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less index 7f01952d2..cb71314a6 100644 --- a/Completion/Unix/Command/_less +++ b/Completion/Unix/Command/_less @@ -41,7 +41,7 @@ _arguments -S -s -A "[-+]*" \ '(-d --dumb)'{-d,--dumb}'[suppress error message if terminal is dumb]' \ '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-e,--quit-at-eof}'[exit the second time end-of-file is reached]' \ '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-E,--QUIT-AT-EOF}'[exit when end-of-file is reached]' \ - '(-f --force)'{-f,--force}'[force opening of non-reqular files]' \ + '(-f --force)'{-f,--force}'[force opening of non-regular files]' \ '(-F --quit-if-one-screen)'{-F,--quit-if-one-screen}'[exit if entire file fits on first screen]' \ '(-G --HILITE-SEARCH -g --hilite-search)'{-g,--hilite-search}'[highlight only one match for searches]' \ '(-g --hilite-search -G --HILITE-SEARCH)'{-G,--HILITE-SEARCH}'[disable highlighting of search matches]' \ @@ -84,7 +84,12 @@ _arguments -S -s -A "[-+]*" \ '(-~ --tilde)'{-~,--tilde}"[don't display tildes after end of file]" \ '(-\# --shift)'{-\#+,--shift=}"[specify amount to move when scrolling horizontally]:number" \ '--follow-name[the F command changes file if the input file is renamed]' \ + '--mouse[enable mouse input]' \ + '--no-histdups[remove duplicates from command history]' \ + '--rscroll=[set the character used to mark truncated lines]:character [>]' \ + '--save-marks[retain marks across invocations of less]' \ '--use-backslash[subsequent options use backslash as escape char]' \ + '--wheel-lines=[specify lines to move for each click of the mouse wheel]:lines' \ "$files[@]" && ret=0 diff --git a/Completion/Unix/Command/_links b/Completion/Unix/Command/_links index 8bb9fee1c..495937709 100644 --- a/Completion/Unix/Command/_links +++ b/Completion/Unix/Command/_links @@ -37,7 +37,7 @@ _arguments -C \ '-memory-cache-size[cache memory]:size (bytes) [1048576]' \ '-image-cache-size[image cache memory]:size (bytes) [1048576]' \ '-font-cache-size[specify font cache size]:size (bytes) [2097152]' \ - "-aggressive-cache[cache everything regardless of server's caching recomendations]:enable [1]:((1\\:on 0\\:off))" \ + "-aggressive-cache[cache everything regardless of server's caching recommendations]:enable [1]:((1\\:on 0\\:off))" \ '-address-preference[specify IP version preference]:preference:(( 0\:system\ default 1\:prefer\ IPv4 @@ -108,10 +108,10 @@ _arguments -C \ '-html-target-in-new-window[allow opening new windows from html]' \ '-html-margin[specify margin]:margin (spaces)' \ '-html-user-font-size[specify font size in graphics mode]:size' \ - '-html-t-text-color[specify text color in text mode]:color (0..15)' \ - '-html-t-link-color[specify link color in text mode]:color (0..15)' \ - '-html-t-background-color[specify background color in text mode]:color (0..15)' \ - '-html-t-ignore-document-color[ignore colors from HTML in text mode]:ignore:(0 1)' \ + '-html-text-color[specify text color in text mode]:color (0..15)' \ + '-html-link-color[specify link color in text mode]:color (0..15)' \ + '-html-background-color[specify background color in text mode]:color (0..15)' \ + '-html-ignore-document-color[ignore colors from HTML in text mode]:ignore:(0 1)' \ '-html-g-text-color[specify text color in graphics mode]:color (0xRRGGBB)' \ '-html-g-link-color[specify link color in graphics mode]:color (0xRRGGBB)' \ '-html-g-background-color[specify background color in graphics mode]:color (0xRRGGBB)' \ diff --git a/Completion/Unix/Command/_ln b/Completion/Unix/Command/_ln index 3c1dcac76..9d5efcabb 100644 --- a/Completion/Unix/Command/_ln +++ b/Completion/Unix/Command/_ln @@ -1,77 +1,76 @@ #compdef ln gln zf_ln -local curcontext="$curcontext" state line ret=1 +local curcontext="$curcontext" state line ret=1 variant local -A opt_args -local -a args opts +local -a args opts=( -A '-*' ) args=( '(-i)-f[remove existing destination files]' '-s[create symbolic links instead of hard links]' ) -local variant -_pick_variant -r variant gnu=gnu unix --help -if [[ $variant == gnu ]]; then - opts=(-S) - args=( - '(-b --backup)-b[create a backup of each existing destination file]' \ - '(-b --backup)--backup=[create a backup of each existing destination file]::method:(( - none\:"never create backups" - off\:"never create backups" - numbered\:"create numbered backup" - t\:"create numbered backup" - existing\:"same as numbered if numbered backups exist, otherwise same as simple" - nil\:"same as numbered if numbered backups exist, otherwise same as simple" - simple\:"always create simple backups" - never\:"always create simple backups"))' - '(-d -F --directory)'{-d,-F,--directory}'[allow the superuser to attempt to hard link directories]' - '(-f --force)'{-f,--force}'[remove existing destination files]' - '(-i --interactive)'{-i,--interactive}'[prompt before removing destination files]' - '(-L --logical)'{-L,--logical}'[create hard links to symbolic link references]' - '(-n --no-dereference)'{-n,--no-dereference}'[treat destination symbolic link to a directory as if it were a normal file]' - '(-P --physical)'{-P,--physical}'[create hard links directly to symbolic links]' - '(-r --relative)'{-r,--relative}'[create symbolic links relative to link location]' - '(-s --symbolic)'{-s,--symbolic}'[create symbolic links instead of hard links]' - '(-S --suffix)'{-S,--suffix=}'[override default backup suffix]:suffix' - '(-t --target-directory)'{-t,--target-directory=}'[specify directory in which to create the links]: :_directories' - '(-T --no-target-directory)'{-T,--no-target-directory}'[treat destination as a normal file]' - '(-v --verbose)'{-v,--verbose}'[print name of each linked file]' - '--help[display usage information and exit]' - '--version[display version information and exit]') -elif (( ${+builtins[ln]} )); then - args+=( - '-d[attempt to hard link directories]' - {-h,-n}'[do not dereference destination]' - '(-f)-i[prompt before removing destination files]') -else - case $OSTYPE in - darwin*|dragonfly*|freebsd*|netbsd*|openbsd*) - args+=( - {-h,-n}'[do not dereference destination]' - ) +_pick_variant -r variant -b zsh gnu=gnu $OSTYPE --help +case $variant; in + gnu) + opts=() + args=( + '(-b --backup)-b[create a backup of each existing destination file]' \ + '(-b --backup)--backup=[create a backup of each existing destination file]::method:(( + none\:"never create backups" + off\:"never create backups" + numbered\:"create numbered backup" + t\:"create numbered backup" + existing\:"same as numbered if numbered backups exist, otherwise same as simple" + nil\:"same as numbered if numbered backups exist, otherwise same as simple" + simple\:"always create simple backups" + never\:"always create simple backups"))' + '(-d -F --directory)'{-d,-F,--directory}'[allow the superuser to attempt to hard link directories]' + '(-f --force)'{-f,--force}'[remove existing destination files]' + '(-i --interactive)'{-i,--interactive}'[prompt before removing destination files]' + '(-L --logical)'{-L,--logical}'[create hard links to symbolic link references]' + '(-n --no-dereference)'{-n,--no-dereference}'[treat destination symbolic link to a directory as if it were a normal file]' + '(-P --physical)'{-P,--physical}'[create hard links directly to symbolic links]' + '(-r --relative)'{-r,--relative}'[create symbolic links relative to link location]' + '(-s --symbolic)'{-s,--symbolic}'[create symbolic links instead of hard links]' + '(-S --suffix)'{-S,--suffix=}'[override default backup suffix]:suffix' + '(-t --target-directory)'{-t,--target-directory=}'[specify directory in which to create the links]: :_directories' + '(-T --no-target-directory)'{-T,--no-target-directory}'[treat destination as a normal file]' + '(-v --verbose)'{-v,--verbose}'[print name of each linked file]' + '--help[display usage information and exit]' + '--version[display version information and exit]') + ;; + zsh) + args+=( + '-d[attempt to hard link directories]' + {-h,-n}'[do not dereference destination]' + '(-f)-i[prompt before removing destination files]') + ;; + darwin*|dragonfly*|freebsd*|netbsd*|openbsd*) + args+=( + {-h,-n}'[do not dereference destination]' + ) ;| - darwin*|dragonfly*|freebsd*|netbsd*) - args+=( - '-F[remove existing destination directories]' - '(-f)-i[prompt before removing destination files]' - '-v[print name of each linked file]' - ) + darwin*|dragonfly*|freebsd*|netbsd*) + args+=( + '-F[remove existing destination directories]' + '(-f)-i[prompt before removing destination files]' + '-v[print name of each linked file]' + ) ;| - dragonfly*|freebsd*|netbsd*|openbsd*) - args+=( - '(-L)-P[create hard links directly to symbolic links]' - '(-P)-L[create hard links to symbolic link references]' - ) + dragonfly*|freebsd*|netbsd*|openbsd*) + args+=( + '(-L)-P[create hard links directly to symbolic links]' + '(-P)-L[create hard links to symbolic link references]' + ) ;| - dragonfly*|freebsd*) - args+=( - "-w[warn if source of a symbolic link doesn't currently exist]" - ) + dragonfly*|freebsd*|netbsd*) + args+=( + "-w[warn if source of a symbolic link doesn't currently exist]" + ) ;; - esac -fi +esac -_arguments -C -s $opts : \ +_arguments -C -s -S $opts : \ $args \ ':link target:_files' \ '*:: :->files' && ret=0 diff --git a/Completion/Unix/Command/_locale b/Completion/Unix/Command/_locale index 59e04a282..a7fd88f65 100644 --- a/Completion/Unix/Command/_locale +++ b/Completion/Unix/Command/_locale @@ -3,7 +3,7 @@ local curcontext="$curcontext" state state_descr line expl ret=1 typeset -A opt_args; local -a specs aopts -if _pick_variant gnu='(GNU|EGLIBC)' unix --version; then +if _pick_variant gnu='(Free Soft|GNU|GLIBC)' unix --version; then local exargs="-? --help --usage -V --version" diff --git a/Completion/Unix/Command/_localedef b/Completion/Unix/Command/_localedef index 4d4b4bbe3..57637e3ec 100644 --- a/Completion/Unix/Command/_localedef +++ b/Completion/Unix/Command/_localedef @@ -3,7 +3,7 @@ local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args -if _pick_variant gnu='(GNU|EGLIBC)' unix --version; then +if _pick_variant gnu='(Free Soft|GNU|GLIBC)' unix --version; then local exargs="-? --help --usage -V --version" _arguments -A "-*" -C -S -s \ diff --git a/Completion/Unix/Command/_lp b/Completion/Unix/Command/_lp index 8c7ba7a8a..e84d9ad04 100644 --- a/Completion/Unix/Command/_lp +++ b/Completion/Unix/Command/_lp @@ -24,13 +24,14 @@ _lp_get_printer() _lp_job_options() { local expl printer - local -a lopts_with_args lopts_no_args + local -a lopts_with_args lopts_no_args desc_opts # Generic options (from lp manual page) - lopts_with_args=( media orientation-requested sides number-up scaling cpi lpi - page-{bottom,left,right,top} page-ranges ) + lopts_with_args=(collate job-{hold-until,priority,sheets} media + number-up{,-layout} orientation-requested outputorder page-border + page-ranges sides) - lopts_no_args=(fitplot fit-to-page landscape) + lopts_no_args=(fit-to-page mirror) if [[ $service == 'lpadmin' ]]; then # Extra options from lpadmin man page. @@ -51,7 +52,11 @@ _lp_job_options() compadd "$@" a4 letter legal ;; (orientation-requested) - compadd "$@" 4 + desc_opts=( + '4:rotated 90 degrees counter-clockwise' + '5:rotated 90 degrees clockwise' + '6:rotated 180 degrees') + _describe "orientation requested" desc_opts ;; (sides) compadd "$@" one-sided two-sided-{long,short}-edge @@ -60,8 +65,9 @@ _lp_job_options() _description -V option-o-1 expl "pages per sheet" compadd "$expl[@]" 2 4 6 9 16 ;; - (scaling|cpi|lpi|page-(bottom|left|right|top)) - return 0; # Don't complete anything + (number-up-layout) + _description -V option-o-1 expl "layout" + compadd "$expl[@]" btlr btrl lrbt lrtb rlbt rltb tblr tbrl ;; (cupsIPPSupplies|cupsSNMPSupplies|printer-is-shared) compadd "$@" true false @@ -69,6 +75,14 @@ _lp_job_options() (printer-error-policy) compadd "$@" abort-job retry-job retry-current-job stop-printer ;; + (Duplex|BRDuplex) + desc_opts=( + "DuplexTumble:flip short side" + "DuplexNoTumble:flip long side" + "None") + _describe "duplex options" desc_opts + ;; + (*) compadd "$@" \ $(_call_program list-printer-options lpoptions $printer -l | \ @@ -230,7 +244,7 @@ _lp() '-n[Copies]:copies (1--100):' \ '*-o:print job options:_lp_job_options' \ '-q[Job priority -- 1 (lowest) to 100 (highest)]:priority:' \ - '-s[Dont report resulting job IDs]' \ + "-s[Don't report resulting job IDs]" \ '-t[Sets the job name]:job name:' \ '-u[Job submission username]:username:_users' \ '-H[Time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \ diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls index cedea1de9..1fd9383f5 100644 --- a/Completion/Unix/Command/_ls +++ b/Completion/Unix/Command/_ls @@ -81,10 +81,14 @@ if ! _pick_variant gnu=gnu unix --help; then if [[ $OSTYPE = (dragonfly*|freebsd*) ]]; then arguments+=( '(-A)-I[prevent -A from being automatically set for the super-user]' + '(-1 -C -m -x)-D+[specify format for date]:format: _date_formats' ) fi if [[ $OSTYPE = dragonfly* ]]; then - arguments+=( '-y[display FSMID in long listing]' ) + arguments+=( + '-_[use GMT based date and time output with nanotime timestamp]' + '-y[display FSMID in long listing]' + ) fi if [[ $OSTYPE = (freebsd*|darwin*) ]]; then arguments+=( '(-c -u)-U[file creation time]' ) @@ -92,9 +96,9 @@ if ! _pick_variant gnu=gnu unix --help; then if [[ $OSTYPE = freebsd* ]]; then arguments+=( '-,[print file sizes grouped and separated by thousands]' - '-D+[specify format for date]:format: _date_formats' '-y[with -t, sort filenames in the same order as the time]' '-Z[display MAC label]' + '--color=-[control use of color]:color:(never always auto)' ) fi if [[ $OSTYPE = darwin* ]]; then diff --git a/Completion/Unix/Command/_lsof b/Completion/Unix/Command/_lsof index 86115a4ef..754012e3b 100644 --- a/Completion/Unix/Command/_lsof +++ b/Completion/Unix/Command/_lsof @@ -1,9 +1,16 @@ #compdef lsof -local curcontext="$curcontext" state line expl fields args alts suf hsuf pref ret=1 +local curcontext="$curcontext" ret=1 +local -a state line expl args vals fields alts suf hsuf pref case $OSTYPE in - linux*) args=( '-X[skip reporting of info on network connections]' ) ;; + linux*) + args=( + '-E[display endpoint info for pipes, sockets and pseudoterminal files but not files of the endpoints]' + '+E[display endpoint info for pipes, sockets and pseudoterminal files including files of the endpoints]' + '-X[skip reporting of info on network connections]' + ) + ;; solaris*) args=( '-X[include deleted files]' @@ -24,8 +31,8 @@ _arguments -C -s -S $args \ '+D[recursively search from specified dir]:search directory:_files -/' \ '-D[direct use of device cache file]:function:((\?\:report\ device\ cache\ file\ paths b\:build\ the\ device\ cache\ file i\:ignore\ the\ device\ cache\ file r\:read\ the\ device\ cache\ file u\:read\ and\ update\ the\ device\ cache\ file))' \ '*-+e[exempt filesystem from blocking kernel calls]:file system:_directories' \ - '-f[inhibit listing of kernel file structure info]::info type or path:(c f g G n)' \ - '+f[enable listing of kernel file structure info]::info type:(c f g G n)' \ + '-f[inhibit listing of kernel file structure info]::info type:->file-structures' \ + '+f[enable listing of kernel file structure info]::info type:->file-structures' \ '-F[select output fields]:fields:->fields' \ '-g[select by process group id]::process group id' \ '(*)*-i[select internet files]::address:->addresses' \ @@ -93,6 +100,18 @@ case $state in _sequence -s , _wanted -x file-descriptors expl "file descriptor" compadd - \ cwd err jld ltz mem mmap pd rtd tr txt v86 && ret=0 ;; + file-structures) + vals=( + 'g[file flag abbreviations]' + 'G[file flags in hexadecimal]' + ) + [[ $OSTYPE != linux* ]] && vals+=( + 'c[file structure use count]' + 'f[file structure address]' + 'n[file structure node address]' + ) + _values 'kernel file structures' $vals && ret=0 + ;; states) if compset -P 1 '*:'; then _sequence _wanted states expl state compadd - -M 'm:{a-z}={A-Z}' \ diff --git a/Completion/Unix/Command/_luarocks b/Completion/Unix/Command/_luarocks index 30bda1a9a..0915765dc 100644 --- a/Completion/Unix/Command/_luarocks +++ b/Completion/Unix/Command/_luarocks @@ -67,15 +67,8 @@ __luarocks_rock_version(){ fi ;; "installed") - # TODO: actually complete versions of installed rocks using the cache - # How does luarocks handles multiple versions of the same package? - # If anybody knows, please write something beautiful here tree="$2" - if [[ -z "${tree}" ]]; then - _message -e "version for installed rock ${words[$i]}" - else - _message -e "version for installed rock ${words[$i]} on tree ${tree}" - fi + __luarocks_installed_rocks "${tree}" "${words[$i]}" return ;; "new_version") @@ -142,7 +135,7 @@ ___luarocks_installed_rocks_cache_policy(){ # ) if configuration files are newer: # * set and cache the values from the commands above # ) else: - # * retrive from cache the values of the commands above + # * retrieve from cache the values of the commands above # ) end if # ) end if @@ -180,16 +173,16 @@ ___luarocks_installed_rocks_cache_policy(){ local user_manifest_file="${configured_user_tree}/lib/luarocks/rocks-${configured_lua_version}/manifest" local system_manifest_file="${configured_system_tree}/lib/luarocks/rocks-${configured_lua_version}/manifest" - local cache_status=1 + local cache_status=0 if [[ -f ${cache_file} ]]; then if [[ -f ${user_manifest_file} ]]; then - if [[ ${user_manifest_file} -nt ${cache_file} ]]; then - cache_status=0 + if [[ ${cache_file} -nt ${user_manifest_file} ]]; then + cache_status=1 fi fi if [[ -f ${system_manifest_file} ]]; then - if [[ ${system_manifest_file} -nt ${cache_file} ]]; then - cache_status=0 + if [[ ${cache_file} -nt ${system_manifest_file} ]]; then + cache_status=1 fi fi fi @@ -197,12 +190,16 @@ ___luarocks_installed_rocks_cache_policy(){ } (( $+functions[__luarocks_installed_rocks] )) || __luarocks_installed_rocks(){ - # This function optionally recieves one argument of the tree in which + # This function optionally receives one argument of the tree in which # installed rocks are searched for. If this argument is used, the installed # rocks which will be completed by this function will not use the cache which # is valid only for installed rocks on default trees like /usr/lib/luarocks # and ~/.luarocks + # + # The second argument (optional as well) is meant for telling the function to + # complete a version of a installed rock and not the rock itself from the list local tree="$1" + local complete_version_for_rock="$2" if [[ -z ${tree} ]]; then local update_policy zstyle -s ":completion:${curcontext}:" cache-policy update_policy @@ -240,7 +237,7 @@ __luarocks_installed_rocks(){ if _cache_invalid luarocks_installed_descriptions; then rocks_descriptions=() for i in {1.."${#rocks_names[@]}"}; do - name_version_description="$(luarocks show ${rocks_names[$i]} 2>/dev/null | head -2 | tail -1)" + name_version_description="$(luarocks show ${rocks_names[$i]} ${rocks_versions[$i]} 2>/dev/null | head -2 | tail -1)" total_length=${#name_version_description} garbage_length="$((${#rocks_names[$i]} + ${#rocks_versions[$i]} + 5))" description="${name_version_description[${garbage_length},${total_length}]}" @@ -253,7 +250,7 @@ __luarocks_installed_rocks(){ if _cache_invalid luarocks_installed_names_and_descriptions; then rocks_names_and_descriptions=() for i in {1.."${#rocks_names[@]}"}; do - name_and_description=${rocks_names[$i]}:${rocks_descriptions[$i]} + name_and_description=${rocks_names[$i]}:"${rocks_versions[$i]} "${rocks_descriptions[$i]} rocks_names_and_descriptions+=(${name_and_description}) done else @@ -275,7 +272,7 @@ __luarocks_installed_rocks(){ done rocks_descriptions=() for i in {1.."${#rocks_names[@]}"}; do - name_version_description="$(luarocks show ${rocks_names[$i]} 2> /dev/null | head -2 | tail -1)" + name_version_description="$(luarocks show ${rocks_names[$i]} ${rocks_versions[$i]} 2> /dev/null | head -2 | tail -1)" total_length=${#name_version_description} garbage_length="$((${#rocks_names[$i]} + ${#rocks_versions[$i]} + 5))" description="${name_version_description[${garbage_length},${total_length}]}" @@ -283,13 +280,32 @@ __luarocks_installed_rocks(){ done rocks_names_and_descriptions=() for i in {1.."${#rocks_names[@]}"}; do - name_and_description=${rocks_names[$i]}:${rocks_descriptions[$i]} + name_and_description=${rocks_names[$i]}:"${rocks_versions[$i]} "${rocks_descriptions[$i]} rocks_names_and_descriptions+=(${name_and_description}) done fi - _describe 'installed rocks' rocks_names_and_descriptions + if [[ -z "$complete_version_for_rock" ]]; then + _describe 'installed rock' rocks_names_and_descriptions + else + if [[ ! -z "${rocks_names[(r)${complete_version_for_rock}]}" ]]; then # checks if the requested rock exists in the list of rocks_names + local rock="${complete_version_for_rock}" + local first_match_index=${rocks_names[(i)${rock}]} + local last_match_index=${rocks_names[(I)${rock}]} + local versions=() + for i in {${first_match_index}..${last_match_index}}; do + versions+=("${rocks_versions[$i]}") + done + _values "rock's version" $versions + else + if [[ -z "${tree}" ]]; then + _message -r "no such rock installed" + else + _message -r "no such rock installed in tree ${tree}" + fi + fi + fi } -# Used to complete one or more of the followings: +# Used to complete one or more of the following: # - .rockspec file # - .src.rock file # - external rock @@ -386,7 +402,7 @@ local doc_command_options=( _luarocks_doc(){ _arguments \ "${doc_command_options[@]}" \ - '1: :{__luarocks_rock "installed" '"${opt_args[--tree]}"'}' + "1: :{__luarocks_rock installed ${opt_args[--tree]}}" } # arguments: # - must: external only rockspec @@ -508,8 +524,8 @@ local remove_command_options=( _luarocks_remove(){ _arguments -A "-*" \ "${remove_command_options[@]}" \ - '1: :{__luarocks_rock "installed" '"${opt_args[--tree]}"'}' \ - '2:: :{__luarocks_rock_version "installed" '"${opt_args[--tree]}"'}' + "1: :{__luarocks_rock installed ${opt_args[--tree]}}" \ + "2:: :{__luarocks_rock_version installed ${opt_args[--tree]}}" } # arguments: # - must: string as a search query @@ -542,7 +558,8 @@ local show_command_options=( _luarocks_show(){ _arguments \ "${show_command_options[@]}" \ - "1: :{__luarocks_rock 'installed' "${opt_args[--tree]}"}" + "1: :{__luarocks_rock installed "${opt_args[--tree]}"}" \ + "2:: :{__luarocks_rock_version installed ${opt_args[--tree]}}" } (( $+functions[_luarocks_test] )) || diff --git a/Completion/Unix/Command/_lz4 b/Completion/Unix/Command/_lz4 index d69091d00..2697c4d11 100644 --- a/Completion/Unix/Command/_lz4 +++ b/Completion/Unix/Command/_lz4 @@ -44,7 +44,7 @@ args=( + b # Benchmark-mode options "(C c d t)-b-[benchmark file using specified compression level]::compression level:(${(j< >)levels//-/})" "(C c d t)-e-[specify upper compression level limit (with -b)]:compression level:(${(j< >)levels//-/})" - '(C c d t)-i-[specifiy minimum evaluation time (with -b)]:evaluation time (seconds)' + '(C c d t)-i-[specify minimum evaluation time (with -b)]:evaluation time (seconds)' + c # Compress-mode options "(b d t ${(j< >)levels} -c0 -c1 -c2 -hc)"${^levels} '(B b d t -m -r --multiple)-l[compress using legacy (Linux kernel) format]' diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make index e23906373..21ed56184 100644 --- a/Completion/Unix/Command/_make +++ b/Completion/Unix/Command/_make @@ -118,40 +118,14 @@ _make-parseMakefile () { done } -_make-findBasedir () { - local file index basedir - basedir=$PWD - for (( index=0; index < $#@; index++ )) - do - if [[ $@[index] == -C ]] - then - file=${~@[index+1]} 2>/dev/null - if [[ -z $file ]] - then - # make returns with an error if an empty arg is given - # even if the concatenated path is a valid directory - return - elif [[ $file == /* ]] - then - # Absolute path, replace base directory - basedir=$file - else - # Relative, concatenate path - basedir=$basedir/$file - fi - fi - done - print -- $basedir -} - _make() { - local prev="$words[CURRENT-1]" file expl tmp is_gnu incl match + local prev="$words[CURRENT-1]" file expl tmp is_gnu incl match basedir nul=$'\0' local context state state_descr line local -a option_specs local -A VARIABLES VAR_ARGS opt_args local -aU TARGETS keys - local ret=1 + local -i cdir=-1 ret=1 # VAR=VAL on the current command line for tmp in $words; do @@ -168,18 +142,18 @@ _make() { incl="(-|)include" option_specs=( '(-B --always-make)'{-B,--always-make}'[unconditionally make all targets]' - '*'{-C,--directory=}'[change directory first]:change to directory:->dir' + '*'{-C,--directory=}'[change directory first]:change to directory:->cdir' '-d[print lots of debug information]' '--debug=-[print various types of debug information]:debug options:->debug' '(-e --environment-overrides)'{-e,--environment-overrides}'[environment variables override makefiles]' - '--eval=-[evaluate STRING as a makefile statement]:STRING' - '(-f --file --makefile)'{-f,--file=,--makefile=}'[read FILE as a makefile]:makefile:->file' + \*{-E+,--eval=-}'[evaluate string as a makefile statement]:string' + '(-f --file --makefile)'{-f,--file=,--makefile=}'[read specified file as a makefile]:makefile:->file' '(- *)'{-h,--help}'[print help message and exit]' '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors from recipes]' - '*'{-I,--include-dir=}'[search DIRECTORY for included makefiles]:search path for included makefile:->dir' - '(-j --jobs)'{-j+,--jobs=}'[allow N jobs at once; infinite jobs with no arg]:number of jobs' + '*'{-I,--include-dir=}'[search specified directory for included makefiles]:search path for included makefile:->dir' + '(-j --jobs)'{-j+,--jobs=}'[allow specified number of parallel jobs; unlimited jobs with no arg]:: : _guard "[0-9]#" "number of jobs"' '(-k --keep-going)'{-k,--keep-going}"[keep going when some targets can't be made]" - '(-l --load-average --max-load)'{-l,--load-average=,--max-load}"[don't start multiple jobs unless load is below N]:load" + '(-l --load-average --max-load)'{-l,--load-average=,--max-load}"[don't start multiple jobs unless load is below specified value]:load" '(-L --check-symlink-times)'{-L,--check-symlink-times}'[use the latest mtime between symlinks and target]' '(-n --just-print --dry-run --recon)'{-n,--just-print,--dry-run,--recon}"[don't actually run any recipe; just print them]" '*'{-o,--old-file=,--assume-old=}"[consider specified file to be old and don't remake it]:file not to remake:->file" @@ -189,12 +163,13 @@ _make() { '(-r --no-builtin-rules)'{-r,--no-builtin-rules}'[disable the built-in implicit rules]' '(-R --no-builtin-variables)'{-R,--no-builtin-variables}'[disable the built-in variable settings]' '(-s --silent --quiet)'{-s,--silent,--quiet}"[don't echo recipes]" + '--no-silent[echo recipes (disable --silent mode)]' '(-S --no-keep-going --stop)'{-S,--no-keep-going,--stop}'[turns off -k]' '(-t --touch)'{-t,--touch}'[touch targets instead of remaking them]' '(- *)'{-v,--version}'[print the version number of make and exit]' '(-w --print-directory)'{-w,--print-directory}'[print the current directory]' '--no-print-directory[turn off -w, even if it was turned on implicitly]' - '*'{-W,--what-if=,--new-file=,--assume-new=}'[consider FILE to be infinitely new]:file to treat as modified:->file' + '*'{-W,--what-if=,--new-file=,--assume-new=}'[consider specified file to be infinitely new]:file to treat as modified:->file' '--warn-undefined-variables[warn when an undefined variable is referenced]' '--warn-undefined-functions[warn when an undefined user function is called]' ) @@ -202,7 +177,7 @@ _make() { # Basic make options only. incl=.include option_specs=( - '-C[change directory first]:directory:->dir' + '-C[change directory first]:directory:->cdir' '-I[include directory for makefiles]:directory:->dir' '-f[specify makefile]:makefile:->file' '-o[specify file not to remake]:file not to remake:->file' @@ -213,15 +188,19 @@ _make() { _arguments -s $option_specs \ '*:make target:->target' && ret=0 + [[ $state = cdir ]] && cdir=-2 + basedir=${(j./.)${${~"${(@s.:.):-$PWD:${(Q)${opt_args[-C]:-$opt_args[--directory]}//\\:/$nul}}"}[(R)/*,cdir]}//$nul/:} + VAR_ARGS[CURDIR]="${basedir}" + case $state in - (dir) + (*dir) _description directories expl "$state_descr" - _files "$expl[@]" -W ${(q)$(_make-findBasedir ${words[1,CURRENT-1]})} -/ && ret=0 + _files "$expl[@]" -W $basedir -/ && ret=0 ;; (file) _description files expl "$state_descr" - _files "$expl[@]" -W ${(q)$(_make-findBasedir $words)} && ret=0 + _files "$expl[@]" -W $basedir && ret=0 ;; (debug) @@ -238,11 +217,9 @@ _make() { file=${(v)opt_args[(I)(-f|--file|--makefile)]} if [[ -n $file ]] then - [[ $file == [^/]* ]] && file=${(q)$(_make-findBasedir $words)}/$file + [[ $file == [^/]* ]] && file=$basedir/$file [[ -r $file ]] || file= else - local basedir - basedir=${$(_make-findBasedir $words)} if [[ $is_gnu == gnu && -r $basedir/GNUmakefile ]] then file=$basedir/GNUmakefile @@ -262,7 +239,7 @@ _make() { if [[ $is_gnu == gnu ]] then if zstyle -t ":completion:${curcontext}:targets" call-command; then - _make-parseMakefile < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null) + _make-parseMakefile < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" --always-make 2> /dev/null) else _make-parseMakefile < $file fi @@ -286,7 +263,7 @@ _make() { _alternative \ 'targets:make target:compadd -Q -a TARGETS' \ 'variables:make variable:compadd -S = -F keys -k VARIABLES' \ - '*:file:_files' && ret=0 + '*:file:_files -W $basedir' && ret=0 fi esac diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man index 41ae85a1f..7d55201e3 100644 --- a/Completion/Unix/Command/_man +++ b/Completion/Unix/Command/_man @@ -381,7 +381,12 @@ _man() { (( $#sects )) || return 1 - _tags manuals.${^sects} + if [[ $PREFIX$SUFFIX == */* ]]; then + _tags manuals.${^sects} files + else + _tags manuals.${^sects} + fi + while _tags; do for sect_dirname in $sects; do d=$sect_dirname @@ -390,6 +395,8 @@ _man() { _requested manuals.$sect_dirname expl "manual page, section $d" _man_pages && ret=0 done + [[ $PREFIX$SUFFIX == */* ]] && + _requested files expl directory _files -/ && ret=0 (( ret )) || return 0 done ## To fall back to other sections' manpages when completing filenames, like diff --git a/Completion/Unix/Command/_mkdir b/Completion/Unix/Command/_mkdir index e4308c304..4cd6bda32 100644 --- a/Completion/Unix/Command/_mkdir +++ b/Completion/Unix/Command/_mkdir @@ -1,29 +1,16 @@ #compdef mkdir gmkdir zf_mkdir -local curcontext="$curcontext" state line expl args variant ret=1 +local curcontext="$curcontext" variant ret=1 +local -a state line expl args aopts=( -A '-*' ) typeset -A opt_args args=( '(-m --mode)'{-m,--mode=}'[set permission mode]: :_file_modes' '(-p --parents)'{-p,--parents}'[make parent directories as needed]' - '(-)*: :->directories' + '*: :->directories' ) -# It can still happen that there is a precommand command or builtin in the line. -# In such cases, the variant has to be modified suitably, after further checking -# the variant of the _command_ mkdir. -# -# $precommands is defined in _main_complete -if (( ${+precommands[(r)command]} )); then - _mkdir_command () { command mkdir "$@" } - _pick_variant -c _mkdir_command -r variant gnu=gnu unix --help - unfunction _mkdir_command -elif (( ${+precommands[(r)builtin]} )) || (( ${+builtins[mkdir]} )) || [[ "$(type -w mkdir)" == "*: builtin" ]]; then - variant=zsh -else - _pick_variant -r variant gnu=gnu zsh='\(eval\)' $OSTYPE --help -fi -# Now $variant is set. +_pick_variant -r variant -b zsh gnu=gnu $OSTYPE --help case $variant in gnu|freebsd*|dragonfly*|darwin*) @@ -32,9 +19,11 @@ case $variant in ) ;| gnu) + aopts=() if [[ $OSTYPE == linux* ]]; then args+=( - '(-Z --context)'{-Z,--context=}'[set SELinux context]:SELinux context' + '(--context)-Z[set SELinux context]' + '(-Z)--context=-[set SELinux context]::SELinux context:_selinux_contexts' ) fi args+=( @@ -47,12 +36,12 @@ case $variant in ;; esac -_arguments -C -s $args && ret=0 +_arguments -C -s -S $aopts $args && ret=0 case "$state" in directories) _wanted directories expl \ - 'parent directory (alternatively specify name of directory)' \ + 'parent directory or name of directory to create' \ _path_files -/ && ret=0 ;; esac diff --git a/Completion/Unix/Command/_mkfifo b/Completion/Unix/Command/_mkfifo index 4f1d8c87e..a055e4a1c 100644 --- a/Completion/Unix/Command/_mkfifo +++ b/Completion/Unix/Command/_mkfifo @@ -10,7 +10,7 @@ if _pick_variant gnu='Free Soft' unix --version; then ) [[ $OSTYPE == linux* ]] && args+=( '(--context)-Z[set SELinux security context to default]' - '(-Z)--context=-[like -Z, or specify SELinux security context]:SELinux security context' + '(-Z)--context=-[like -Z, or specify SELinux security context]::SELinux security context:_selinux_contexts' ) else aopts=( -A '-*' ) diff --git a/Completion/Unix/Command/_mknod b/Completion/Unix/Command/_mknod index 902f49b9f..8f07328db 100644 --- a/Completion/Unix/Command/_mknod +++ b/Completion/Unix/Command/_mknod @@ -22,7 +22,7 @@ if _pick_variant gnu='Free Soft' $OSTYPE --version; then ) [[ $OSTYPE == linux* ]] && args+=( '(--context)-Z[set SELinux security context to default]' - '(-Z)--context=-[like -Z, or specify SELinux security context]:SELinux security context' + '(-Z)--context=-[like -Z, or specify SELinux security context]::SELinux security context:_selinux_contexts' ) else aopts=( -A '-*' ) diff --git a/Completion/Unix/Command/_moosic b/Completion/Unix/Command/_moosic index f22fe16c5..54d768c8c 100644 --- a/Completion/Unix/Command/_moosic +++ b/Completion/Unix/Command/_moosic @@ -83,7 +83,7 @@ _moosic_add_cmds() { "noloop:turn loop mode off" "toggle-loop:toggle loop mode" "reconfigure:daemon reload configuration file" - "showconfig:show dameon filetype associations" + "showconfig:show daemon filetype associations" "start-server:starts new instance of daemon with given options" {quit,exit,die}":quit daemon" ) diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc index 0f292ab4c..7f7adc7b4 100644 --- a/Completion/Unix/Command/_mpc +++ b/Completion/Unix/Command/_mpc @@ -69,6 +69,7 @@ _mpc_command() { find:"search for a song, exact match" findadd:"find songs and add them to the current playlist" list:"list all tags of given type" + listneighbors:"list neighbors" seek:"seek to the position specified in percent" seekthrough:"seek by an amount of time within the song and playlist" shuffle:"shuffle the current playlist" diff --git a/Completion/Unix/Command/_mv b/Completion/Unix/Command/_mv index 3592efee6..84e43d47e 100644 --- a/Completion/Unix/Command/_mv +++ b/Completion/Unix/Command/_mv @@ -1,42 +1,55 @@ -#compdef mv gmv +#compdef mv gmv zf_mv -local args -if _pick_variant gnu=GNU unix --version; then - args=( - '(-b --backup -n --no-clobber)--backup=[make a backup of each existing destination file]: : _values "backup type" - {none,off}"[never make backups]" - {numbered,t}"[make numbered backups]" - {existing,nil}"[numbered backups, if they already exist]" - {simple,never}"[always make simple backups]"' - '(-b --backup -n --no-clobber)-b[make a backup of each existing destination file]' - '(-f --force -i --interactive -n --no-clobber)'{-f,--force}"[don't prompt before overwriting]" - '(-f --force -i --interactive -n --no-clobber)'{-i,--interactive}'[prompt before overwriting existing file]' - '--strip-trailing-slashes[remove any trailing slashes from each source argument]' - '(-S --suffix)'{-S+,--suffix=}'[specify the backup suffix]:backup suffix [~]' - '(-t --target-directory)'{-t+,--target-directory=}'[move all source arguments into specified directory]:directory:_directories' - '(-T --no-target-directory)'{-T,--no-target-directory}'[treat final argument as a normal file]' - '(-u --update)'{-u,--update}'[move only when destination file is older or missing]' - '(-v --verbose)'{-v,--verbose}'[show file names after they are moved]' - '(- *)--help[display usage information]' - '(- *)--version[display version information]' - ) - [[ $OSTYPE = linux* ]] && args+=( - '(-Z --context)'{-Z,--context}'[set SELinux security context of destination file to default type]' - ) -else - local pattern arg - args=( - "(-i -n)-f[don't prompt before overwriting]" - '(-f -n)-i[prompt before overwriting existing file]' - ) - for pattern arg in \ - '(darwin|dragonfly|freebsd)*' "(-f -i)-n[don't overwrite existing file]" \ - '(darwin|dragonfly|*bsd)*' '-v[show file names after they are moved]' \ - '(dragonfly|freebsd)*' "-h[if target is a symlink to a directory, don't follow it]" - do - [[ $OSTYPE = $~pattern ]] && args+=( $arg ) - done -fi +local args variant aopts=( -A '-*' ) -_arguments -s -S $args \ - '*:file:_files' +_pick_variant -r variant -b zsh gnu=GNU $OSTYPE --version +case $variant; in + gnu) + aopts=() + args=( + '(-b --backup -n --no-clobber)--backup=[make a backup of each existing destination file]: : _values "backup type" + {none,off}"[never make backups]" + {numbered,t}"[make numbered backups]" + {existing,nil}"[numbered backups, if they already exist]" + {simple,never}"[always make simple backups]"' + '(-b --backup -n --no-clobber)-b[make a backup of each existing destination file]' + '(-f --force -i --interactive -n --no-clobber)'{-f,--force}"[don't prompt before overwriting]" + '(-f --force -i --interactive -n --no-clobber)'{-i,--interactive}'[prompt before overwriting existing file]' + '--strip-trailing-slashes[remove any trailing slashes from each source argument]' + '(-S --suffix)'{-S+,--suffix=}'[specify the backup suffix]:backup suffix [~]' + '(-t --target-directory)'{-t+,--target-directory=}'[move all source arguments into specified directory]:directory:_directories' + '(-T --no-target-directory)'{-T,--no-target-directory}'[treat final argument as a normal file]' + '(-u --update)'{-u,--update}'[move only when destination file is older or missing]' + '(-v --verbose)'{-v,--verbose}'[show file names after they are moved]' + '(- *)--help[display usage information]' + '(- *)--version[display version information]' + ) + [[ $OSTYPE = linux* ]] && args+=( + '(-Z --context)'{-Z,--context}'[set SELinux security context of destination file to default type]' + ) + ;; + *) + args=( + "(-i -n)-f[don't prompt before overwriting]" + '(-f -n)-i[prompt before overwriting existing file]' + ) + ;| + darwin*|dragonfly*|freebsd*) + args+=( + "(-f -i)-n[don't overwrite existing file]" + ) + ;| + darwin*|dragonfly*|*bsd*) + args+=( + '-v[show file names after they are moved]' + ) + ;| + dragonfly*|freebsd*) + args+=( + "-h[if target is a symlink to a directory, don't follow it]" + ) + ;; +esac + +_arguments -s -S $aopts $args \ + '*: :_files' diff --git a/Completion/Unix/Command/_myrepos b/Completion/Unix/Command/_myrepos new file mode 100644 index 000000000..d26c1245b --- /dev/null +++ b/Completion/Unix/Command/_myrepos @@ -0,0 +1,126 @@ +#compdef mr + +# +# A zsh completion script for myrepos (http://myrepos.branchable.com/) +# + +# This script does not handle user defined alias nor user defined actions (lib, +# plugins) + + +local curcontext="$curcontext" state state_descr line ret=1 +local -a arguments +typeset -A opt_args +typeset -g mr_subcommands mr_alias + +arguments=( + '(-d --directory)'{-d,--directory}'[specify the topmost directory that mr should work in]:directory:_files -/' + '(-c --config)'{-c,--config}'[use the specified mrconfig file]:mrconfig:_files' + '(-f --force)'{-f,--force}'[force mr to act on repositories that would normally be skipped]' + '--force-env[force mr to execute even though potentially dangerous env variables]' + '(-v --verbose)'{-v,--verbose}'[be verbose]' + '(-m --minimal)'{-m,--minimal}'[minimise output]' + '(-q --quiet)'{-q,--quiet}"[suppress mr's usual output]" + '(-k --insecure)'{-k,--insecure}'[accept untrusted SSL certificates when bootstrapping]' + '(-s --stats)'{-s,--stats}'[expand the statistics line displayed at the end]' + '(-i --interactive)'{-i,--interactive}'[start a subshell if a repository fails to be processed]' + '(-n --no-recurse)'{-n,--no-recurse}'[specify the recursivity depth into repositories]::number' + '(-j --jobs)'{-j,--jobs}'[number of jobs run in parallel]::number' + '--cache[save the command result to ~/.mrcache/]' + '--cached[process cached commands]' + '--uncache[remove the cached output]' + '--top[cd to the top of the repo before running any commands]' + '(-t --trust-all)'{-t,--trust-all}'[trust all mrconfig files]' + \!{-p,--path} # this obsolete flag is ignored + ':mr commands:->subcommand' + '*::: := ->option-or-argument' +) + +_arguments -C $arguments && ret=0 + +case $state in + (subcommand) + + mr_subcommands=( + "checkout:check out any repositories that are not already checked out" + "update:update each repository" + "status:display a status report for each repository" + "clean:print/remove ignored or untracked files and other cruft" + "commit:commit changes to each repository" + "record:record changes to the local repository" + "fetch:fetch from each repository's remote repository" + "push:push committed local changes to remote repository" + "diff:show a diff of uncommitted changes" + "log:show the commit log" + "grep:search for a pattern in each repository" + "run:run the specified command in each repository" + "bootstrap:use a 'source' as .mrconfig file" + "list:list the repositories that mr will act on" + "register:register an existing repository in a mrconfig file" + "config:get and set value from a mrconfig file" + "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." + ) + + mr_alias=( + "co:check out any repositories that are not already checked out" + "ci:commit changes to each repository" + "ls:list the repositories that mr will act on" + ) + + _describe -t commands 'command' mr_subcommands -- mr_alias && ret=0 + + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (clean) + _arguments \ + '-f[allow removing the files]' \ + '*: :' && ret=0 + ;; + (commit|ci|record) + _arguments \ + '-m[allow specifying a commit message]' \ + '*: :' && ret=0 + ;; + (grep) + _message 'search pattern' + ;; + (run) + _message 'command to run' + ;; + (bootstrap) + if [[ $CURRENT -eq 2 ]]; then + _alternative \ + 'urls:URL:_urls' \ + 'local:local file or stdin:_files' + elif [[ $CURRENT -eq 3 ]]; then + _directories + fi + ;; + (register) + _directories + ;; + (config) + case $CURRENT in + (2) _message -e section 'section name';& + (3) _message -e setting '"setting" or "setting=value"';& + esac + ;; + (remember) + _describe -t commands 'command' mr_subcommands -- mr_alias && ret=0 + ;; + (checkout|co|update|status|fetch|push|diff|log|list|ls|offline|online|help) + _message 'no arguments' + ;; + (*) + _default && ret=0 + ;; + esac + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_netstat b/Completion/Unix/Command/_netstat index c03aae9a2..94aa1688d 100644 --- a/Completion/Unix/Command/_netstat +++ b/Completion/Unix/Command/_netstat @@ -174,8 +174,15 @@ case $OSTYPE in ;| solaris2.<11->) + sets+=( dcache '-[^-]#d*' ) + sel_dcache=( '-d[display the destination cache entry table]' ) + dcache=( $families ) args=( '-T+[specify time format]:time format:((u\:seconds\ since\ epoch d\:standard\ date\ format))' ) - sockets=( '-u[list user, pid and program that created network endpoint]' ) + sockets+=( + '-u[list user, pid and program that created network endpoint]' + '-k[show only sockets with kernel data path bypass enabled]' + '-L[only show state of sockets using SO_REUSEPORT load balancing]' + ) ;& solaris*) args=( -A '-*' $args ) @@ -269,6 +276,7 @@ case $OSTYPE in ) interfaces+=( '-c+[show specified number of updates, then exit]:count' + '-e[show only the number of errors on the interface]' '-q[only show interfaces that have seen packets]' '-t[show current value of the watchdog timer function]' ) diff --git a/Completion/Unix/Command/_nkf b/Completion/Unix/Command/_nkf index 04977e467..0c4f06fb5 100644 --- a/Completion/Unix/Command/_nkf +++ b/Completion/Unix/Command/_nkf @@ -33,7 +33,7 @@ _arguments -s \ '($inputs)-W16l[Input assumption is UTF-16 (Little Endian; BOM)]' \ '(-M)-m-[MIME decode]:mime decode:((B\:base64 Q\:quoted S\:strict N\:non-strict 0\:no-decode))' \ '(-m)-M-[MIME encode]:mime encode:((\:header B\:base64 Q\:quoted))' \ - '-h-[hirakana<->katakana]:hirakata:((1\:hirakana-\>katakana 2\:katakana-\>hirakana 3\:both))' \ + '-h-[hiragana<->katakana]:hirakata:((1\:hiragana-\>katakana 2\:katakana-\>hiragana 3\:both))' \ '-L-[line mode]:line mode:((u\:LF w\:CRLF m\:CR))' \ '-I[convert non ISO-2022-JP character to GETA]' \ '(--cap-input --url-input)'{--cap-input,--url-input}'[Convert hex after \: or \%]' \ diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm index 146a69e8a..423fd3223 100644 --- a/Completion/Unix/Command/_nm +++ b/Completion/Unix/Command/_nm @@ -59,8 +59,10 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu binutils) compset -P '@' && files='*:options file:_files' args+=( + '!(--no-recurse-limit)--recurse-limit' + '--no-recurse-limit[disable demangling recursion limit]' '(-f --format -P)-f+[specify output format]:format:(bsd sysv posix)' - '(-C --no-demangle)--demangle=-[decode symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat)' + '(-C --no-demangle)--demangle=-[decode symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat rust dlang)' '--plugin[load specified plugin]:plugin' '--special-syms[include special symbols in the output]' '--synthetic[display synthetic symbols as well]' diff --git a/Completion/Unix/Command/_notmuch b/Completion/Unix/Command/_notmuch deleted file mode 100644 index 6174d2c00..000000000 --- a/Completion/Unix/Command/_notmuch +++ /dev/null @@ -1,81 +0,0 @@ -#compdef notmuch - -_notmuch_commands() -{ - local -a notmuch_commands - notmuch_commands=( - 'setup:interactively set up notmuch for first use' - 'new:find and import any new message to the database' - 'insert:add a new message into the maildir and notmuch database' - 'search:search for messages matching the search terms, display matching threads as results' - 'address:get addresses from messages matching the given search terms' - 'reply:constructs a reply template for a set of messages' - 'show:show all messages matching the search terms' - 'tag:add or remove tags for all messages matching the search terms' - 'dump:creates a plain-text dump of the tags of each message' - 'restore:restores the tags from the given file' - 'compact:compact the notmuch database' - 'reindex:re-index all messages matching the search terms' - 'help:show details on a command' - 'compact:compact the notmuch database' - 'config:access the notmuch configuration file' - 'count:count messages matching the given search terms' - ) - - _describe -t command 'command' notmuch_commands -} - -_notmuch_dump() -{ - _files -} - -_notmuch_help_topics() -{ - local -a notmuch_help_topics - notmuch_help_topics=( - 'search-terms:common search-term syntax' - 'hooks:hooks that will be run before or after certain commands' - 'properties:message property conventions and documentation' - ) - _describe -t notmuch-help-topics 'topic' notmuch_help_topics -} - -_notmuch_help() -{ - _alternative \ - _notmuch_commands \ - _notmuch_help_topics -} - -_notmuch_restore() -{ - _files -} - -_notmuch_search() -{ - _arguments -s : \ - '--max-threads=[display only the first x threads from the search results]:number of threads to show: ' \ - '--first=[omit the first x threads from the search results]:number of threads to omit: ' \ - '--sort=[sort results]:sorting:((newest-first\:"reverse chronological order" oldest-first\:"chronological order"))' -} - -_notmuch() -{ - local ret=1 - if (( CURRENT > 2 )) ; then - local cmd=${words[2]} - curcontext="${curcontext%:*:*}:notmuch-$cmd" - (( CURRENT-- )) - shift words - if ! _call_function ret _notmuch_$cmd; then - _default && ret=0 - fi - return ret - else - _notmuch_commands - fi -} - -_notmuch "$@" diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump index ee2f3ea6f..989cd3f0b 100644 --- a/Completion/Unix/Command/_objdump +++ b/Completion/Unix/Command/_objdump @@ -1,123 +1,133 @@ #compdef objdump eu-objdump llvm-objdump -local opts args files variant curcontext=$context state state_descr line ret=1 +local curcontext="$curcontext" files variant ign ret=1 +local -a opts args state state_descr line typeset -A opt_args files='*:object file:_object_files' - +(( $#words > 2 )) && ign='!' _pick_variant -r variant binutils=GNU elfutils=elfutils llvm=LLVM unix --version -opts=( -s -S ) # options for _arguments +opts=( -s -S ) # options to _arguments itself args=( - "(-d --disassemble)"{-d,--disassemble}"[Display assembler code of executable sections]" - "(-r --reloc)"{-r,--reloc}"[Display relocation information]" - "(-s --full-contents)"{-s,--full-contents}"[Display the full contents of all sections requested]" - "*"{-j+,--section=}"[Only display information for section]:section:(.bss .data .dynamic .dynsym .got .interp .shstrtab .symtab .text)" + '(-d --disassemble)'{-d,--disassemble}'[display assembler code of executable sections]' + '(-r --reloc)'{-r,--reloc}'[display relocation information]' + '(-s --full-contents)'{-s,--full-contents}'[display the full contents of all sections requested]' + \*{-j+,--section=}'[only display information for section]:section:(.bss .data .dynamic .dynsym .got .interp .shstrtab .symtab .text)' ) case $variant in binutils) + compset -P '@' && files='*:options file:_files' args+=( - "(-a --archive-headers)"{-a,--archive-headers}"[Display archive header information]" - "(-f --file-headers)"{-f,--file-headers}"[Display the contents of the overall file header]" - "(-p --private-headers)"{-p,--private-headers}"[Display object format specific file header contents]" - "*"{-P,--private=}"[Display object format specific contents]:option" - "(-h --section-headers --headers)"{-h,--section-headers,--headers}"[Display the contents of the section headers]" - "(-x --all-headers)"{-x,--all-headers}"[Display the contents of all headers]" - "(-D --disassemble-all)"{-D,--disassemble-all}"[Display assembler contents of all sections]" - "(-S --source)"{-S,--source}"[Intermix source code with disassembly]" - "(-g --debugging)"{-g,--debugging}"[Display debug information in object file]" - "(-e --debugging-tags)"{-e,--debugging-tags}"[Display debug information using ctags style]" - "(-G --stabs)"{-G,--stabs}"[Display (in raw form) any STABS info in the file]" + '!(--no-recurse-limit)--recurse-limit' + '--no-recurse-limit[disable demangling recursion limit]' + '(-a --archive-headers)'{-a,--archive-headers}'[display archive header information]' + '(-f --file-headers)'{-f,--file-headers}'[display contents of the overall file header]' + '(-p --private-headers)'{-p,--private-headers}'[display object format specific file header contents]' + \*{-P+,--private=}'[display information specific to the object format]:option' + '(-h --section-headers --headers)'{-h,--section-headers,--headers}'[display contents of the section headers]' + '(-x --all-headers)'{-x,--all-headers}'[display the contents of all headers]' + '--disassemble=[display assembler contents for specified symbol]:symbol' + '(-D --disassemble-all)'{-D,--disassemble-all}'[display assembler contents of all sections]' + '(-S --source)'{-S,--source}'[intermix source code with disassembly]' + '--source-comment=-[prefix lines of source code with specified text]::text prefix [# ]' + '(-g --debugging)'{-g,--debugging}'[display debug information in object file]' + '(-e --debugging-tags)'{-e,--debugging-tags}'[display debug information using ctags style]' + '(-G --stabs)'{-G,--stabs}'[display (in raw form) any STABS info in the file]' + + '*-W-[display DWARF info in the file]::dwarf section:->short-dwarf-names' + '*--dwarf=-[display DWARF info in the file]::dwarf section:->dwarf-names' - "*-W-[Display DWARF info in the file]::dwarf section:->short_dwarf_names" - "*--dwarf=-[Display DWARF info in the file]::dwarf section:->dwarf_names" + '--ctf=[display compact C type format info for section]:section' + '(-t --syms)'{-t,--syms}'[display the contents of the symbol table(s)]' + '(-T --dynamic-syms)'{-T,--dynamic-syms}'[display the contents of the dynamic symbol table]' + '(-R --dynamic-reloc)'{-R,--dynamic-reloc}'[display the dynamic relocation entries in the file]' - "(-t --syms)"{-t,--syms}"[Display the contents of the symbol table(s)]" - "(-T --dynamic-syms)"{-T,--dynamic-syms}"[Display the contents of the dynamic symbol table]" - "(-R --dynamic-reloc)"{-R,--dynamic-reloc}"[Display the dynamic relocation entries in the file]" - #@<file> Read options from <file> + "${ign}(- *)"{-v,--version}"[display version information]" + "${ign}(- *)"{-i,--info}"[list supported object formats and architectures]" + "${ign}(- *)"{-H,--help}"[display usage information]" - "(- *)"{-v,--version}"[Display this program's version number]" - "(- *)"{-i,--info}"[List object formats and architectures supported]" - "(- *)"{-H,--help}"[Display this information]" - - "(-b --target)"{-b+,--target=}"[Specify the target object format]:bfdname:->bfdname" - "(-m --architecture)"{-m+,--architecture=}"[Specify the target architecture]:machine:->machine" - "*"{-M+,--disassembler-options=}"[Pass text OPT on to the disassembler]:opt:->disassembler_options" + '(-b --target)'{-b+,--target=}'[specify the target object format]:target:->bfdnames' + '(-m --architecture)'{-m+,--architecture=}'[specify the target architecture]:architecture:->architectures' + \*{-M+,--disassembler-options=}'[pass target specific information to the disassembler]:option:->disassembler_options' - "(-E --endian)-E+[Assume endianess when disassembling]:endianess:((B\:\"Assume big endian format when disassembling\" L\:\"Assume little endian format when disassembling\"))" - "(-E --endian)--endian=[Assume endianess when disassembling]:endianess:((big\:\"Assume big endian format when disassembling\" little\:\"Assume little endian format when disassembling\"))" + "(-E --endian)-E+[assume endianness when disassembling]:endianness:((B\:\"assume big endian format when disassembling\" L\:\"assume little endian format when disassembling\"))" + "(-E --endian)--endian=[assume endianness when disassembling]:endianness:((big\:\"assume big endian format when disassembling\" little\:\"assume little endian format when disassembling\"))" - "--file-start-context[Include context from start of file (with -S)]" - "*"{-I+,--include=}"[Add directory to search list for source files]:directory:_files -/" - "(-l --line-numbers)"{-l,--line-numbers}"[Include line numbers and filenames in output]" - "(-F --file-offsets)"{-F,--file-offsets}"[Include file offsets when displaying information]" - "(-C --demangle)-C[Decode mangled/processed symbol names]" - "(-C --demangle)--demangle=-[Decode mangled/processed symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat)" - "(-w --wide)"{-w,--wide}"[Format output for more than 80 columns]" - "(-z --disassemble-zeroes)"{-z,--disassemble-zeroes}"[Do not skip blocks of zeroes when disassembling]" + '--file-start-context[include context from start of file (with -S)]' + \*{-I+,--include=}'[add directory to search list for source files]:directory:_files -/' + '(-l --line-numbers)'{-l,--line-numbers}'[include line numbers and filenames in output]' + '(-F --file-offsets)'{-F,--file-offsets}'[include file offsets when displaying information]' + '(-C --demangle)-C[decode mangled/processed symbol names]' + '(-C --demangle)--demangle=-[decode mangled/processed symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat rust dlang)' + '!(--no-recurse-limit)--recurse-limit' + '--no-recurse-limit[disable demangling recursion limit]' + '(-w --wide)'{-w,--wide}'[format output for more than 80 columns]' + '(-z --disassemble-zeroes)'{-z,--disassemble-zeroes}"[don't skip blocks of zeroes when disassembling]" - "--start-address=[Only process data whose address is >= ADDR]:addr" - "--stop-address=[Only process data whose address is <= ADDR]:addr" - "--prefix-addresses[Print complete address alongside disassembly]" - "(--show-raw-insn --no-show-raw-insn)"--{,no-}show-raw-insn"[Display hex alongside symbolic disassembly]" - "--insn-width=[Display WIDTH bytes on a single line for -d]:width" - "--adjust-vma=[Add offset to all displayed section addresses]:offset" - "--special-syms[Include special symbols in symbol dumps]" - "--prefix=[Add prefix to absolute paths for -S]:prefix" - "--prefix-strip=[Strip initial directory names for -S]:level" - "--dwarf-depth=[Do not display DIEs at depth N or greater]:n" - "--dwarf-start=[Display DIEs starting with N, at the same depth or deeper]:n" - "--dwarf-check[Make additional dwarf internal consistency checks]" + '--start-address=[only process data whose address is >= ADDR]:address' + '--stop-address=[only process data whose address is <= ADDR]:address' + '--prefix-addresses[print complete address alongside disassembly]' + '(--show-raw-insn --no-show-raw-insn)'--{,no-}show-raw-insn'[display hex alongside symbolic disassembly]' + '--insn-width=[display specified number of bytes on a single line with -d]:width (bytes)' + '--adjust-vma=[add offset to all displayed section addresses]:offset' + '--special-syms[include special symbols in symbol dumps]' + '--inlines[print all inlines for source line (with -l)]' + '--prefix=[add prefix to absolute paths for -S]:prefix' + '--prefix-strip=[strip initial directory names for -S]:level' + "--dwarf-depth=[don't display DIEs at specified or greater depth]:depth" + '--dwarf-start=[display DIEs at specified or deeper depth]:depth' + '--dwarf-check[perform additional dwarf internal consistency checks]' + '--ctf-parent=[use specified section as the CTF parent]:section' ) ;; elfutils) args+=( - "--color=-[Colorize the output]::when:(always auto never)" - "(- *)"{-\?,--help}"[Display help]" - "(- *)--usage[Display usage]" - "(- *)"{-V,--version}"[Display program version]" + "--color=-[colorize the output]::when:(always auto never)" + "(- *)"{-\?,--help}"[display help]" + "(- *)--usage[display usage]" + "(- *)"{-V,--version}"[display program version]" ) ;; llvm) opts=( -S ) # no option stacking args=( # start over from an empty array - '-aarch64-neon-syntax=[chose style of NEON code (AArch64)]:style:(generic apple)' - '-arch=[w -macho: select arch from a fat binary]:arch:(i386 x86_64)' - '-arch-name=[specify target arch to disassemble for]:arch:->llvm_targets' - '-archive-headers[w -macho: print archive headers]' + '-aarch64-neon-syntax=[choose style of NEON code (AArch64)]:style:(generic apple)' + '-arch=[select arch from a fat binary (with -macho)]:architecture:(i386 x86_64)' + '-arch-name=[specify target arch to disassemble for]:architecture:->llvm_targets' + '-archive-headers[print archive headers (with -macho)]' '-archive-member-offsets[w -macho -archive-headers: print offset to each archive member]' '-bind[display Mach-O binding info]' - '-color[use colored syntax highlighting]' - '-data-in-code[w -macho: print data in code table]' - "-dis-symname=[w -macho: disassemble just the specfied symbol's instructions]" + '-color[use color syntax highlighting]' + '-data-in-code[print data in code table (with -macho)]' + "-dis-symname=[disassemble just the specified symbol's instructions (with -macho)]" '(-disassemble -d)'{-disassemble,-d}'[display assembler mnemonics for machine instructions]' '(-disassemble-all -D)'{-disassemble-all,-D}'[disassemble all instruction sections]' - '-dsym=[w -macho -g: use the specified .dSYM file for debug info]:dsym file:_files' + '-dsym=[use the specified .dSYM file for debug info (with -macho)]:dsym file:_files' '-dwarf=[dump of dwarf debug section]:section:(frames)' - "-dyld-id[w -macho: print the shared library's id for dylib Mach-O file]" - '-dylibs-used[w -macho: print the shared libraries used for linked Mach-O files]' + "-dyld-id[print the shared library's id for dylib Mach-O file (with -macho)]" + '-dylibs-used[print the shared libraries used for linked Mach-O files (with -macho)]' '-exports-trie[display Mach-O exported symbols]' '-fault-map-section[display contents of faultmap section]' '-filter-print-funcs=[only print IR for the specified functions]:function names' - '-full-leading-addr[w -macho: print full leading address]' - '-g[w -macho: print line information from debug info if available]' - '-indirect-symbols[w -macho: print indirect symbol table]' - '-info-plist[w -macho: print the info plist section]' + '-full-leading-addr[print full leading address (with -macho)]' + '-g[print line information from debug info if available (with -macho)]' + '-indirect-symbols[print indirect symbol table (with -macho)]' + '-info-plist[print the info plist section (with -macho)]' '-lazy-bind[display Mach-O lazy binding info]' '(-line-numbers -l)'{-line-numbers,-l}'[display source line numbers with disassembly]' - '-link-opt-hints[w -macho: print the linker optimization hints]' + '-link-opt-hints[print the linker optimization hints (with -macho)]' '(-macho -m)'{-macho,-m}'[use Mach-O specific object file parser]' '*-mattr=[target specific attributes]:attributes' '-mcpu=[specify target cpu type]:cpu type' - '-no-leading-addr[w -macho: print no leading address]' + '-no-leading-addr[print no leading address (with -macho)]' '-no-leading-headers[print no leading headers]' - '-no-show-raw-insn[do not print instruction bytes when disassembling]' - '-no-symbolic-operands[w -macho: do not print operands symbolically when disassembling]' - '-non-verbose[w -macho: print info in non-verbose form]' - '-objc-meta-data[w -macho: print Objective-C runtime meta data]' + "-no-show-raw-insn[don't print instruction bytes when disassembling]" + "-no-symbolic-operands[don't print operands symbolically when disassembling (with -macho)]" + '-non-verbose[print info in non-verbose form (with -macho)]' + '-objc-meta-data[print Objective-C runtime meta data (with -macho)]' '-print-after-all[print IR after each pass]' '-print-before-all[print IR before each pass]' '-print-imm-hex[use hex format for immediate values]' @@ -128,22 +138,22 @@ case $variant in '-rebase[display Mach-O rebasing info]' '-rng-seed=[seed for the random number generator]:seed' '-s[display contents of each section]' - '*'{-section=,-j}'[operate on the specified section only]:section' + \*{-section=,-j}'[operate on the specified section only]:section' '(-section-headers -h)'{-section-headers,-h}'[display summaries of the headers for each section]' '(-source -S)'{-source,-S}'[display source inlined with disassembly]' '-start-address=[start disassembly at the specified address]:address' '-stop-address=[stop disassembly at the specified address]:address' - '-t[display the symbol talbe]' + '-t[display the symbol table]' '-time-passes[time each pass, print elapsed time on exit]' '-triple=[target triple to disassemble for]:triple' - '-universal-headers[w -macho: print Mach-O universal headers]' + '-universal-headers[print Mach-O universal headers (with -macho)]' '-verify-dom-info[verify dominator info (time consuming)]' '-unwind-info[display unwind information]' '-weak-bind[display Mach-O weak binding info]' - '-x86-asm-syntax=[chose style of assembler code (x86)]:style:(att intel)' - '(- *)-help[display available options]' - '(- *)-help-list[display list of available options]' - '(- *)-version[display version of objdump]' + '-x86-asm-syntax=[choose style of assembler code (x86)]:style:(att intel)' + "${ign}(- *)-help[display available options]" + "${ign}(- *)-help-list[display list of available options]" + "${ign}(- *)-version[display version of objdump]" ) ;; esac @@ -151,24 +161,34 @@ esac _arguments $opts -C : "$args[@]" $files && ret=0 case "$state" in - short_dwarf_names) - _values -s "" "dwarf section" "l[rawline]" "L[decodedline]" "i[info]" "a[abbrev]" "p[pubnames]" "r[aranges]" "m[macro]" "f[frames]" "F[frames-interp]" "s[str]" "o[loc]" "R[Ranges]" "t[pubtypes]" "U[trace_info]" "u[trace_abbrev]" "g[gdb_index]" "T[trace_aranges]" "A[addr]" "c[cu_index]" "k[links]" "K[follow-links]" && ret=0 + short-dwarf-names) + _values -s "" "dwarf section" \ + "l[rawline]" "L[decodedline]" "i[info]" "a[abbrev]" "p[pubnames]" \ + "r[aranges]" "m[macro]" "f[frames]" "F[frames-interp]" "s[str]" \ + "o[loc]" "R[ranges]" "t[pubtypes]" "U[trace_info]" "u[trace_abbrev]" \ + "T[trace_aranges]" "g[gdb_index]" "A[addr]" "c[cu_index]" "k[links]" \ + "K[follow-links]" && ret=0 ;; - dwarf_names) - _values -s , "dwarf section" rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges addr cu_index links follow-links && ret=0 + dwarf-names) + _sequence _wanted dwarf-sections expl "dwarf section" compadd - \ + rawline decodedline info abbrev pubnames aranges macro frames \ + frames-interp str loc Ranges pubtypes gdb_index trace_info \ + trace_abbrev trace_aranges addr cu_index links follow-links && ret=0 ;; - bfdname) - _values "object format" "${(z)${(@M)${(f)$(_call_program targets objdump --help)}##* supported targets:*}##*: }" && ret=0 + bfdnames) + _wanted targets expl target compadd - \ + ${=${(M)${(f)"$(_call_program targets objdump --help)"}##* supported targets:*}##*: } && ret=0 ;; - machine) - _values "machine architecture" "${(@)${(z)${(@M)${(f)$(_call_program targets objdump --help)}##* supported architectures:*}##*: }//:/\\:}" && ret=0 + architectures) + _wanted architectures expl architecture compadd - \ + ${=${(M)${(f)"$(_call_program targets objdump --help)"}##* supported architectures:*}##*: } && ret=0 ;; disassembler_options) _values -s , "disassembler options" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:# [^ ]*}# }%% *}" && ret=0 ;; llvm_targets) _values "target architecture" "${(z)${(@)${(f)$(_call_program targets - ${~words[1]} -version)##*Registered Targets:}/ -*}}" + ${~words[1]} -version)##*Registered Targets:}/ -*}}" ;; esac diff --git a/Completion/Unix/Command/_od b/Completion/Unix/Command/_od index 046018131..7673a225b 100644 --- a/Completion/Unix/Command/_od +++ b/Completion/Unix/Command/_od @@ -26,7 +26,7 @@ if _pick_variant gnu=GNU unix --version; then args=( ${(R)args:#(|\*)(|\(*\))-[hBIL]*} ) args+=( '--traditional' - '--endian=[swap input bytes]:endianess:(big little)' + '--endian=[swap input bytes]:endianness:(big little)' {-S+,--strings=-}'[output strings of at least specified bytes long]:length' {-w-,--width=-}'[output specified bytes per line]:bytes' '(- : *)--help[display help and exit]' diff --git a/Completion/Unix/Command/_pandoc b/Completion/Unix/Command/_pandoc new file mode 100644 index 000000000..29d3724e0 --- /dev/null +++ b/Completion/Unix/Command/_pandoc @@ -0,0 +1,423 @@ +#compdef pandoc + +# {{{ helper: cache policy for available formats and other variables +(( $+functions[__pandoc_cache_policy] )) || +__pandoc_cache_policy(){ + local cache_file="$1" + if [[ -f "${commands[pandoc]}" && -f "${cache_file}" ]]; then + # if the manifest file is newer then the cache: + if [[ "${commands[pandoc]}" -nt "${cache_file}" ]]; then + return 0 + else + return 1 + fi + else + return 0 + fi +} +# }}} +# {{{ choose a format among supported output format +(( $+functions[_pandoc_output_format] )) || +_pandoc_output_format(){ + local update_policy + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy + fi + if _cache_invalid pandoc_output_formats_simple; then + output_formats_simple=($(pandoc --list-output-formats)) + _store_cache pandoc_output_formats_simple output_formats_simple + else + _retrieve_cache pandoc_output_formats_simple + fi + if _cache_invalid pandoc_output_formats_plus_extensible || _cache_invalid pandoc_output_formats_minus_extensible; then + for f in ${output_formats_simple[*]}; do + for e in $(pandoc --list-extensions=${f}); do + if [[ "${e}" =~ '^\+' ]]; then + output_formats_plus_extensible+=("${f}${e}") + elif [[ "${e}" =~ '^\-' ]]; then + output_formats_minus_extensible+=("${f}${e}") + fi + done + done + _store_cache pandoc_output_formats_minus_extensible output_formats_minus_extensible + _store_cache pandoc_output_formats_plus_extensible output_formats_plus_extensible + else + _retrieve_cache pandoc_output_formats_minus_extensible + _retrieve_cache pandoc_output_formats_plus_extensible + fi + _alternative \ + 'formats_plus:format:{_multi_parts "+" output_formats_plus_extensible}' \ + 'formats_minus:format:{_multi_parts -- "-" output_formats_minus_extensible}' +} +# }}} +# {{{ choose a format among supported input format +(( $+functions[_pandoc_input_format] )) || +_pandoc_input_format(){ + local update_policy + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy + fi + if _cache_invalid pandoc_input_formats_simple; then + input_formats_simple=($(pandoc --list-input-formats)) + _store_cache pandoc_input_formats_simple input_formats_simple + else + _retrieve_cache pandoc_input_formats_simple + fi + if _cache_invalid pandoc_input_formats_plus_extensible || _cache_invalid pandoc_input_formats_minus_extensible; then + for f in ${input_formats_simple[*]}; do + for e in $(pandoc --list-extensions=${f}); do + if [[ "${e}" =~ '^\+' ]]; then + input_formats_plus_extensible+=("${f}${e}") + elif [[ "${e}" =~ '^\-' ]]; then + input_formats_minus_extensible+=("${f}${e}") + fi + done + done + _store_cache pandoc_input_formats_minus_extensible input_formats_minus_extensible + _store_cache pandoc_input_formats_plus_extensible input_formats_plus_extensible + else + _retrieve_cache pandoc_input_formats_minus_extensible + _retrieve_cache pandoc_input_formats_plus_extensible + fi + _alternative \ + 'formats_plus:format:{_multi_parts "+" input_formats_plus_extensible}' \ + 'formats_minus:format:{_multi_parts -- "-" input_formats_minus_extensible}' +} +# }}} +# {{{ choose a format among all supported formats +(( $+functions[_pandoc_all_formats] )) || +_pandoc_all_formats(){ + local update_policy + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy + fi + if _cache_invalid pandoc_input_formats_simple; then + input_formats_simple=($(pandoc --list-input-formats)) + _store_cache pandoc_input_formats_simple input_formats_simple + else + _retrieve_cache pandoc_input_formats_simple + fi + if _cache_invalid pandoc_output_formats_simple; then + output_formats_simple=($(pandoc --list-output-formats)) + _store_cache pandoc_output_formats_simple output_formats_simple + else + _retrieve_cache pandoc_output_formats_simple + fi + if _cache_invalid pandoc_all_formats; then + all_formats=(${output_formats_simple} ${input_formats_simple}) + all_formats=($(sort -u <<<"${all_formats[*]}")) + _store_cache pandoc_all_formats all_formats + else + _retrieve_cache pandoc_all_formats + fi + _describe "format" all_formats +} +# }}} +# {{{ pdf engine choice +(( $+functions[_pandoc_pdf_engine] )) || +_pandoc_pdf_engine(){ + _alternative \ + 'engines:engine:{_values "engine" pdflatex lualatex xelatex wkhtmltopdf weasyprint prince context pdfroff}' \ + 'engine_files:engine:_files' +} +# }}} +# {{{ options to pass to --pdf-engine command +(( $+functions[_pandoc_pdf_engine_opts] )) || +_pandoc_pdf_engine_opts(){ + local pdf_engine=${opt_args[--pdf-engine]} + case ${pdf_engine} in + "pdflatex"|"lualatex"|"xelatex"|"xetex"|"latex"|"pdftex"|"tex"|"") + _tex + ;; + *) + type _${pdf_engine} > /dev/null + if [[ $? == 1 ]]; then + _message "Options for ${pdf_engine}" + fi + ;; + esac +} +# }}} +# {{{ choose data-dir +(( $+functions[_pandoc_data_dir] )) || +_pandoc_data_dir(){ + _files -/ +} +# }}} +# {{{ choose template from data-dir +(( $+functions[_pandoc_template] )) || +_pandoc_template(){ + local update_policy + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy + fi + if _cache_invalid pandoc_output_formats_simple; then + output_formats_simple=($(pandoc --list-output-formats)) + _store_cache pandoc_output_formats_simple output_formats_simple + else + _retrieve_cache pandoc_output_formats_simple + fi + local data_dir=${opt_args[--data-dir]} + if [[ -z $data_dir ]]; then + if _cache_invalid pandoc_default_data_dir; then + default_data_dir=$(pandoc --version | sed -ne 's/Default user data directory: \(.*\)/\1/p') + _store_cache pandoc_default_data_dir default_data_dir + else + _retrieve_cache pandoc_default_data_dir + fi + data_dir=${default_data_dir} + fi + _pandoc_template_find_args="-name '*.'${output_formats_simple[1]}" + for ((i = 2; i < ${#output_formats_simple[@]}; i++ )); do + _pandoc_template_find_args=$_pandoc_template_find_args" -or -name '*.'${output_formats_simple[$i]}" + done + templates=($(eval find -L ${data_dir}/templates ${_pandoc_template_find_args} 2>/dev/null | sed -e 's/.*\///' -e 's/\.[^.]*$//')) + if [[ -z "${templates}" ]]; then + templates=default + fi + _describe 'templates from default data-dir' templates +} +# }}} +# {{{ choose highlight-style +(( $+functions[_pandoc_highlight_style] )) || +_pandoc_highlight_style(){ + local update_policy + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy + fi + if _cache_invalid pandoc_highlighting_styles; then + highlighting_styles=($(pandoc --list-highlight-styles)) + _store_cache pandoc_highlighting_styles highlighting_styles + else + _retrieve_cache pandoc_highlighting_styles + fi + _alternative \ + 'styles:style:{_values "syntax builting style" ${highlighting_styles[*]}}' \ + 'style_files_here:style:{_files -g "*.theme"}' +} +# }}} +# {{{ choose filter from specified or default data-dir +(( $+functions[_pandoc_filter] )) || +_pandoc_filter(){ + local update_policy + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy + fi + local data_dir=${opt_args[--data-dir]} + if [[ -z $data_dir ]]; then + if _cache_invalid pandoc_default_data_dir; then + default_data_dir=$(pandoc --version | sed -ne 's/Default user data directory: \(.*\)/\1/p') + _store_cache pandoc_default_data_dir default_data_dir + else + _retrieve_cache pandoc_default_data_dir + fi + data_dir=${default_data_dir} + fi + local filters_dir=$data_dir"/filters" + _alternative \ + 'local_filter:filter:{_files -g "*.lua"}' \ + 'data_dir_filter:filter:{_files -W filters_dir -g "*.lua"}' +} +# }}} +# {{{ choose lua filter from specified or default data-dir +(( $+functions[_pandoc_lua_filter] )) || +_pandoc_lua_filter(){ + local update_policy + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy + fi + local data_dir=${opt_args[--data-dir]} + if [[ -z $data_dir ]]; then + if _cache_invalid pandoc_default_data_dir; then + default_data_dir=$(pandoc --version | sed -ne 's/Default user data directory: \(.*\)/\1/p') + _store_cache pandoc_default_data_dir default_data_dir + else + _retrieve_cache pandoc_default_data_dir + fi + data_dir=${default_data_dir} + fi + local filters_dir=$data_dir"/filters" + _alternative \ + 'local_filter:filter:{_files -g "(#q*)(.)"}' \ + 'data_dir_filter:filter:{_files -W filters_dir -g "(#q*)(.)"}' + } +# }}} +# {{{ choose reference location +(( $+functions[_pandoc_reference_location] )) || +_pandoc_reference_location(){ + local -a policies + policies=( + 'block:place references at the end of the current (top-level) block' + 'section:place references at the end of the current (top-level) section' + 'document:place references at the end of the document' + ) + _describe 'location' policies +} +# }}} +# --base-header-level must be 1-5: https://github.com/jgm/pandoc/blob/34d8ffbcfc33b86766ff7229be4d8a0d1fbffb50/src/Text/Pandoc/App.hs#L867 +# {{{ choose top level division +(( $+functions[_pandoc_top_level_division] )) || +_pandoc_top_level_division(){ + _values 'top level division' default section chapter part +} +# }}} +# {{{ choose header levels +(( $+functions[_pandoc_header_levels] )) || +_pandoc_header_levels(){ + _values -s , "number" 1 2 3 4 5 6 +} +(( $+functions[_pandoc_header_level] )) || +_pandoc_header_level(){ + _values "number" 1 2 3 4 5 6 +} +# }}} +# {{{ choose email obfusication +(( $+functions[_pandoc_email_obfusication] )) || +_pandoc_email_obfusication(){ + local -a policies + policies=( + 'none:(default) leaves mailto: links as they are' + 'javascript:obfuscates them using JavaScript' + 'references:obfuscates them by printing their letters as decimal or hexadecimal character references' + ) + _describe 'obfusication' policies +} +# }}} +# {{{ choose wrapping policy +(( $+functions[_pandoc_wrap] )) || +_pandoc_wrap() { + local -a policies + policies=( + 'auto:(default) wrap lines to the column width specified by --columns (default 72)' + "none:don't wrap lines at all" + 'preserve:attempt to preserve the wrapping from the source document' + ) + _describe 'policy' policies +} +# }}} +# {{{ choose eol policy +(( $+functions[_pandoc_eol] )) || +_pandoc_eol() { + local -a policies + policies=( + 'native:line endings appropriate to the OS on which pandoc is being run' + 'crlf:windows' + 'lf:macOS/Linux/UNIX' + ) + _describe 'policy' policies +} +# }}} +# {{{ choose changes tracking policy +(( $+functions[_pandoc_track_changes] )) || +_pandoc_track_changes() { + local -a policies + policies=( + 'accept:(default) inserts all insertions, and ignores all deletions' + 'reject:inserts all deletions and ignores insertions' + 'all:puts in insertions, deletions, and comments, wrapped in spans with insertion, deletion, comment-start, and comment-end classes, respectively' + ) + _describe 'policy' policies +} +# }}} + +# The real thing +_arguments -C \ + {-f,-r,--from=,--read=}'[specify input format]:format:_pandoc_input_format' \ + {-t,-w,--to=,--write=}'[specify output format]:format:_pandoc_output_format' \ + {-o,--output=}'[write output to FILE instead of stdout]:file:_files' \ + '--data-dir=[specify the user data directory to search for pandoc data files]:dir:_pandoc_data_dir' \ + '--base-header-level=[specify the base level for headers (defaults to 1)]:number:_pandoc_header_level' \ + '--strip-empty-paragraphs[deprecated. Use the +empty_paragraphs extension instead]: :' \ + '--indented-code-classes=[classes to use for indented code blocks]:class:{_message "Classes separated with ,"}' \ + '*--filter=[specify an executable to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written]:file:_pandoc_filter' \ + '*--lua-filter=[transform the document in a similar fashion as JSON filters (see --filter), but use pandoc'"'"'s built-in lua filtering system]:file:_pandoc_lua_filter' \ + {-p,--preserve-tabs}'[preserve tabs instead of converting them to spaces]: :' \ + '--tab-stop=[specify the number of spaces per tab (default is 4)]:number:{_message -r "choose a number equals to or greater then 1"}' \ + '--track-changes=[specifies what to do with insertions, deletions, and comments produced by the MS Word "Track Changes" feature]: :_pandoc_track_changes' \ + '--file-scope[parse each file individually before combining for multifile documents]: :' \ + '--extract-media=[extract images and other media contained in or linked from the source document to the path DIR]:dir:{_dir_list}' \ + {-s,--standalone}'[produce output with an appropriate header and footer]: :' \ + '--template=[use FILE as a custom template for the generated document. Implies --standalone]: :_pandoc_template' \ + {\*-M,\*--metadata=}'[set the metadata field KEY to the value VALUE]:key\:value: ' \ + {\*-V,\*--variable=}'[set the variable KEY to the value VALUE]:key\:value: ' \ + '(- :)'{-D,--print-default-template=}'[print the system default template for an output]:format:_pandoc_output_format' \ + '(- :)--print-default-data-file=[print a system default data file]:file: ' \ + '(- :)--print-highlight-style=[prints a JSON version of a highlighting style]:style|file: ' \ + '--dpi=[specify the dpi (dots per inch) value for conversion from pixels to inch/centimeters and vice versa]:number: ' \ + '--eol=[manually specify line endings (crlf|lf|native)]: :_pandoc_eol' \ + '--wrap=[determine how text is wrapped in the output (the source code, not the rendered version)]: :_pandoc_wrap ' \ + '--columns=[specify length of lines in characters (default 72)]:number: ' \ + '--strip-comments[strip out HTML comments in the Markdown or Textile source]: : ' \ + {--toc,--table-of-contents}'[include an automatically generated table of contents]: : ' \ + '--toc-depth=[specify the number of section levels to include in the table of contents]:number:{_message -r "choose a number equals to or greater then 1"}' \ + '--no-highlight[disables syntax highlighting for code blocks and inlines]: : ' \ + '--highlight-style=[specifies the coloring style to be used in highlighted source code]:style|file:_pandoc_highlight_style' \ + '--syntax-definition=[load a KDE XML syntax definition file]:file:{_files -g "*.xml"}' \ + {\*-H,\*--include-in-header=}'[include contents of FILE, verbatim, at the end of the header, implies --standalone]:file:_files' \ + {\*-B,\*--include-before-body=}'[include contents of FILE, verbatim, at the beginning of the document body, implies --standalone]:file:_files' \ + {\*-A,\*--include-end-body=}'[include contents of FILE, verbatim, at the end of the document body, implies --standalone]:file:_files' \ + '--resource-path=[list of paths to search for images and other resources]:searchpath:_dir_list' \ + '--request-header=[set the request header NAME to the value VAL when making HTTP requests]:name\:val: ' \ + '--self-contained[produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. Implies --standalone]: : ' \ + '--html-q-tags[use <q> tags for quotes in HTML]: : ' \ + '--ascii[use only ASCII characters in output, supported only for HTML and DocBook output]: : ' \ + '--reference-links[use reference-style links, rather than inline links]: : ' \ + '--reference-location=[specify where footnotes (and references, if reference-links is set) are placed (block|section|document)]: :_pandoc_reference_location' \ + '--atx-headers[use ATX-style headers in Markdown and AsciiDoc output]: : ' \ + '--top-level-division=[treat top-level headers as the given division type in LaTeX, ConTeXt, DocBook, and TEI output]: :_pandoc_top_level_division' \ + {-N,--number-sections}'[number section headings in LaTeX, ConTeXt, HTML, or EPUB output]: : ' \ + '--number-offset=[offset for section headings in HTML output (ignored in other output formats)]: :_pandoc_header_levels' \ + '--listings[use the listings package for LaTeX code blocks]: : ' \ + {-i,--incremental}'[make list items in slide shows display incrementally (one by one)]: : ' \ + '--slide-level=[specifies that headers with the specified level create slides (for beamer, s5, slidy, slideous, dzslides)]: :_pandoc_header_levels' \ + '--section-divs[wrap sections in <section> tags (or <div> tags for html4)Use the section-divs package for LaTeX code blocks]: : ' \ + '--email-obfusication=[treat top-level headers as the given division type in LaTeX, ConTeXt, DocBook, and TEI output (none|javascript|references)]: :_pandoc_email_obfusication' \ + '--default-image-extension=[specify a default extension to use when image paths/URLs have no extension]:extension: ' \ + '--id-prefix=[specify a prefix to be added to all identifiers and internal links in HTML and DocBook output]:string: ' \ + {-T,--title-prefix=}'[specify STRING as a prefix at the beginning of the title that appears in the HTML header]:string: ' \ + {\*-c,\*--css=}'[link to a CSS style sheet]:url: ' \ + '--reference-doc=[use the specified file as a style reference in producing a docx or ODT file]:file: ' \ + '--epub-subdirectory=[specify the subdirectory in the OCF container that is to hold the EPUB-specific contents]:dir:{_files -/}' \ + '--epub-cover-image=[use the specified image as the EPUB cover]:file:_files' \ + '--epub-metadata=[look in the specified XML file for metadata for the EPUB]:file:{_files -g "*.xml"}' \ + '*--epub-embed-font=[embed the specified font in the EPUB]:file:_files ' \ + '--epub-chapter-level=[specify the header level at which to split the EPUB into separate "chapter" files]:number:_pandoc_header_level' \ + '--pdf-engine=[use the specified engine when producing PDF output]:program:_pandoc_pdf_engine' \ + '*--pdf-engine-opt=[use the given string as a command-line argument to the pdf-engine]:string:_pandoc_pdf_engine_opts' \ + '*--bibliography=[set the bibliography field in the document'"'"'s metadata to FILE]:file:{_files -g "*.{bib,bibtex,copac,json,yaml,enl,xml,wos,medline,mods,ris}"}' \ + '--csl=[set the csl field in the document'"'"'s metadata to FILE]:file:{_files -g "*.csl"}' \ + '--citation-abbreviations=[set the citation-abbreviations field in the document'"'"'s metadata to FILE]:file:_files' \ + '--natbib[use natbib for citations in LaTeX output]' \ + '--biblatex[use biblatex for citations in LaTeX output]' \ + '--mathml[convert TeX math to MathML (in epub3, docbook4, docbook5, jats, html4 and html5)]' \ + '--webtex=[convert TeX formulas to <img> tags that link to an external script that converts formulas to images]::url: ' \ + '--mathjax=[use MathJax to display embedded TeX math in HTML output]::url: ' \ + '--katex=[use KaTeX to display embedded TeX math in HTML output]::url: ' \ + {-m,--latexmathml=,--asciimathml=}'[deprecated. Use the LaTeXMathML script to display embedded TeX math in HTML output]::url: ' \ + '--mimetex=[deprecated. Render TeX math using the mimeTeX CGI script, which generates an image for each TeX formula]::url: ' \ + '--jsmath=[deprecated. Use jsMath (the predecessor of MathJax) to display embedded TeX math in HTML output]::url: ' \ + '--gladtex[deprecated. Enclose TeX math in <eq> tags in HTML output]: : ' \ + '--abbreviations=[specifies a custom abbreviations file]:file:_files ' \ + '--trace[enable tracing]' \ + '--dump-args[print information about command-line arguments to stdout, then exit]' \ + '--ignore-args[ignore command-line arguments (for use in wrapper scripts)]' \ + '--verbose[give verbose debugging output]' \ + '--quiet[suppress warning messages]' \ + '--fail-if-warnings[exit with error status if there are any warnings]' \ + '--log=[write log messages in machine-readable JSON format to FILE]:file:_file' \ + '(- :)--bash-completion[generate a bash completion script]' \ + '(- :)--list-input-formats[list supported input formats, one per line]' \ + '(- :)--list-output-formats[list supported output formats, one per line]' \ + '(- :)--list-extensions=[list supported extensions, one per line, preceded by a + or - indicating whether it is enabled by default in FORMAT]:format:_pandoc_all_formats' \ + '(- :)--list-highlight-languages[list supported languages for syntax highlighting, one per line]' \ + '(- :)--list-highlight-styles[list supported styles for syntax highlighting, one per line]' \ + '(- :)'{-v,--version}'[print version]' \ + '(- :)'{-h,--help}'[print help]' \ + '*:file:_files' diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce index 3cd99d519..0d007e3bc 100644 --- a/Completion/Unix/Command/_perforce +++ b/Completion/Unix/Command/_perforce @@ -2426,7 +2426,7 @@ _perforce_cmd_key() { _arguments -s : \ '(-i -m)-d[delete key]' \ '(-d -m)-i[increment key value by 1]' \ - '(-d -i)-m[allow mulitple operations]' \ + '(-d -i)-m[allow multiple operations]' \ $keyargs } diff --git a/Completion/Unix/Command/_picocom b/Completion/Unix/Command/_picocom index 4b8b3ea2e..9059b03e8 100644 --- a/Completion/Unix/Command/_picocom +++ b/Completion/Unix/Command/_picocom @@ -47,7 +47,7 @@ function _picocom () { '--omap[define output character map]:output character map:' '--emap[define local echo character map]:local echo character map:' '(--help -h)'{--help,-h}'[display help message]' - '*:device:_files -g "*(%c)"' ) + '*:device:_files -g "*(-%c)"' ) _arguments -C : "${args[@]}" } diff --git a/Completion/Unix/Command/_ping b/Completion/Unix/Command/_ping index 78fd33d92..274204264 100644 --- a/Completion/Unix/Command/_ping +++ b/Completion/Unix/Command/_ping @@ -11,6 +11,7 @@ case ${variant}:${${service#ping}:-4} in args+=( '-d[set SO_DEBUG on the socket]' '-n[show network addresses as numbers]' + '-M+[define mtu discovery]:mtu discovery:(do dont want)' '-v[verbose output]' ) ;| @@ -104,9 +105,11 @@ case ${variant}:${${service#ping}:-4} in '-z+[specify type of service]:type of service' ) ;| + (freebsd|openbsd|darwin)*:6) + args+=( '-D[disable IPv6 fragmentation]' ) + ;| (freebsd|darwin)*:6) args+=( - '-D[disable IPv6 fragmentation]' '-R[audible bell for no packet]' '-r[audible bell for each packet]' ) @@ -136,7 +139,7 @@ case ${variant}:${${service#ping}:-4} in darwin*:6) args+=( '-B+[bind the socket to specified interface for sending]:interface:_net_interfaces' - '-G+[specify max,min,increment size for ICMP payload for sweeping pings]:max,min,incr (defalt min=0 incr=1)' + '-G+[specify max,min,increment size for ICMP payload for sweeping pings]:max,min,incr (default min=0 incr=1)' '-z+[specify traffic class]:traffic class' ) ;| @@ -149,16 +152,12 @@ case ${variant}:${${service#ping}:-4} in '--apple-time[prints the time a packet was received]' ) ;; - openbsd*:4) - args+=( - '-T+[change TOS value]:TOS value:(critical inetcontrol lowdelay netcontrol throughput reliability ef af cs)' - ) - ;| openbsd*) args+=( '-H[try reverse-lookups of addresses]' '-E[audible bell for no packet]' '-e[audible bell for each packet]' + '-T+[change TOS value]:TOS value:(critical inetcontrol lowdelay netcontrol throughput reliability ef af cs)' '-V+[specify routing table to be used]:routing table' ) ;; diff --git a/Completion/Unix/Command/_pkg-config b/Completion/Unix/Command/_pkg-config index 43773967e..cae6a6293 100644 --- a/Completion/Unix/Command/_pkg-config +++ b/Completion/Unix/Command/_pkg-config @@ -36,7 +36,7 @@ arguments=( "--print-requires[list all modules the package requires]" "--print-requires-private[list all modules the package requires for static linking (see --static)]" # "--msvc-syntax[output linker flags in a form compatible with MSVC++ (Windows only)]" -# "--dont-define-prefix[disables automatic overiding of the variable \"prefix\" (Windows only)]" +# "--dont-define-prefix[disables automatic overriding of the variable \"prefix\" (Windows only)]" # "--prefix-variable=[set the name of the variable \"prefix\" (Windows only)]:prefix value" "*: :->packages" ) diff --git a/Completion/Unix/Command/_postgresql b/Completion/Unix/Command/_postgresql new file mode 100644 index 000000000..595eb1cb4 --- /dev/null +++ b/Completion/Unix/Command/_postgresql @@ -0,0 +1,1148 @@ +#compdef clusterdb createdb createuser dropdb dropuser initdb pg_config pg_ctl pg_dump pg_dumpall pg_isready pg_restore pg_upgrade postgres postmaster psql reindexdb vacuumdb + +# Notes: +# - @todo We don't complete postgres:// URIs or conninfo strings, and we don't +# account for postgres:// URIs when calling psql +# - @todo We don't handle a few less-used tools like ecpg and pgbench +# - @todo We don't handle Debian's wrapper tools (pg_ctlcluster, &al.) + +# Construct conninfo string for use with completion helper functions +# +# -o <param> => include only specified parameters +# -O <param> => exclude specified parameters +# $1 => scalar parameter to store result in (conninfo by default) +# +# Explanation: +# +# Postgres supports a dizzying number of ways to specify connection parameters; +# in roughly ascending order of precedence, they are (where applicable): +# +# - PG* environment variables +# - Database name as first operand +# - User name as second operand +# - Options -d/-h/-p/-U +# - Conninfo string as first operand +# - URI as first operand -- authority/path component +# - URI as first operand -- query component +# +# The following command demonstrates four ways to pass the user name: +# +# PGUSER=foo1 psql 'postgres://foo2@localhost/mydb?user=foo3' -U foo4 +# +# In this case, per the above, the query component of the URI wins, and foo3 +# gets used. +# +# Many connection parameters can only be supplied via conninfo string, URI, or +# environment variable. Thus, in order for our helper functions to accurately +# obtain completion possibilities, it's preferable to normalise the various +# methods of supplying parameters. Since conninfo strings are easiest to +# construct, we'll use those. +# +# See also: +# +# - https://www.postgresql.org/docs/current/static/libpq-envars.html +# - https://www.postgresql.org/docs/current/static/libpq-connect.html +# - https://github.com/postgres/postgres/blob/master/src/bin/psql/startup.c +(( $+functions[__pgsql_get_conninfo] )) || +__pgsql_get_conninfo() { + local i_ + local -a conninfo_ + local -aU incl_ excl_ + + zparseopts -D -E -- o+:-=incl_ O+:-=excl_ + + (( $#incl_ )) && + incl_=( ${(@s<,>)${(@)${(@)incl_#-o}//[[:punct:][:space:]]/,}} ) + (( $#excl_ )) && + excl_=( ${(@s<,>)${(@)${(@)excl_#-O}//[[:punct:][:space:]]/,}} ) + + # Parameters supplied via options. We must quote parameter values for conninfo + # strings like foo='bar\'baz'. Should we also handle -l/--maintenance-db here? + [[ -n ${opt_args[(i)c-(-d|--dbname)]} ]] && + conninfo_+=( dbname="'${(Q)${(v)opt_args[(i)c-(-d|--dbname)]}//\'/\\\'}'" ) + [[ -n ${opt_args[(i)c-(-h|--host)]} ]] && + conninfo_+=( host="${(Q)${(v)opt_args[(i)c-(-h|--host)]}//\'/\\\'}'" ) + [[ -n ${opt_args[(i)c-(-p|--port)]} ]] && + conninfo_+=( port="'${(Q)${(v)opt_args[(i)c-(-p|--port)]}//\'/\\\'}'" ) + [[ -n ${opt_args[(i)c-(-U|--user)]} ]] && + conninfo_+=( user="'${(Q)${(v)opt_args[(i)c-(-U|--user)]}//\'/\\\'}'" ) + + # Parameters supplied via operands -- since these have such a high precedence + # they can't do much for completing the above options, but they're still + # useful for the helper functions + case ${(Q)line[1]} in + # First operand is URI + postgres(ql|)://*) + # @todo To parse this properly we need to handle percent-encoding; it + # might be nice to have a utility function for that some day + ;; + # First operand is conninfo string. The user should have already properly + # quoted any parameter values here, so we don't need to re-quote + *'='*) + conninfo_+=( ${(z)${(Q)line[1]}} ) + # Normalise parameter pairs (note that empty values must be quoted) + for (( i_ = 1; i_ < $#conninfo_; i_++ )); do + # Parameter pair already one word (`param=value`) + if [[ $conninfo_[i_] == *?'='?* ]]; then + continue + # Parameter pair in three words (`param = value`) + elif [[ $conninfo_[(i_+1)] == '=' ]]; then + conninfo_[i_]+="=${conninfo_[(i_+2)]}" + conninfo_[(i_+1)]= + conninfo_[(i_+2)]= + (( i_ += 2 )) + # Parameter pair in two words (`param= value` or `param =value`) + else + conninfo_[i_]+=${conninfo_[(i_+1)]} + conninfo_[(i_+1)]= + (( i_ += 1 )) + fi + done + conninfo_=( $conninfo_ ) + ;; + # First and second operands may be database/user + *) + (( $+line[1] )) && conninfo_+=( dbname="'${(Q)line[1]//\'/\\\'}'" ) + (( $+line[2] )) && conninfo_+=( user="'${(Q)line[2]//\'/\\\'}'" ) + ;; + esac + + (( $#conninfo_ && $#incl_ )) && + conninfo_=( ${(M@)conninfo_:#(${(~j<|>)incl_})=*} ) + (( $#conninfo_ && $#excl_ )) && + conninfo_=( ${(@)conninfo_:#(${(~j<|>)excl_})=*} ) + + : ${(P)${1:-conninfo}::=${(j< >)conninfo_}} + return $(( $#conninfo_ ? 0 : 1 )) +} + +# Call psql and return results +# -f => keep empty lines +# $1 => array parameter to store results in +# $2 => _call_program tag +# $3 => preferred conninfo string (use '' if none) +# $4 ... => arguments to psql (usually -c ...); automatically quoted for eval +__pgsql_call_psql() { + local c_ f_ psql_=psql + local -a tmp_ + + [[ $1 == -f ]] && { + f_=1 + shift + } + + (( $# >= 4 )) || { + print -ru2 "$0: bad argument count" + return 1 + } + + # Use the psql from the command line if we can + [[ $service == psql ]] && psql_=$words[1] + + # Make a few attempts with common settings in case the first fails. Maybe this + # behaviour could be controlled by a user style + for c_ in $3{,' dbname=template1',' dbname=template1 user=postgres'}; do + c_+=' connect_timeout=4' + tmp_=( "${(@f)"$( + _call_program $2 $psql_ -qtAX ${(q)c_} ${(@q)@[4,-1]} + )"}" ) + (( f_ )) || tmp_=( $tmp_ ) + (( $#tmp_ )) && break + done + + : ${(PA)1::="${(@)tmp_}"} + return $(( $#tmp ? 0 : 1 )) +} + +# Complete PostgreSQL authentication methods +(( $+functions[__pgsql_auth_methods] )) || +__pgsql_auth_methods() { + # See https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html + local -a tmp=( + 'trust:allow unconditionally' + 'reject:reject unconditionally' + 'scram-sha-256:authenticate via SCRAM-SHA-256 challenge-response' + 'md5:authenticate via MD5 or SCRAM-SHA-256 challenge-response' + 'password:authenticate via clear-text password' + 'gss:authenticate via GSSAPI (TCP/IP only)' + 'sspi:authenticate via SSPI (Windows only)' + 'ident:authenticate via ident user name (TCP/IP only; local peer fall-back)' + 'peer:authenticate via local OS user name (local only)' + 'ldap:authenticate via LDAP' + 'radius:authenticate via RADIUS' + 'cert:authenticate via SSL client certificate' + 'pam:authenticate via PAM' + 'bsd:authenticate via BSD Authentication' + ) + _describe -t auth-methods 'PostgreSQL authentication method' tmp "$@" +} + +# Complete PostgreSQL run-time configuration parameters +(( $+functions[__pgsql_cfg_params] )) || +__pgsql_cfg_params() { + local conninfo + local -a expl tmp + + __pgsql_get_conninfo + __pgsql_call_psql tmp parameters "$conninfo" -c ' + SELECT name + FROM pg_catalog.pg_settings; + ' + + _wanted -x parameters expl 'PostgreSQL run-time configuration parameter' \ + compadd -a "$@" - tmp +} + +# Complete PostgreSQL run-time configuration parameters (name=value format) +(( $+functions[__pgsql_cfg_params_values] )) || +__pgsql_cfg_params_values() { + if compset -P '*='; then + _message -e values 'PostgreSQL run-time configuration-parameter value' + else + compset -S '=*' + __pgsql_cfg_params "$@" -qS= + fi +} + +# Complete PostgreSQL character encodings +(( $+functions[__pgsql_encodings] )) || +__pgsql_encodings() { + # These rarely change, and they're most needed when creating a new database, + # so trying to pull them from an existing one doesn't seem that helpful; see + # https://www.postgresql.org/docs/current/static/multibyte.html#CHARSET-TABLE + local -a expl tmp=( + BIG5 {WIN,Windows}950 + EUC_{CN,JP,JIS_2004,KR,TW} + GB18030 + GBK {WIN,Windows}936 + ISO_8859_{5..8} + JOHAB + KOI8{,R,U} + LATIN{1..10} ISO8859{{1..4},9,10,{13..16}} + MULE_INTERNAL + SJIS Mskanji ShiftJIS {WIN,Windows}932 + SHIFT_JIS_2004 + SQL_ASCII + UHC {WIN,Windows}949 + UTF8 Unicode + WIN{866,874,{1250..1258}} ALT WIN ABC TCVN{,5712} VSCII + ) + _wanted encodings expl 'PostgreSQL character encoding' compadd -a "$@" - tmp +} + +# Complete PostgreSQL server hosts +# -/ => exclude TCP/IP hosts (include directories only) +# -a => include UNIX-domain socket directories +(( $+functions[__pgsql_hosts] )) || +__pgsql_hosts() { + local -a copts tmp alts + local -A opts + + # We want the compadd options from _sequence, but -J screws with grouping + zparseopts -A opts -D -E -- / a J: + copts=( "$@" ) + + (( $+opts[-/] )) || { + tmp=( ${(s<,>)PGHOST} $${(s<,>)PGHOSTADDR} ) + (( $#tmp )) && alts+=( + "hosts:PostgreSQL server host:(${(j< >)${(@uq-)tmp}})" + ) + alts=( 'hosts:PostgreSQL server host:_hosts' ) + } + (( $+opts[-/] || $+opts[-a] )) && alts+=( + 'directories:PostgreSQL UNIX-domain socket directory:_directories' + ) + + _alternative -O copts $alts +} + +# Complete sequence of PostgreSQL host addresses and directories +(( $+functions[__pgsql_hosts_seq] )) || +__pgsql_hosts_seq() { + local -a opts + zparseopts -a opts -D -E -- / a + _sequence "$@" -s , __pgsql_hosts "${(@)opts}" +} + +# Complete PostgreSQL server port numbers +(( $+functions[__pgsql_ports] )) || +__pgsql_ports() { + local -a tmp=( + $PGPORT $PGPORTOLD $PGPORTNEW + 5432 # Customary + /tmp/.s.PGSQL.<->(#qN:e) # Customary + /var/run/postgresql/.s.PGSQL.<->(#qN:e) # Debian/Ubuntu + /var/pgsql_socket/.s.PGSQL.<->(#qN:e) # Weird macOS systems + /var/lib/pgsql/.s.PGSQL.<->(#qN:e) # Weird Linux systems + /var/lib/postgresql/.s.PGSQL.<->(#qN:e) # Weird Linux systems + ) + tmp=( ${(onu)tmp} ) + _wanted -2V ports expl 'PostgreSQL server port' compadd -a "$@" - tmp +} + +# Complete PostgreSQL special variables. This is brittle and over-engineered, +# but it suits the purpose for now +# --pset => complete \pset options +# --set => complete \set options (default) +(( $+functions[__pgsql_variables] )) || +__pgsql_variables() { + local which tmp2 + local -a expl tmp + local -A opts + + zparseopts -A opts -D -E -- -pset -set + + if (( $+opts[--pset] )); then + which=--pset + else + which=--set + fi + + __pgsql_call_psql -f tmp help-variables '' --help=variables + tmp+=( '' ) + + # `psql --help=variables` produces three sections like this: + # psql variables: + # Usage: + # psql --set=NAME=VALUE + # or \set NAME VALUE inside psql + # + # AUTOCOMMIT ... + # Here, we strip up to the --set= line, then remove the next few lines so they + # don't confuse us + tmp2=${${(F)tmp}#*[[:space:]]${which}=*$'\n'} + [[ $tmp2 == [[:space:]]#or\ * ]] && tmp2=${tmp2#*$'\n'} + [[ $tmp2 == [[:space:]]#$'\n'* ]] && tmp2=${tmp2#*$'\n'} + # Now we strip any following sections + tmp2=${tmp2%%$'\n\n'*} + # Now we extract the variable names + tmp=( ${(f)tmp2} ) + tmp=( ${(M)tmp:#\ \ [^[:space:]]##((#e)|[[:space:]]*)} ) + tmp=( ${(@)tmp#\ \ } ) + tmp=( ${(@)tmp%%[[:space:]]*} ) + + _wanted -x variables expl 'PostgreSQL special variable' \ + compadd -a "$@" - tmp +} + +# Complete PostgreSQL special variables (name=value format) +(( $+functions[__pgsql_variables_values] )) || +__pgsql_cfg_variables_values() { + if compset -P '*='; then + _message -e values 'PostgreSQL special-variable value' + else + compset -S '=*' + __pgsql_variables "$@" -qS= + fi +} + +# Complete PostgreSQL databases +(( $+functions[__pgsql_databases] )) || +__pgsql_databases() { + local conninfo + local -a expl tmp + + __pgsql_get_conninfo -O dbname + __pgsql_call_psql tmp databases "$conninfo" -c ' + SELECT datname + FROM pg_catalog.pg_database; + ' + # We can probably just assume that template0/1 will always exist; it's useful + # for database creation, anyway + tmp+=( $PGDATABASE template0 template1 ) + + _wanted databases expl 'PostgreSQL database' compadd -a "$@" - tmp +} + +# Complete PostgreSQL indexes +(( $+functions[__pgsql_indexes] )) || +__pgsql_indexes() { + local conninfo + local -a expl tmp + + __pgsql_get_conninfo + __pgsql_call_psql tmp indexes "$conninfo" -c ' + SELECT indexname + FROM pg_catalog.pg_indexes; + ' + + _wanted -x indexes expl 'PostgreSQL index' compadd -a "$@" - tmp +} + +# Complete PostgreSQL roles/users +# -a => include non-user (NOLOGIN) roles +(( $+functions[__pgsql_roles] )) || +__pgsql_roles() { + local conninfo which=role where + local -a expl tmp + local -A opts + + zparseopts -A opts -D -E -- a + (( $+opts[-a] )) || { + which=user + where='WHERE rolcanlogin = true' + } + + __pgsql_get_conninfo -O user + __pgsql_call_psql tmp users "$conninfo" -c " + SELECT rolname + FROM pg_catalog.pg_roles + $where; + " + tmp+=( $PGUSER ) + + _wanted -x users expl "PostgreSQL $which" compadd -a "$@" - tmp +} + +# Complete PostgreSQL schemas +(( $+functions[__pgsql_schemas] )) || +__pgsql_schemas() { + local conninfo + local -a expl tmp + + __pgsql_get_conninfo + __pgsql_call_psql tmp schemas "$conninfo" -c " + SELECT nspname + FROM pg_catalog.pg_namespace + WHERE nspname NOT LIKE 'pg_%' + AND nspname != 'information_schema'; + " + # Again, safe to assume this exists + tmp+=( public ) + + _wanted schemas expl 'PostgreSQL schema' compadd -a "$@" - tmp +} + +# Complete PostgreSQL tables +(( $+functions[__pgsql_tables] )) || +__pgsql_tables() { + local conninfo + local -a expl tmp + + __pgsql_get_conninfo + __pgsql_call_psql tmp tables "$conninfo" -c " + SELECT n.nspname || '.' || c.relname + FROM pg_catalog.pg_class AS c + LEFT JOIN pg_catalog.pg_namespace AS n + ON n.oid = c.relnamespace + WHERE c.relkind in ('r', '') + AND n.nspname != 'pg_catalog' + AND n.nspname != 'information_schema' + AND n.nspname NOT LIKE 'pg_toast%' + AND pg_catalog.pg_table_is_visible(c.oid); + " + + _wanted -x tables expl 'PostgreSQL table' compadd -a "$@" - tmp +} + +# Complete PostgreSQL tablespaces +(( $+functions[__pgsql_tablespaces] )) || +__pgsql_tablespaces() { + local conninfo + local -a expl tmp + + __pgsql_get_conninfo + __pgsql_call_psql tmp tablespaces "$conninfo" -c ' + SELECT spcname + FROM pg_catalog.pg_tablespace; + ' + # Again, safe to assume these exist + tmp+=( pg_default pg_global ) + + _wanted tablespaces expl 'PostgreSQL tablespace' compadd -a "$@" - tmp +} + +# Complete PostgreSQL text-search configurations +(( $+functions[__pgsql_ts_configs] )) || +__pgsql_ts_configs() { + local conninfo + local -a expl tmp + + __pgsql_get_conninfo + __pgsql_call_psql tmp ts-configs "$conninfo" -c " + SELECT n.nspname || '.' || t.cfgname + FROM pg_catalog.pg_ts_config AS t + LEFT JOIN pg_catalog.pg_namespace AS n + ON t.cfgnamespace = n.oid; + " + # We'll assume these exist since this tends to be needed on cluster init + tmp+=( pg_catalog.simple pg_catalog.english ) + + _wanted ts-configs expl 'PostgreSQL text-search configuration' \ + compadd -a "$@" - tmp +} + +# Complete clusterdb command +(( $+functions[_pgsql_clusterdb] )) || +_pgsql_clusterdb() { + (( CURRENT > 2 )) && local -a common_opts_excl=( '!---null' ) + local -a args=( + + x # Exclusive options + $common_opts_excl + + c # Connection options (not actually usable with --all) + $common_opts_connm + + '(d)' # Database connection options + '(a o)'{-d+,--dbname=}'[specify database name]: :__pgsql_databases' + + C # Misc. common options + $common_opts_echo + # -q and -v are NOT exclusive + '(-q --quiet)'{-q,--quiet}'[do not display progress messages]' + '(-v --verbose)'{-v,--verbose}'[display detailed information during processing]' + + a # --all-mode options + '(c d n -a --all)'{-a,--all}'[reindex all databases]' + + n # Normal-mode options + '(a)*'{-t+,--table=}'[cluster specified table only]: :__pgsql_tables' + + o # Operands + '(a d)1: :__pgsql_databases' + ) + _arguments -s -S : $args +} + +# Complete createdb command +(( $+functions[_pgsql_createdb] )) || +_pgsql_createdb() { + (( CURRENT > 2 )) && local -a common_opts_excl=( '!---null' ) + local -a args=( + + x # Exclusive options + $common_opts_excl + + c # Connection options + $common_opts_connm + + l # Locale options + '(l)'{-l+,--locale=}'[specify locale (both LC_COLLATE and LC_CTYPE)]: :_locales' + '(-l --locale)--lc-collate=[specify LC_COLLATE setting]: :_locales' + '(-l --locale)--lc-ctype=[specify LC_CTYPE setting]: :_locales' + + o # Other arguments + $common_opts_echo + '(-D --tablespace)'{-D+,--tablespace=}'[specify default tablespace]: :__pgsql_tablespaces' + '(-E --encoding)'{-E+,--encoding=}'[specify character encoding]: :__pgsql_encodings' + '(-O --owner)'{-O+,--owner=}'[specify owner]: :__pgsql_roles -a' + '(-T --template)'{-T+,--template=}'[specify template database to build from]: :__pgsql_databases' + # Possibly not useful to complete existing databases here + '1: :__pgsql_databases' + '2: :_guard "^-*" "database description"' + ) + _arguments -s -S : $args +} + +# Complete createuser command +(( $+functions[_pgsql_createuser] )) || +_pgsql_createuser() { + (( CURRENT > 2 )) && local -a common_opts_excl=( '!---null' ) + local -a args=( + + x # Exclusive options + $common_opts_excl + + c # Connection options + $common_opts_conn + + '(d)' # CREATEDB options + {-d,--createdb}'[grant ability to create new databases (CREATEDB)]' + {-D,--no-createdb}'[do not grant ability to create new databases (NOCREATEDB)]' + + '(i)' # INHERIT options + {-i,--inherit}'[grant automatic privilege inheritance from role memberships (INHERIT)]' + {-I,--no-inherit}'[do not grant automatic privilege inheritance from role memberships (NOINHERIT)]' + + '(l)' # LOGIN options + {-l,--login}'[grant ability to log in as user (LOGIN)]' + {-L,--no-login}'[do not grant ability to log in as user (NOLOGIN)]' + + '(r)' # CREATEROLE options + {-r,--createrole}'[grant ability to create new roles (CREATEROLE)]' + {-R,--no-createrole}'[do not grant ability to create new roles (NOCREATEROLE)]' + + '(R)' # REPLICATION options + '--replication[grant replication privileges (REPLICATION)]' + '--no-replication[do not grant replication privileges (NOREPLICATION)]' + + '(s)' # SUPERUSER options + {-s,--superuser}'[grant super-user privileges (SUPERUSER)]' + {-S,--no-superuser}'[do not grant super-user privileges (NOSUPERUSER)]' + + o # Other arguments + $common_opts_echo + '(-c --connection-limit)'{-c+,--connection-limit=}'[specify connection limit for new role]:number of connections' + # No effect, kept for backwards compatibility + '!'{-E,--encrypted} + '*'{-g+,--role=}'[grant membership to specified role]: :__pgsql_roles -a' + '--interactive[prompt for settings not specified on command line]' + '(-P --pwprompt)'{-P,--pwprompt}'[prompt for new user password]' + # Again, possibly not useful to complete these + '1: :__pgsql_roles' + ) + _arguments -s -S : $args +} + +# Complete dropdb command +(( $+functions[_pgsql_dropdb] )) || +_pgsql_dropdb() { + (( CURRENT > 2 )) && local -a common_opts_excl=( '!---null' ) + local -a args=( + + x # Exclusive options + $common_opts_excl + + c # Connection options + $common_opts_connm + + o # Other arguments + $common_opts_echo + '(-i --interactive)'{-i,--interactive}'[prompt for confirmation]' + '--if-exists[skip non-existent database]' + '1: :__pgsql_databases' + ) + _arguments -s -S : $args +} + +# Complete dropuser command +(( $+functions[_pgsql_dropuser] )) || +_pgsql_dropuser() { + (( CURRENT > 2 )) && local -a common_opts_excl=( '!---null' ) + local -a args=( + + x # Exclusive options + $common_opts_excl + + c # Connection options + $common_opts_conn + + o # Other arguments + $common_opts_echo + '(-i --interactive)'{-i,--interactive}'[prompt for confirmation (and user name if not specified)]' + '--if-exists[skip non-existent user]' + # We could use -a here, but it seems questionable + '1: :__pgsql_roles' + ) + _arguments -s -S : $args +} + +# Complete initdb command +(( $+functions[_pgsql_initdb] )) || +_pgsql_initdb() { + (( CURRENT > 2 )) && local -a common_opts_excl=( '!---null' ) + local -a args=( + + x # Exclusive options + $common_opts_excl + + '(l)' # Locale options (general) + {-l+,--locale=}'[specify locale (all categories)]: :_locales' + '--no-locale[equivalent to --locale=C]' + + lc # Locale options (specific) -- unlike createdb, NOT exclusive with -l + '--lc-collate=[specify LC_COLLATE setting]: :_locales' + '--lc-ctype=[specify LC_CTYPE setting]: :_locales' + '--lc-messages=[specify LC_MESSAGES setting]: :_locales' + '--lc-monetary=[specify LC_MONETARY setting]: :_locales' + '--lc-numeric=[specify LC_NUMERIC setting]: :_locales' + '--lc-time=[specify LC_TIME setting]: :_locales' + + o # Other arguments + '(-A --auth)'{-A+,--auth=}'[specify authentication method (local and host)]: :__pgsql_auth_methods' + '--auth-host=[specify host (TCP/IP) authentication method]: :__pgsql_auth_methods' + '--auth-local=[specify local authentication method]: :__pgsql_auth_methods' + '(-d --debug)'{-d,--debug}'[output debug information]' + '(1 -D --pgdata)'{-D+,--pgdata=}'[specify data directory]:data directory:_directories' + '(-E --encoding)'{-E+,--encoding=}'[specify default character encoding]: :__pgsql_encodings' + '(-k --data-checksums)'{-k,--data-checksums}'[enable checksums on data pages]' + '-L+[specify input-file directory]:input-file directory:_directories' + '(-n --no-clean)'{-n,--no-clean}'[do not clean up after errors]' + '(-N --no-sync)'{-N,--no-sync}'[do not wait for disk sync]' + '(-W --pwprompt)--pwfile=[read super-user password from specified file]:password file:_files' + # This should be exclusive with everything but -D/1 + '(-S --sync-only)'{-S,--sync-only}'[safely write all database files and exit]' + '(-T --text-search-config)'{-T+,--text-search-config=}'[specify default text-search configuration]: :__pgsql_ts_configs' + # We could just use the OS user name here, idk + '(-U --username)'{-U+,--username=}'[specify super-user name]: :__pgsql_roles' + '(-W --pwfile --pwprompt)'{-W,--pwprompt}'[prompt for super-user password]' + '(-X --waldir)'{-X+,--waldir=}'[specify write-ahead log directory]:write-ahead log directory:_directories' + '(-D --pgdata)1:database data directory:_directories' + ) + _arguments -s -S : $args +} + +# Complete pg_config command +(( $+functions[_pgsql_pg_config] )) || +_pgsql_pg_config() { + local -a args=( + + x # Exclusive options + ${(@M)common_opts_excl:#*(-\?|--help)*} + + o # Other options + ${(@)${(@M)common_opts_excl:#*--version*}#\(*\)} + '--bindir[display location of user executables]' + '--cc[display C compiler (CC) used during build]' + '--cflags[display C compiler flags (CFLAGS) used during build]' + '--cflags_sl[display C compiler flags for shared libraries (CFLAGS_SL) used during build]' + '--configure[display configure options used during build]' + '--cppflags[display C preprocessor flags (CPPFLAGS) used during build]' + '--docdir[display location of documentation files]' + '--htmldir[display location of HTML documentation files]' + '--includedir[display location of C header files for client interfaces]' + '--includedir-server[display location of C header files for server interfaces]' + '--ldflags[display linker flags (LDFLAGS) used during build]' + '--ldflags_ex[display linker flags used executables (LDFLAGS_EX) used during build]' + '--ldflags_sl[display linker flags used shared libraries (LDFLAGS_SL) used during build]' + '--libs[display linker flags for external libraries (LIBS) used during build]' + '--libdir[display location of library object files]' + '--localedir[display location of locale support files]' + '--mandir[display location of manual pages]' + '--pgxs[display location of extension makefiles]' + '--pkgincludedir[display location of other C header files]' + '--pkglibdir[display location of module object files]' + '--sharedir[display location of architecture-independent support files]' + '--sysconfdir[display location of system-wide configuration files]' + ) + _arguments -s -S : $args +} + +# Complete pg_ctl command +# @todo Exclusivity isn't great here -- it's annoying to handle properly +# because pg_ctl accepts options interspersed with the sub-command name +(( $+functions[_pgsql_pg_ctl] )) || +_pgsql_pg_ctl() { + local -a cmds modes args + + (( CURRENT > 2 )) && local -a common_opts_excl=( '!---null' ) + + cmds=( + {init,initdb}'\:initialize database cluster' + 'kill\:kill process' + 'promote\:promote database server from stand-by to read/write mode' + 'reload\:reload database-server configuration' + 'restart\:restart database server' + 'start\:start database server' + 'status\:check status of database server' + 'stop\:stop database server' + ) + modes=( + {f,fast}'\:shut down cleanly, but without waiting for clients to disconnect' + {i,immediate}'\:shut down immediately and uncleanly' + {s,smart}'\:shut down cleanly after waiting for clients to disconnect' + ) + args=( + + x # Exclusive options + $common_opts_excl + + nk # Non-kill options + '(-D --pgdata)'{-D+,--pgdata=}'[specify data directory]:data directory:_directories' + + nks # Non-kill/status options + '(-s --silent)'{-s,--silent}'[suppress informational messages]' + + ikprs # Wait options + '(-t -W --no-wait --timeout)'{-t+,--timeout=}'[specify time-out interval (with -w)]:time-out interval (seconds)' + '(-w -W --no-wait --wait)'{-w,--wait}'[wait for operation to complete]' + '(-t -w -W --no-wait --timeout --wait)'{-W,--no-wait}'[do not wait for operation to complete]' + + isr # init/start/restart options + '*'{-o+,--options=}'[specify command-line options to initdb/postgres]:initdb/postgres command-line options' + '-p+[specify path to initdb/postgres executable]:initdb/postgres executable:_files -g "*(#q*)"' + + sr # start/restart options + '(-c --core-files)'{-c,--core-files}'[produce core files (where supported)]' + '(-l --log)'{-l+,--log=}'[log to specified file]:log file:_files' + + tr # stop/restart options + '(-m --mode)'{-m+,--mode=}"[specify shut-down mode]:shut-down mode:((${(j< >)${(@qq)modes}}))" + + o # Operands + "1:pg_ctl sub-command:((${(j< >)${(@qq)cmds}}))" + ) + [[ -n ${words[(r)*kill*]} ]] && args+=( '2: :_pids' ) + + _arguments -s -S : $args +} + +# Complete pg_dump/pg_dumpall commands +(( $+functions[_pgsql_pg_dump] )) || +_pgsql_pg_dump() { + local -a fmts args + + (( CURRENT > 2 )) && local -a common_opts_excl=( '!---null' ) + + fmts=( + {p,plain}'\:plain-text SQL script' + {c,custom}'\:custom-format archive' + {d,directory}'\:directory-format archive' + {t,tar}'\:tar-format archive' + ) + args+=( + + x # Exclusive options + $common_opts_excl + + c # Connection options + $common_opts_conn + '--role=[specify role used to create dump]: :__pgsql_roles -a' + ) + # pg_dump-specific connection options + [[ $service == pg_dump ]] && args+=( + '(1 -d --dbname)'{-d+,--dbname=}'[specify database name]: :__pgsql_databases' + # @todo Complete this properly + '(-d --dbname)1:PostgreSQL database name, conninfo string, or URI:__pgsql_databases' + ) + # pg_dumpall-specific connection options + [[ $service == pg_dumpall ]] && args+=( + # Despite the name, -d here this actually takes a conninfo string + # @todo Complete this + '(1 -d --dbname)'{-d+,--dbname=}'[specify conninfo string]:conninfo string' + '(l --database)'{-l+,--database=}'[specify maintenance database name]: :__pgsql_databases' + ) + args+=( + + '(ds)' # Data/schema options + '(-c --clean)'{-a,--data-only}'[dump only data (not schema/definitions)]' + {-s,--schema-only}'[dump only schema/definitions (not data)]' + + '(in)' # Insert options + '(-o --oids)--column-inserts[output INSERT command with explicit column names for each row]' + # Equivalent to above? + '!(-o --oids)--attribute-inserts' + '(-o --oids)--inserts[output INSERT command for each row]' + ) + [[ $service == pg_dumpall ]] && args+=( + + '(grt)' # Globals/roles/tablespaces options + {-g,--globals-only}'[dump only roles and tablespaces (not databases)]' + {-r,--roles-only}'[dump only roles (not databases or tablespaces)]' + {-t,--tablespaces-only}'[dump only tablespaces (not databases or roles)]' + ) + # It would be nice to add '(with -Fp)' and so on where applicable, but it's + # tedious because of pg_dumpall + args+=( + + o # Other options + '(-a -c --clean --data-only)'{-c,--clean}'[output commands to clean objects before creating them]' + '(-o --oids in)'{-o,--oids}'[dump table object IDs]' + '(-O --no-owner)'{-O,--no-owner}'[do not output commands to set ownership of objects]' + '(-S --superuser)'{-S+,--superuser=}'[specify super-user name]: :__pgsql_roles' + '(-v --verbose)'{-v,--verbose}'[output verbosely]' + '(-x --no-acl --no-privileges)'{-x,--no-acl,--no-privileges}'[do not dump access privileges]' + # Not meant for use by humans + '!--binary-upgrade' + '--disable-dollar-quoting[disable dollar-quoting of function bodies]' + '--disable-triggers[output commands to disable triggers before restoring (with -a)]' + '--if-exists[use conditional commands when cleaning objects (with -c)]' + '--lock-wait-timeout=[specify table-lock time-out interval]:time-out interval (milliseconds)' + '--no-publications[do not dump publications]' + '--no-security-labels[do not dump security labels]' + '--no-subscriptions[do not dump subscriptions]' + '--no-sync[do not wait for disk sync]' + '--no-tablespaces[do not output commands to select tablespaces]' + '--no-unlogged-table-data[do not dump data of unlogged tables]' + '--quote-all-identifiers[force quoting of all identifiers]' + '--use-set-session-authorization[output SET SESSION AUTHORIZATION commands to set ownership of objects]' + ) + [[ $service == pg_dump ]] && args+=( + # -b and -B are NOT exclusive + '(-b --blobs)'{-b,--blobs}'[dump large objects]' + '(-B --no-blobs)'{-B,--no-blobs}'[do not dump large objects]' + '(-C --create)'{-C,--create}'[output commands to create and reconnect to database]' + '(-E --encoding)'{-E+,--encoding=}'[specify dump character encoding]: :__pgsql_encodings' + '(-f --file)'{-f+,--file=}'[dump to specified file (or directory with -Fd)]:dump file/directory:_files' + '(-F --format)'{-F+,--format=}"[dump using specified output format]:output format:((${(j< >)${(@qq)fmts}}))" + '(-j --jobs)'{-j+,--jobs=}'[dump specified number of tables in parallel (with -Fd)]:number of jobs/tables' + '*'{-n+,--schema=}'[dump only objects in schema matching specified pattern]: :__pgsql_schemas' + '*'{-N+,--exclude-schema=}'[do not dump objects in schema matching specified pattern]: :__pgsql_schemas' + # No effect, kept for backwards compatibility + '!'{-R,--no-reconnect} + '*'{-t+,--table=}'[dump only tables matching specified pattern]: :__pgsql_tables' + '*'{-T+,--exclude-table=}'[do not dump tables matching specified pattern]: :__pgsql_tables' + '(-Z --compress)'{-Z+,--compress=}"[specify output compression level]:compression level:(${(j< >):-{0..9}})" + '--enable-row-security[dump with row security enabled]' + '*--exclude-table-data=[do not dump data for tables matching specified pattern]: :__pgsql_tables' + '--no-synchronized-snapshots[support -j with pre-9.2 servers]' + '*--section=[dump only specified section]:section:(pre-data data post-data)' + '--serializable-deferrable[dump using serializable transaction, avoiding failure]' + # @todo Complete this + '--snapshot=[dump from specified snapshot]: :__pgsql_snapshots' + '--strict-names[require -n/-t patterns to match at least one schema/table]' + ) + [[ $service == pg_dumpall ]] && args+=( + '(-f --file)'{-f+,--file=}'[dump to specified file]:dump file:_files' + '--no-role-passwords[do not dump passwords for roles]' + ) + _arguments -s -S : $args +} + +# Complete pg_isready command +(( $+functions[_pgsql_pg_isready] )) || +_pgsql_pg_isready() { + (( CURRENT > 2 )) && local -a common_opts_excl=( '!---null' ) + local -a args=( + + x # Exclusive options + $common_opts_excl + + c # Connection options + ${(@)common_opts_conn:#*--*password*} + # @todo Complete this properly + '(-d --dbname)'{-d+,--dbname=}'[specify database name, conninfo string, or URI]:PostgreSQL database name, conninfo string, or URI:__pgsql_databases' + '(-t --timeout)'{-t+,--timeout=}'[specify time-out interval]:time-out interval (seconds)' + + C # Misc. common options + '(-q --quiet)'{-q,--quiet}'[suppress normal output]' + ) + _arguments -s -S : $args +} + +# Complete pg_restore command +(( $+functions[_pgsql_pg_restore] )) || +_pgsql_pg_restore() { + (( CURRENT > 2 )) && local -a common_opts_excl=( '!---null' ) + local -a fmts=( + # Plain-text is intentionally missing here + {c,custom}'\:custom-format archive' + {d,directory}'\:directory-format archive' + {t,tar}'\:tar-format archive' + ) + # It probably isn't that helpful to complete indexes, &c., from existing + # databases, but oh well + local -a args=( + + x # Exclusive options + $common_opts_excl + + c # Connection options + $common_opts_conn + '(-d --dbname)'{-d+,--dbname=}'[restore to specified database]: :__pgsql_databases' + '--role=[specify role used to perform restore]: :__pgsql_roles -a' + + '(ds)' # Data/schema options + '(-c --clean)'{-a,--data-only}'[restore only data (not schema/definitions)]' + {-s,--schema-only}'[restore only schema/definitions (not data)]' + + o # Other arguments + '(-1 --single-transaction)'{-1,--single-transaction}'[perform restore as a single transaction]' + '(-a -c --clean --data-only)'{-c,--clean}'[clean objects before creating them]' + '(-C --create)'{-C,--create}'[create database before restoring to it]' + '(-e --exit-on-error)'{-e,--exit-error}'[exit immediately on error]' + '(-f --file)'{-f+,--file=}'[specify output file for generated script or listing]:output file:_files' + '(-F --format)'{-F+,--format=}"[specify archive format]:archive format:((${(j< >)${(@qq)fmts}}))" + '*'{-I+,--index=}'[restore only definition of specified index]: :__pgsql_indexes' + '(-j --jobs)'{-j+,--jobs=}'[restore in parallel with specified number of jobs]:number of jobs' + '(-l --list)'{-l,--list}'[list archive table of contents]' + '(-L --use-list)'{-L+,--use-list=}'[restore only archive elements in specified list file]:list file:_files' + '*'{-n+,--schema=}'[restore only objects in specified schema]: :__pgsql_schemas' + '*'{-N+,--exclude-schema=}'[do not restore objects in specified schema]: :__pgsql_schemas' + '(-O --no-owner)'{-O,--no-owner}'[do not restore ownership of objects from archive]' + '*'{-P+,--function=}'[restore only the specified function]:PostgreSQL function' + # No effect, kept for backwards compatibility + '!'{-R,--no-reconnect} + '(-S --superuser)'{-S+,--superuser=}'[specify super-user name]: :__pgsql_roles' + '*'{-t+,--table=}'[restore only specified table]: :__pgsql_tables' + '*'{-T+,--trigger=}'[restore only specified trigger]:PostgreSQL trigger' + '(-v --verbose)'{-v,--verbose}'[output verbosely]' + '(-x --no-acl --no-privileges)'{-x,--no-acl,--no-privileges}'[do not dump access privileges]' + '--disable-triggers[disable triggers before restoring (with -a)]' + '--enable-row-security[restore with row security enabled]' + '--if-exists[use conditional commands when cleaning objects (with -c)]' + '--no-data-for-failed-tables[do not restore data if table creation failed]' + '--no-publications[do not restore publications]' + '--no-security-labels[do not restore security labels]' + '--no-subscriptions[do not restore subscriptions]' + '--no-tablespaces[do not restore tablespaces]' + '*--section=[dump only specified section]:section:(pre-data data post-data)' + '--strict-names[require -n/-t qualifiers to match at least one schema/table]' + '--use-set-session-authorization[use SET SESSION AUTHORIZATION commands to set ownership of objects]' + '1:archive file:_files' + ) + _arguments -s -S : $args +} + +# Complete pg_upgrade command +(( $+functions[_pgsql_pg_upgrade] )) || +_pgsql_pg_upgrade() { + (( CURRENT > 2 )) && local -a common_opts_excl=( '!---null' ) + local -a args=( + + x # Exclusive options + $common_opts_excl + + o # Other options + '(-b --old-bindir)'{-b+,--old-bindir=}'[specify old executable directory]:old executable directory:_directories' + '(-B --new-bindir)'{-B+,--new-bindir=}'[specify new executable directory]:new executable directory:_directories' + '(-c --check)'{-c,--check}"[check clusters only (don't change any data)]" + '(-d --old-datadir)'{-d+,--old-datadir=}'[specify old data directory]:old data directory:_directories' + '(-D --new-datadir)'{-D+,--new-datadir=}'[specify new data directory]:new data directory:_directories' + '(-j --jobs)'{-j+,--jobs=}'[upgrade in parallel with specified number of jobs]:number of jobs' + '(-k --link)'{-k,--link}'[use hard links instead of copying files to new cluster]' + '*'{-o+,--old-options=}'[specify command-line options to old postgres]:old postgres command-line options' + '*'{-O+,--new-options=}'[specify command-line options to new postgres]:new postgres command-line options' + '(-p --old-port)'{-p+,--old-port=}'[specify old port number]:old port number:__pgsql_ports' + '(-P --new-port)'{-P+,--new-port=}'[specify new port number]:new port number:__pgsql_ports' + '(-r --retain)'{-r,--retain}'[retain SQL and log files even after successful completion]' + '(-U --username)'{-U+,--username=}'[specify cluster install user name]: :__pgsql_roles' + '(-v --verbose)'{-v,--verbose}'[log verbosely]' + ) + _arguments -s -S : $args +} + +# Complete postgres/postmaster commands +(( $+functions[_pgsql_postgres] )) || +_pgsql_postgres() { + local -a args + + (( CURRENT > 2 )) && local -a common_opts_excl=( '!---null' ) + args=( + + x # Exclusive options + $common_opts_excl + '--describe-config[dump internal configuration variables, descriptions, and defaults]' + + o # Other options + '-B+[specify number of shared buffers used by server processes]:number of shared buffers' + '*-c+[set specified run-time configuration parameter]: :__pgsql_cfg_params_values' + '-C+[display value of specified run-time configuration parameter]: :__pgsql_cfg_params' + '-d+[specify debug level]:debug level:(0 1 2 3 4 5)' + '-D+[specify configuration directory]:PostgreSQL configuration directory:_directories' + '-e[set default date style to European (DMY)]' + '-F[disable fsync calls]' + '(-i)-h+[specify TCP/IP address to listen on]:listening addresses:__pgsql_hosts_seq' + '(-h)-i[allow remote connections via TCP/IP]' + '-k+[specify directory of UNIX-domain socket to listen on]:UNIX-domain socket directory:__pgsql_hosts_seq -/' + '-l[enable secure connections using SSL]' + '-N+[specify max number of client connections]:number of client connections' + '*-o+[specify extra command-line options to pass down to postgres]:postgres command-line options' + '-p+[specify TCP/IP port or UNIX-domain socket file extension to listen on]: :__pgsql_ports' + '-s[display time information and other statistics after each command]' + '-S+[specify amount of memory for sort/hash operations]:amount of memory' + # These are 'semi-internal' options that we don't really complete, but we'll + # account for them anyway + '!'{-f+,-n,-O,-P,-t+,-T,-v+,-W+} + ) + # --single must be the first argument on the command line + (( CURRENT == 2 )) && args+=( + '--single[enter single-user mode]' + ) + (( CURRENT > 2 )) && [[ ${(Q)words[2]} == --single ]] && args+=( + '-E[echo SQL commands to stdout]' + '-j[use semicolon followed by two newlines as command-entry terminator]' + '-r+[send server log output to specified file]:log file:_files' + ) + + _arguments -s -S : $args +} + +# Complete psql command +(( $+functions[_pgsql_psql] )) || +_pgsql_psql() { + local -a args=( + + x # Exclusive options + ${(@M)common_opts_excl:#*version*} + '(: * -)'{-\?,--help=-}'[display help information]::help topic:(commands options variables)' + + c # Connection options + ${(@)common_opts_conn/#\(-U/(2 -U} + '(1 -d --dbname)'{-d+,--dbname=}'[specify database name]: :__pgsql_databases' + # @todo Complete this properly + '(-d --dbname)1:PostgreSQL database name, conninfo string, or URI:__pgsql_databases' + # @todo This shouldn't be offered if the first operand isn't a dbname + '(-U --username)2: :__pgsql_roles' + + '(e)' # Echo options (ECHO variable) + {-a,--echo-all}'[echo all non-empty input lines back to stdout]' + {-b,--echo-errors}'[echo failed SQL commands to stderr]' + {-e,--echo-queries}'[echo SQL commands to stdout]' + + '(f)' # Format options + '(x)'{-A,--no-align}'[display results in unaligned format]' + '(sf sr)'{-H,--html}'[display results in HTML table format]' + + '(sf)' # Field-separator options + '(-H --html x)'{-F+,--field-separator=}'[specify field separator (with -A)]:field separator' + '(-H --html x)'{-z,--field-separator-zero}'[use NUL as field separator (with -A)]' + + '(sr)' # Record-separator options + '(-H --html x)'{-R+,--record-separator=}'[specify record separator (with -A)]:record separator' + '(-H --html x)'{-0,--record-separator-zero}'[use NUL as record separator (with -A)]' + + '(t)' # HTML-table options + '(-A --no-align sf sr)'{-T+,--table-attr=}'[specify HTML table attributes]:HTML attributes' + + '(x)' # Expanded-table-formatting options + '(-A --no-align sf sr)'{-x,--expanded}'[enable expanded table formatting]' + + o # Other options + '(-1 --single-transaction)'{-1,--single-transaction}'[wrap all commands in a single transaction (with -c/-f)]' + '*'{-c+,--command=}'[execute specified command string]:command string' + '(-E --echo-hidden)'{-E,--echo-hidden}'[echo queries generated by backslash commands]' + '*'{-f+,--file=}'[execute commands from specified file]:SQL file:_files' + # The documentation says that all other 'non-connection' options are ignored + # when this one is given... but it lies. There *are* several options that + # get ignored, but it's irritating to enumerate them + '(-l --list)'{-l,--list}'[display available databases]' + '(-L --log-file)'{-L+,--log-file=}'[also log query output to specified file]:log file:_files' + '(-n --no-readline)'{-n,--no-readline}'[do not use Readline for line editing and history]' + '(-o --output)'{-o+,--output=}'[write query output to specified file]:output file:_files' + '*'{-P+,--pset=}'[specify printing option]: :__pgsql_cfg_variables_values --pset' + '(-q --quiet)'{-q,--quiet}'[suppress informational output]' + '(-s --single-step)'{-s,--single-step}'[prompt before executing each command]' + '(-S --single-line)'{-S,--single-line}'[treat newlines as semicolons]' + '(-t --tuples-only)'{-t,--tuples-only}'[do not output columns names, row counts, etc.]' + '*'{-v+,--set=,--variable=}'[perform specified variable assignment]: :__pgsql_cfg_variables_values --set' + '(-X --no-psqlrc)'{-X,--no-psqlrc}'[do not read start-up files]' + ) + _arguments -s -S : $args +} + +# Complete reindexdb command +(( $+functions[_pgsql_reindexdb] )) || +_pgsql_reindexdb() { + (( CURRENT > 2 )) && local -a common_opts_excl=( '!---null' ) + local -a args=( + + x # Exclusive options + $common_opts_excl + + c # Connection options (not actually usable with --all) + $common_opts_connm + + '(d)' # Database connection options + '(a o)'{-d+,--dbname=}'[specify database name]: :__pgsql_databases' + + C # Misc. common options + $common_opts_echo + # -q and -v are NOT exclusive. -q only seems to affect --all mode + '(-q --quiet)'{-q,--quiet}'[do not display progress messages]' + '(-v --verbose)'{-v,--verbose}'[display detailed information during processing]' + + a # --all-mode options + '(c d n o s -a --all)'{-a,--all}'[reindex all databases]' + + n # Normal-mode options + '(a s)*'{-i+,--index=}'[re-create specified index only]: :__pgsql_indexes' + '(a s)*'{-S+,--schema=}'[reindex specified schema only]: :__pgsql_schemas' + '(a s)*'{-t+,--table=}'[reindex specified table only]: :__pgsql_tables' + + s # --system-mode options + '(a n -s --system)'{-s,--system}"[reindex database's system catalogs]" + + o # Operands + '(a d)1: :__pgsql_databases' + ) + _arguments -s -S : $args +} + +# Complete vacuumdb command +(( $+functions[_pgsql_vacuumdb] )) || +_pgsql_vacuumdb() { + local -a args=( + + x # Exclusive options + $common_opts_excl + + c # Connection options (not actually usable with --all) + $common_opts_connm + + '(d)' # Database connection options + '(a o)'{-d+,--dbname=}'[specify database name]: :__pgsql_databases' + + C # Misc. common options + $common_opts_echo + '(-j --jobs)'{-j+,--jobs=}'[run specified number of vacuum/analyze commands in parallel]:number of jobs' + '--min-mxid-age=[specify minimum MXID age of tables to vacuum]:minimum MXID age' + '--min-xid-age=[specify minimum XID age of tables to vacuum]:minimum XID age' + '--skip-locked[skip relations that cannot be immediately locked]' + # -q and -v are NOT exclusive + '(-q --quiet)'{-q,--quiet}'[do not display progress messages]' + '(-v --verbose)'{-v,--verbose}'[display detailed information during processing]' + + f # Options incompatible with analyse-only options + '(Z)--disable-page-skipping[disable all page-skipping behavior]' + '(Z -f --full)'{-f,--full}'[perform full vacuum]' + '(Z -F --freeze)'{-F,--freze}'[aggressively freeze tuples]' + + '(z)' # Analyse options + {-z,--analyze}'[also calculate statistics for use by optimizer]' + + '(Z)' # Analyse-only options + '(f)'{-Z,--analyze-only}'[only calculate statistics for use by optimizer (no vacuum)]' + '(f)--analyze-in-stages[like -Z, but analyze in stages for faster results]' + + a # --all-mode options + '(c d n -a --all)'{-a,--all}'[reindex all databases]' + + n # Normal-mode options + # @todo When used with -z, &al., this accepts a column name in brackets. We + # don't complete that + '(a)*'{-t+,--table=}'[vacuum/analyze specified table(column) only]: :__pgsql_tables' + + o # Operands + '(a d)1: :__pgsql_databases' + ) + _arguments -s -S : $args +} + +# Router +_postgresql() { + # Common exclusive options + local -a common_opts_excl=( + '(: * -)'{-\?,--help}'[display help information]' + '(: * -)'{-V,--version}'[display version information]' + ) + # Common connection options + local -a common_opts_conn=( + '(-h --host)'{-h+,--host=}'[specify database server host or socket directory]: :__pgsql_hosts_seq -a' + '(-p --port)'{-p+,--port=}'[specify database server port]: :__pgsql_ports' + '(-U --username)'{-U+,--username=}'[specify user name to connect with]: :__pgsql_roles' + '(-w -W --no-password --password)'{-w,--no-password}'[never prompt for password on connect]' + '(-w -W --no-password --password)'{-W,--password}'[force prompt for password on connect]' + ) + # Common connection options + --maintenance-db + local -a common_opts_connm=( + $common_opts_conn + '--maintenance-db=[specify maintenance database name]: :__pgsql_databases' + ) + # Common echo options + local -a common_opts_echo=( + '(-e --echo)'{-e,--echo}'[echo generated commands to stdout]' + ) + + # Special case: pg_dumpall is handled as pg_dump + if [[ $service == pg_dumpall ]]; then + _pgsql_pg_dump "$@" + # Special case: postmaster is handled as postgres + elif [[ $service == postmaster ]]; then + _pgsql_postgres "$@" + elif (( $+functions[_pgsql_$service] )); then + _pgsql_$service "$@" + else + _message "unsupported PostgreSQL service: $service" + _default + fi +} + +_postgresql "$@" diff --git a/Completion/Unix/Command/_prcs b/Completion/Unix/Command/_prcs deleted file mode 100644 index 46e441c34..000000000 --- a/Completion/Unix/Command/_prcs +++ /dev/null @@ -1,191 +0,0 @@ -#compdef prcs - -local curcontext="$curcontext" state line subcmds ret=1 -typeset -A opt_args - -# lookup project names in the repository -# (this does not handle subprojects) - -(( $+functions[_prcs_projects] )) || -_prcs_projects() { - local expl - - _wanted prcs-projects expl 'project name' compadd "$@" - \ - ${~opt_args[-R]:-${opt_args[--repository]:-${PRCS_REPOSITORY:-~/PRCS}}}/*(/:t) -} - -# standard options for all subcommands - -(( $+functions[_prcs_arguments] )) || -_prcs_arguments() { - _arguments -s \ - '(-f --force)'{-f,--force}'[resolve interactive queries in some fixed way]' \ - '(-h -H --help)'{-h,-H,--help}'[print out help]' \ - '(-j --jobs)'{-j,--jobs=}'[spawn many child processes at once]:number:' \ - '(-l -L --long-format --long-long-format)'{-l,--long-format}'[long format]' \ - '(-l -L --long-format --long-long-format)'{-L,--long-long-format}'[longer format]' \ - '(-n --no-action)--no-action[show what would happen but leave files unchanged]' \ - '(-q --quiet)'{-q,--quiet}'[suppress normal informational messages]' \ - "--plain-format[don't break lines at screen width]" \ - '(-R --repository)'{-R,--repository=}'[specify the repository directory]:directory:_files -/' \ - "$@" -} - -_arguments -C \ - '(* -)'{-h,-H,--help}'[print out help]' \ - '(* -)--version[display program version]' \ - '*:: :->subcmd' && ret=0 - -if (( CURRENT == 1 )); then - subcmds=( - 'admin:admin subcommand' - 'checkin:checkin project revision' - 'checkout:checkout project revision' - 'config:verify configuration' - 'delete:delete named revision of project' - 'depopulate:remove named files from project descriptor' - 'diff:show differences between two revisions' - 'execute:execute a command for each file in a project' - 'info:print information about versions of project' - 'merge:reconcile differences between working files and another revision' - 'package:package the project and all its revisions into packagefile' - 'populate:add named files to project descriptor' - 'rekey:set keywords in selected files' - 'unpackage:unpackage project in packagefile' - ) - - _describe -t commands 'prcs command' subcmds && ret=0 - return ret -fi - -curcontext="${curcontext%:*}-$words[1]:" - -case "$words[1]" in - admin) - if (( CURRENT == 2 )); then - subcmds=( - 'access:set the access permissions on the repository' - 'compress:instruct PRCS to save disk space for project' - 'init:create a repository entry' - 'pdelete:delete a repository entry' - 'pinfo:list all projects in the repository' - 'prename:rename a repository entry' - 'rebuild:reconstruct PRCS data files in the repository' - 'uncompress:instruct PRCS to save time in processing project' - ) - _describe -t commands 'admin subcommand' subcmds - else - shift words - (( --CURRENT )) - curcontext="${curcontext%:*}-$words[1]:" - case "$words[1]" in - access|compress|init|pdelete|prename|rebuild) - _prcs_arguments ':project name:_prcs_projects' - ;; - pinfo) - _prcs_arguments - ;; - uncompress) - _prcs_arguments \ - '-i[expand the entire project immediately]' \ - ':project name:_prcs_projects' - ;; - *) - _message "unknown prcs administrative subfunction: $words[1]" - ;; - esac - fi - ;; - checkin) - _prcs_arguments \ - '(-r --revision)'{-r+,--revision=}'[specify version of the project]:revision:' \ - '(-s --skilled-merge)'{-s,--skilled-merge}'[turn off most of the safety features of merge]' \ - ':project name:_prcs_projects' \ - '*:file or directory:_files' - ;; - checkout) - _prcs_arguments \ - '(-r --revision)'{-r+,--revision=}'[specify version of the project]:revision:' \ - '(-p --preserve)'{-p,--preserve}'[preserve permissions on files that are checked out]' \ - '(-u --unlink)'{-u,--unlink}"[don't overwrite symbolic link references]" \ - '(-P --exclude-project-file)'{-P,--exclude-project-file}"[don't checkout the project file]" \ - ':project name:_prcs_projects' \ - '*:file or directory:_files' - ;; - config) - _prcs_arguments - ;; - delete) - _prcs_arguments \ - '(-r --revision)'{-r+,--revision=}'[specify version of the project]:revision:' \ - ':project name:_prcs_projects' - ;; - depopulate) - _prcs_arguments \ - ':project name:_prcs_projects' \ - '*:file or directory:_files' - ;; - diff) - _prcs_arguments \ - '*'{-r+,--revision=}'[specify version of the project]:revision:' \ - '(-k --keywords)'{-k,--keywords}'[compare keywords too]' \ - '(-N --new)'{-N,--new}'[compare new files against empty files]' \ - '(-P --exclude-project-file)'{-P,--exclude-project-file}"[don't diff the project file]" \ - '--[introduce diff options]:*::diff options:= _diff_options ${PRCS_DIFF_COMMAND:-diff}' \ - ':project name:_prcs_projects' \ - '*:file or directory:_files' - ;; - execute) - _prcs_arguments \ - '(-r --revision)'{-r+,--revision=}'[specify version of the project]:revision:' \ - '--pre[list directories first]' \ - '(--pipe)--all[execute command once, with all files as arguments]' \ - '(--all)--pipe[supply file contents as the standard input]' \ - '--match[execute command on files matching a pattern]:pattern:' \ - '--not[execute command on files not matching a pattern]:pattern:' \ - '--:command: _command_names -e:*::arguments: _normal' \ - ':project name:_prcs_projects' \ - '*:file or directory:_files' - ;; - info) - _prcs_arguments \ - '(-r --revision)'{-r+,--revision=}'[specify version of the project]:revision:' \ - '--sort=[set sorting type]:sorting type:(version date)' \ - ':project name:_prcs_projects' \ - '*:file or directory:_files' - ;; - merge) - _prcs_arguments \ - '(-r --revision)'{-r+,--revision=}'[specify version of the project]:revision:' \ - '(-s --skilled-merge)'{-s,--skilled-merge}'[turn off most of the safety features of merge]' \ - '(-u --unlink)'{-u,--unlink}"[don't overwrite symbolic link references]" \ - ':project name:_prcs_projects' \ - '*:file or directory:_files' - ;; - package) - _prcs_arguments \ - '(-r --revision)'{-r+,--revision=}'[specify version of the project]:revision:' \ - '(-z --compress)'{-z,--compress=}'[compress the output]' \ - ':project name:_prcs_projects' \ - ':file:_files' - ;; - populate) - _prcs_arguments \ - '(-d --delete)'{-d,--delete=}'[perform optional deletions]' \ - ':project name:_prcs_projects' \ - '*:file or directory:_files' - ;; - rekey) - _prcs_arguments \ - '(-u --unlink)'{-u,--unlink}"[don't overwrite symbolic link references]" \ - ':project name:_prcs_projects' - ;; - unpackage) - _prcs_arguments \ - ':file:_files' \ - ':project name:_prcs_projects' - ;; - *) - _message "unknown prcs command: $words[1]" - ;; -esac diff --git a/Completion/Unix/Command/_pv b/Completion/Unix/Command/_pv new file mode 100644 index 000000000..68f8e8586 --- /dev/null +++ b/Completion/Unix/Command/_pv @@ -0,0 +1,87 @@ +#compdef pv + +local curcontext="$curcontext" ign Edesc ret=1 +local -a state state_descr line expl suf args fmts +local -A opt_args + +(( $#words > 2 )) && ign='!' +(( $+words[(r)-[^-]#E*] )) && Edesc=' and only report a read error once per file' +[[ $OSTYPE = linux* ]] && args=( + '(-d --watchfd)'{-d+,--watchfd=}'[watch file descriptor opened by process]:process\:fd:->pid-fds' \ +) + +_arguments -s -S $args \ + '(-p --progress -F --format)'{-p,--progress}'[show progress bar]' \ + '(-t --timer -F --format)'{-t,--timer}'[show elapsed time]' \ + '(-e --eta -F --format)'{-e,--eta}'[show estimated time of arrival]' \ + '(-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]' \ + '(-b --bytes -F --format)'{-b,--bytes}'[show number of bytes transferred]' \ + '(-T --buffer-percent -F --format)'{-T,--buffer-percent}'[show percentage of transfer buffer in use]' \ + '(-A --last-written -F --format)'{-A+,--last-written=}'[show number of bytes last written]:number (bytes)' \ + '(-F --format -p --progress -t --timer -e --eta -I --fineta -r --rate -a --average-rate -b --bytes -T --buffer-percent -A --last-written -F --format)'{-F+,--format=}'[set output format]:format:->formats' \ + '(-n --numeric -f --force)'{-n,--numeric}'[output percentages, not visual information]' \ + '(-q --quiet)'{-q,--quiet}"[don't output any transfer information at all, useful with -L]" \ + '(-W --wait)'{-W,--wait}'[display nothing until first byte transferred]' \ + '(-D --delay-start -R --remote)'{-D+,--delay-start=}'[display nothing until delay has passed]:delay (seconds)' \ + '(-s --size)'{-s+,--size=}'[set estimated data size]:size (bytes):->size-unit' \ + '(-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]' \ + '(-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' \ + '(-f --force -R --remote)'{-f,--force}'[output even if standard error is not a terminal]' \ + '(-c --cursor -R --remote)'{-c,--cursor}'[use cursor positioning escape sequences]' \ + '(-L --rate-limit)'{-L+,--rate-limit=}'[limit transfer rate]:rate (bytes per second):->size-unit' \ + '(-B --buffer-size)'{-B+,--buffer-size=}'[use a buffer size of given size]:size (bytes):->size-unit' \ + '(-C --no-splice)'{-C,--no-splice}'[never use splice(), always use read/write]' \ + '(-R --remote)*'{-E,--skip-errors}"[skip read errors in input${Edesc}]" \ + '(-S --stop-at-size -R --remote)'{-S,--stop-at-size}'[stop after --size bytes have been transferred]' \ + '(-R --remote -c --cursor -l --line-mode -f --force -D --delay-start -E --skip-errors -S --stop-at-size)'{-R+,--remote=}'[update settings of specified process]:process:_pids -m pv' \ + '(-P --pidfile)'{-P+,--pidfile=}'[save process id in a file]:file:_files' \ + "${ign}(- *)"{-h,--help}'[display usage information]' \ + "${ign}(- *)"{-V,--version}'[display version information]' \ + '*:file:_files' && ret=0 + +case $state in + formats) + compset -P '(%?|%<->A|[^%])#' + fmts=( + 'p:progress bar' + 't:elapsed time' + 'e:estimated time remaining' + 'I:estimated time of completion' + 'r:current data transfer rate' + 'a:average data transfer rate' + 'b:bytes transferred so far' + 'T:percentage of transfer buffer in use' + 'N:name prefix' + '%:literal %' + ) + _describe -t format-specifiers 'format specifier' fmts -p % -S '' + ;; + pid-fds) + if compset -P 1 '*:'; then + _message -e file-descriptors 'file descriptor' + else + compset -S ':*' || suf=( -qS : ) + _pids $suf && ret=0 + fi + ;; + size-unit) + if compset -P '<->'; then + _tags values units + else + _tags values + fi + while _tags; do + _requested values && _message -e values "$state_descr" && ret=0 + _requested units expl unit compadd -o nosort - K M G T && ret=0 + (( ret )) || break + done + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python index 2fb4a915b..f10106f9b 100644 --- a/Completion/Unix/Command/_python +++ b/Completion/Unix/Command/_python @@ -16,7 +16,7 @@ if _pick_variant python3=Python\ 3 python2 --version; then ) else args=( - '-R[use a pseudo-random salt to make hash values unpredeictable]' + '-R[use a pseudo-random salt to make hash values unpredictable]' '-Q+[division options]:division option:(old warn warnall new)' '(-tt)-t[issue warnings about inconsistent tab usage]' '(-t)-tt[issue errors about inconsistent tab usage]' diff --git a/Completion/Unix/Command/_raggle b/Completion/Unix/Command/_raggle deleted file mode 100644 index 4bda595be..000000000 --- a/Completion/Unix/Command/_raggle +++ /dev/null @@ -1,48 +0,0 @@ -#compdef raggle - -# Raggle v0.4.0 - -local curcontext="$curcontext" state line -typeset -A opt_args - -_arguments -C -s \ - '(-a --add)'{-a,--add}"[add a new feed (requires '--url')]" \ - '(-A --ascii)'{-A,--ascii}'[use ASCII characters instead of ANSI for window borders]' \ - '(-c --config)'{-c,--config}'[specify an alternate config file]:config file:_files -g "*.rb(-.)"' \ - '--default-config[print out the default configuration of Raggle in a format suitable for your config.rb file]' \ - '(-d --delete)'{-d,--delete}'[delete an existing feed]:feed ID:->feed' \ - '--diag[run raggle in diagnostics/debug mode]' \ - '(-e --edit)'{-e,--edit}'[edit an existing feed]:feed ID:->feed' \ - '(--import-opml)--export-opml[export feeds to OPML]:OPML file:_files -g "*.opml(-.)"' \ - '(-f --find)'{-f,--find}'[find feeds containing a string, via Syndic8]:search string:' \ - "--force[force behavior Raggle won't normally allow]" \ - '(-)'{-h,--help,--usage}'[display help information]' \ - '(--export-opml)--import-opml[import feeds from an OPML file]:OPML file:_files -g "*.opml(-.)"' \ - '(-i --invalidate)'{-i,--invalidate}'[invalidate a feed (force an update)]:feed ID:->feed' \ - '(-l --list)'{-l,--list}"[list existing feeds (use '--verbose' to show URLs as well)]" \ - "--lock-title[lock Title attribute of feed (for '--add' and '--edit')]" \ - "--max[set the maximum number of items for a feed (for '--add' and '--edit')]" \ - '(-p --priority)'{-p,--priority}"[feed sorting priority: 0 by default, higher values will sort feeds to the top (for '--add' and '--edit')]:sorting priority:" \ - '--purge[purge deleted feeds from feed cache]' \ - '(-r --refresh)'{-r,--refresh}"[refresh attribute of feed (for '--add' and '--edit')]:refresh time (minutes):" \ - "--save-items[save old items of feed (for '--add' and '--edit')]" \ - '--server[run Raggle in HTTP server mode]:port:_ports' \ - '(--sort --sort-feeds)'{--sort,--sort-feeds}'[sort feeds by priority then title (case-insensitive)]' \ - '(-t --title)'{-t,--title}"[title attribute of feed (for '--add' and '--edit')]:feed title:" \ - "--unlock-title[unlock Title attribute of feed (for '--add' and '--edit')]" \ - "--unsave-items[don't save old items of feed (for '--add' and '--edit')]" \ - "--update[update feed (or all feeds, if unspecified)]::feed ID:->feed" \ - '(-u --url)'{-u,--url}"[URL attribute of feed (for '--add' and '--edit')]:URL:_urls" \ - '--verbose[turn on verbose output]' \ - '(-)'{-v,--version}'[display version information]' && return 0 - -if [[ "$state" = feed ]]; then - local feeds - feeds=( - ${${(M)${${(f)"$(_call_program feeds $words[1] \ - --list)"}/(#s)[[:blank:]]/}:#[0-9]##,*}/, /:} - ) - _describe -t feeds "RSS feed" feeds && return 0 -fi - -return 1 diff --git a/Completion/Unix/Command/_rclone b/Completion/Unix/Command/_rclone new file mode 100644 index 000000000..40f06e0ba --- /dev/null +++ b/Completion/Unix/Command/_rclone @@ -0,0 +1,346 @@ +#compdef rclone + +local curcontext="$curcontext" ret=1 +local -A opt_args +local -a state line commands remotes + +commands=( + "about\:'get quota information from the remote'" + "authorize\:'remote authorization'" + "cachestats\:'print cache stats for a remote'" + "cat\:'concatenate any files and send them to stdout'" + "check\:'check files on the source and destination match'" + "cleanup\:'clean up the remote if possible'" + "config\:'enter an interactive configuration session'" + "copy\:'copy files from source to dest, skipping already copied'" + "copyto\:'copy files from source to dest, skipping already copied'" + "copyurl\:'copy url content to dest'" + "cryptcheck\:'check the integrity of a crypted remote'" + "cryptdecode\:'return unencrypted file names'" + "dbhashsum\:'produce a Dropbox hash file for all the objects in the path'" + "dedupe\:'interactively find duplicate files and delete/rename them'" + "delete\:'remove the contents of path'" + "deletefile\:'remove a single file from remote'" + "genautocomplete\:'output completion script for a given shell'" + "gendocs\:'output markdown docs for rclone to the directory supplied'" + "hashsum\:'produce an hashsum file for all the objects in the path'" + "help\:'show help for rclone commands, flags and backends'" + "link\:'generate public link to file/folder'" + "listremotes\:'list all the remotes in the config file'" + "ls\:'list the objects in the path with size and path'" + "lsd\:'list all directories/containers/buckets in the path'" + "lsf\:'list directories and objects on remote:path formatted for parsing'" + "lsjson\:'list directories and objects in the path in JSON format'" + "lsl\:'list the objects in path with modification time, size and path'" + "md5sum\:'produce an md5sum file for all the objects in the path'" + "mkdir\:'make the path if it does not already exist'" + "mount\:'mount the remote as file system on a mountpoint'" + "move\:'move files from source to dest'" + "moveto\:'move file or directory from source to dest'" + "ncdu\:'explore a remote with a text based user interface'" + "obscure\:'obscure password for use in the rclone.conf'" + "purge\:'remove the path and all of its contents'" + "rc\:'run a command against a running rclone'" + "rcat\:'copy standard input to file on remote'" + "rcd\:'run rclone listening to remote control commands only'" + "rmdir\:'remove the path if empty'" + "rmdirs\:'remove empty directories under the path'" + "serve\:'serve a remote over a protocol'" + "settier\:'change storage class/tier of objects on remote'" + "sha1sum\:'produce an sha1sum file for all the objects in the path'" + "size\:'print the total size and number of objects on remote:path'" + "sync\:'make source and dest identical, modifying destination only'" + "touch\:'create new file or change file modification time'" + "tree\:'list the contents of the remote in a tree like fashion'" + "version\:'show the version number'" +) + +_arguments -C \ + ":command:(($commands))" \ + '--ask-password[prompt for password for encrypted configuration]' \ + "--auto-confirm[don't request console confirmation]" \ + '--backup-dir[make backups into hierarchy based at specified directory]:directory:_directories' \ + '--bind[specify socal address to bind to for outgoing connections]:IPv4, IPv6 or name' \ + '--buffer-size[specify in memory buffer size when reading files for each --transfer]:size [16M]' \ + '--bwlimit[specify bandwidth limit]:BwTimetable (kBytes/s or b|k|M|G suffix)' \ + '--cache-dir[specify directory rclone will use for caching]:directory [~/.cache/rclone]:_directories' \ + '--checkers[specify number of checkers to run in parallel]:number [8]': \ + '(-c --checksum)'{-c,--checksum}'[skip based on checksum & size, not mod-time & size]' \ + '--config[specify config file]:file [~/.config/rclone/rclone.conf]:_files' \ + '--contimeout[specify connect timeout]:duration [1m0s]' \ + '--cpuprofile[write cpu profile to specified file]:file:_files' \ + '(--delete-before --delete-during)--delete-after[when synchronizing, delete files on destination after transferring (default)]' \ + '(--delete-after --delete-during)--delete-before[when synchronizing, delete files on destination before transferring]' \ + '(--delete-before --delete-after)--delete-during[when synchronizing, delete files during transfer]' \ + '--delete-excluded[delete files on dest excluded from sync]' \ + '--disable[disable a comma separated list of features]:feature' \ + '(-n --dry-run)'{-n,--dry-run}'[do a trial run with no permanent changes]' \ + '--dump[list of items to dump from]:string:_sequence compadd - headers bodies requests responses auth filters goroutines openfiles' \ + '--dump-bodies[dump HTTP headers and bodies - may contain sensitive info]' \ + '--dump-headers[dump HTTP headers - may contain sensitive info]' \ + '--exclude[exclude files matching pattern]:stringArray' \ + '--exclude-from[read exclude patterns from file]:files:_files' \ + '--exclude-if-present[exclude directories if filename is present]:string' \ + '--fast-list[use recursive list if available]' \ + '--files-from[read list of source-file names from file]:file:_files' \ + {-f,--filter}'[add a file-filtering rule]:stringArray' \ + '--filter-from[read filtering patterns from a file]:file:_files' \ + '--ignore-case[ignore case in filters (case insensitive)]' \ + '--ignore-case-sync[ignore case when synchronizing]' \ + '--ignore-checksum[skip post copy check of checksums]' \ + '--ignore-errors[delete even if there are I/O errors]' \ + '--ignore-existing[skip all files that exist on destination]' \ + '--ignore-size[ignore size when skipping use mod-time or checksum]' \ + '(-I --ignore-times)'{-I,--ignore-times}"[don't skip files that match on size and time - transfer all files]" \ + "--immutable[don't modify files, fail if existing files have been modified]" \ + '--include[include files matching pattern]:stringArray' \ + '--include-from[read include patterns from file]:file:_files' \ + '--log-file[log everything to this file]:file:_files' \ + '--log-format[specify comma separated list of log format options]:string ["date,time"]' \ + '--log-level[specify log level]:string [NOTICE]:(DEBUG INFO NOTICE ERROR)' \ + '--low-level-retries[number of low level retries to do]:int [10]' \ + '--max-age[only transfer files younger than this in s or suffix ms|s|m|h|d|w|M|y]:duration [default off]' \ + '--max-backlog[maximum number of objects in sync or check backlog]:int [10000]' \ + '--max-delete[when synchronizing, limit the number of deletes]:delete limit [-1]' \ + '--max-depth[limit the recursion depth]:depth [-1]' \ + '--max-size[only transfer files smaller than this in k or suffix b|k|M|G]:int [default off]' \ + '--max-transfer[maximum size of data to transfer]:int [default off]' \ + '--memprofile[write memory profile to file]:file:_files' \ + '--min-age[only transfer files older than this in s or suffix ms|s|m|h|d|w|M|y]:duration [default off]' \ + '--min-size[only transfer files bigger than this in k or suffix b|k|M|G]:int [default off]' \ + '--modify-window[specify max time delta to be considered the same]:duration [1ns]' \ + '--multi-thread-cutoff[use multi-threaded downloads for files above specified size]:size (250M)' \ + '--multi-thread-streams[specify max number of streams to use for multi-threaded downloads]:number (4)' \ + "--no-check-certificate[don't verify the server SSL certificate (insecure)]" \ + "--no-gzip-encoding[don't set Accept-Encoding: gzip]" \ + '!--no-traverse' \ + "--no-update-modtime[don't update destination mod-time if files are identical]" \ + '(-P --progress)'{-P,--progress}'[show progress during transfer]' \ + {-q,--quiet}'[print as little as possible]' \ + '--rc[enable the remote control server]' \ + '--rc-addr[IPaddress\:port or \:port to bind server to]:string [localhost\:5572]' \ + '--rc-cert[SSL PEM key (concatenation of certificate and CA certificate)]:string' \ + '--rc-client-ca[client certificate authority to verify clients with]:string' \ + '--rc-files[path to local files to serve on the HTTP server]:directory:_path_files -/' \ + '--rc-htpasswd[htpasswd file - if not provided no authentication is done]:file:_files' \ + '--rc-job-expire-duration[expire finished async jobs older than specified duration]:duration (1m0s)' \ + '--rc-job-expire-interval[specify interval to check for expired async jobs]:interval (10s)' \ + '--rc-key[SSL PEM Private key]:string' \ + '--rc-max-header-bytes[maximum size of request header]:int [4096]' \ + "--rc-no-auth[don't require auth for certain methods]" \ + '--rc-pass[password for authentication]:string' \ + '--rc-realm[realm for authentication]:string [rclone]' \ + '--rc-serve[enable the serving of remote objects]' \ + '--rc-server-read-timeout[timeout for server reading data]:duration [1h0m0s]' \ + '--rc-server-write-timeout[timeout for server writing data]:duration [1h0m0s]' \ + '--rc-user[user name for authentication]:string' \ + '--retries[retry operations this many times if they fail]:int [3]' \ + '--retries-sleep[interval between retrying operations if they fail, e.g 500ms, 60s, 5m. (0 to disable)]:interval' \ + '--size-only[skip based on size only, not mod-time or checksum]' \ + '--stats[interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable)]:duration [1m0s]' \ + '--stats-file-name-length[max file name length in stats. 0 for no limit]:int [40]' \ + '--stats-log-level[log level to show --stats output]:string [INFO]:(DEBUG INFO NOTICE ERROR)' \ + '--stats-one-line[make the stats fit on one line]' \ + '--stats-one-line-date[enable --stats-one-line and add current date/time prefix]' \ + '--stats-one-line-date-format[enable --stats-one-line-date and use custom formatted date]:date format' \ + '--stats-unit[specify units for data rate in stats]:unit [bytes]:(bits bytes)' \ + '--streaming-upload-cutoff[specify size cutoff for switching to chunked upload]:size [100k]' \ + '--suffix[specify suffix for use with --backup-dir]:string' \ + '--syslog[use syslog for logging]' \ + '--syslog-facility[facility for syslog, eg KERN,USER,...]:string [DAEMON]' \ + '--timeout[specify IO idle timeout]:duration [5m0s]' \ + '--tpslimit[limit HTTP transactions per second to this]:float' \ + '--tpslimit-burst[max burst of transactions for --tpslimit]:int [1]' \ + '--track-renames[when synchronizing, track file renames and do a server side move if possible]' \ + '--transfers[number of file transfers to run in parallel]:int [4]' \ + {-u,--update}'[skip files that are newer on the destination]' \ + '--use-server-modtime[use server modified time instead of object metadata]' \ + '--user-agent[set the user-agent to the specified string]:user-agent [rclone/version]' \ + \*{-v,--verbose}'[print lots more stuff]:count' \ + '--acd-auth-url[auth server URL]:string' \ + '--acd-client-id[Amazon Application Client ID]:string' \ + '--acd-client-secret[Amazon Application Client Secret]:string' \ + '--acd-templink-threshold[files >= this size will be downloaded via their tempLink]:size [9G]' \ + '--acd-token-url[token server url]:string' \ + '--acd-upload-wait-per-gb[additional time per GB to wait after a failed complete upload to see if it appears]:Duration [3m0s]' \ + '--alias-remote[remote or path to alias]:string' \ + '--azureblob-access-tier[access tier of blob: hot, cool or archive]:string' \ + '--azureblob-account[specify storage account name]:string' \ + '--azureblob-chunk-size[upload chunk size (<= 100MB)]:size [4M]' \ + '--azureblob-endpoint[endpoint for the service]:string' \ + '--azureblob-key[storage account key (leave blank to use connection string or SAS URL)]:string' \ + '--azureblob-list-chunk[size of blob list]:int [5000]' \ + '--azureblob-sas-url[SAS URL for container level access only]:string' \ + '--azureblob-upload-cutoff[cutoff for switching to chunked upload (<= 256MB)]:size [256M]' \ + '--b2-account[account ID or application key ID]:string' \ + '--b2-chunk-size[specify upload chunk size]:size [96M]' \ + '--b2-endpoint[endpoint for the service]:string' \ + '--b2-hard-delete[permanently delete files on remote removal, otherwise hide files]' \ + '--b2-key[application key]:string' \ + '--b2-test-mode[a flag string for X-Bz-Test-Mode header for debugging]:string' \ + '--b2-upload-cutoff[cutoff for switching to chunked upload]:size [200M]' \ + '--b2-versions[include old versions in directory listings]' \ + '--box-client-id[specify Box app client Id]:client ID' \ + '--box-client-secret[specify Box app client secret]:secret' \ + '--box-commit-retries[max number of times to try committing a multipart file]:int [100]' \ + '--box-upload-cutoff[cutoff for switching to multipart upload (>= 50MB)]:size [50M]' \ + '--cache-chunk-clean-interval[how often should the cache perform cleanups of the chunk storage]:Duration [1m0s]' \ + '--cache-chunk-no-memory[disable the in-memory cache for storing chunks during streaming]' \ + '--cache-chunk-path[directory to cache chunk files]:directory [~/.cache/rclone/cache-backend]:_path_files -/' \ + '--cache-chunk-size[the size of a chunk (partial file data)]:size [5M]' \ + '--cache-chunk-total-size[the total size that the chunks can take up on the local disk]:size [10G]' \ + '--cache-db-path[directory to store file structure metadata DB]:directory [~/.cache/rclone/cache-backend]:_path_files -/' \ + '--cache-db-purge[clear all the cached data for this remote on start]' \ + '--cache-db-wait-time[how long to wait for the DB to be available - 0 is unlimited]:Duration [1s]' \ + '--cache-info-age[how long to cache file structure information (directory listings, file size, times etc)]:duration [6h0m0s]' \ + '--cache-plex-insecure[skip all certificate verifications when connecting to the Plex server]:string' \ + '--cache-plex-password[the password of the Plex user]:string' \ + '--cache-plex-url[the URL of the Plex server]:string' \ + '--cache-plex-username[the username of the Plex user]:string' \ + '--cache-read-retries[how many times to retry a read from a cache storage]:int [10]' \ + '--cache-remote[remote to cache]:string' \ + '--cache-rps[limits the number of requests per second to the source FS (-1 to disable)]:int [-1]' \ + '--cache-tmp-upload-path[directory to keep temporary files until they are uploaded]:directory:_path_files -/' \ + '--cache-tmp-wait-time[how long should files be stored in local cache before being uploaded]:Duration [15s]' \ + '--cache-workers[how many workers should run in parallel to download chunks]:int [4]' \ + '--cache-writes[cache file data on writes through the FS]' \ + {-L,--copy-links}'[follow symlinks and copy the pointed to item]' \ + '--crypt-directory-name-encryption[option to either encrypt directory names or leave them intact. (default true)]' \ + '--crypt-filename-encryption[specify how to encrypt the filenames]:string [standard]' \ + '--crypt-password[specify password or pass phrase for encryption]:string' \ + '--crypt-password2[specify password or pass phrase for salt]:string' \ + '--crypt-remote[remote to encrypt/decrypt]:string' \ + '--crypt-show-mapping[for all files listed show how the names encrypt]' \ + '--drive-acknowledge-abuse[set to allow files which return cannotDownloadAbusiveFile to be downloaded]' \ + '--drive-allow-import-name-change[allow the filetype to change when uploading Google docs (e.g. file.doc to file.docx)]' \ + '--drive-alternate-export[use alternate export URLs for google documents export.,]' \ + '--drive-auth-owner-only[only consider files owned by the authenticated user]' \ + '--drive-chunk-size[upload chunk size]:size [8M]' \ + '--drive-client-id[Google application client ID]:client ID' \ + '--drive-client-secret[Google application client secret]:secret' \ + '--drive-export-formats[list of preferred formats for downloading Google docs]:comma-separated format list [docx,xlsx,pptx,svg]' \ + '!--drive-formats:string' \ + '--drive-impersonate[impersonate specified user when using a service account]:user' \ + '--drive-import-formats[specify preferred formats for uploading Google docs]:formats' \ + '--drive-keep-revision-forever[keep new head revision of each file forever]' \ + '--drive-list-chunk[size of listing chunk 100-1000. 0 to disable]:int [1000]' \ + '--drive-root-folder-id[specify ID of the root folder]:string' \ + '--drive-scope[scope that rclone should use when requesting access from drive]:scope' \ + '--drive-server-side-across-configs[allow server side operations (eg copy) to work across different drive configs]' \ + '--drive-service-account-credentials[specify service account credentials JSON blob]:string' \ + '--drive-service-account-file[specify service account credentials JSON file path]:file:_files' \ + '--drive-shared-with-me[only show files that are shared with me]' \ + '--drive-size-as-quota[show storage quota usage for file size]' \ + '--drive-skip-gdocs[skip google documents in all listings]' \ + '--drive-team-drive[specify ID of the team drive]:ID' \ + '--drive-trashed-only[only show files that are in the trash]' \ + '--drive-upload-cutoff[cutoff for switching to chunked upload]:size [8M]' \ + '--drive-use-created-date[use file created date instead of modified date.,]' \ + '--drive-use-trash[send files to the trash instead of deleting permanently. (default true)]' \ + "--drive-v2-download-min-size[if object's are larger, use drive v2 API to download]:size [off]" \ + '--dropbox-chunk-size[specify upload chunk size]:size [48M]' \ + '--dropbox-client-id[specify Dropbox app client ID]:client ID' \ + '--dropbox-client-secret[specify Dropbox app client secret]:secret' \ + '--dropbox-impersonate[impersonate specified user]:user' \ + '--ftp-host[specify FTP host to connect to]:host:_hosts' \ + "--ftp-no-check-certificate[don't verify the TLS certificate of the server]" \ + '--ftp-pass[specify FTP password]:password' \ + '--ftp-port[specify FTP port]:port [21]:_ports' \ + '--ftp-tls[use FTP over TLS (implicit)]' \ + '--ftp-user[specify FTP username]::username' \ + '--gcs-bucket-acl[access control list for new buckets]:string' \ + '--gcs-client-id[Google application client id]:client id' \ + '--gcs-client-secret[Google application client secret]:secret' \ + '--gcs-location[specify location for the newly created buckets]:string' \ + '--gcs-object-acl[specify access control list for new objects]:string' \ + '--gcs-project-number[project number]:string' \ + '--gcs-service-account-file[service account credentials JSON file path]:file:_files' \ + '--gcs-storage-class[specify storage class to use when storing objects in Google cloud storage]:string' \ + '--http-url[URL of http host to connect to]:string' \ + '--hubic-chunk-size[above this size files will be chunked into a _segments container]:size [5G]' \ + '--hubic-client-id[Hubic client ID]:client ID' \ + '--hubic-client-secret[Hubic client secret]:secret' \ + '--jottacloud-hard-delete[delete files permanently rather than putting them into the trash]' \ + '--jottacloud-md5-memory-limit[files bigger than this will be cached on disk to calculate the MD5 if required]:size [10M]' \ + '--jottacloud-pass[password]:string' \ + '--jottacloud-unlink[remove existing public link to file/folder with link command rather than creating]' \ + '--jottacloud-user[user name]:string' \ + "--local-no-check-updated[don't check to see if the files change during upload]" \ + "--local-no-unicode-normalization[don't apply unicode normalization to paths and filenames (Deprecated)]" \ + '--local-nounc[disable UNC (long path names) conversion on windows]:string' \ + '(-x --one-file-system)'{-x,--one-file-system}"[don't cross filesystem boundaries (unix/macOS only)]" \ + '--onedrive-chunk-size[chunk size to upload files with - must be multiple of 320k]:size [10M]' \ + '--onedrive-client-id[specify Microsoft app client ID]:client ID' \ + '--onedrive-client-secret[specify Microsoft app client secret]:secret' \ + '--onedrive-drive-id[specify the ID of the drive to use]:string' \ + '--onedrive-drive-type[the type of the drive]:string:(personal business documentLibrary)' \ + '--onedrive-expose-onenote-files[set to make OneNote files show up in directory listings]' \ + '--opendrive-password[specify password]:string' \ + '--opendrive-username[specify username]:string' \ + '--pcloud-client-id[specify Pcloud app client ID]:client ID' \ + '--pcloud-client-secret[specify Pcloud app client secret]:secret' \ + '--s3-access-key-id[specify AWS access key ID]:string' \ + '--s3-acl[canned ACL used when creating buckets and storing or copying objects]:string' \ + '--s3-chunk-size[chunk size to use for uploading]:size [5M]' \ + "--s3-disable-checksum[don't store MD5 checksum with object metadata]" \ + '--s3-endpoint[endpoint for S3 API]:string' \ + '--s3-env-auth[get AWS credentials from runtime (environment variables or EC2/ECS meta data if no env vars)]' \ + '--s3-force-path-style[if true use path style access if false use virtual hosted style. (default true)]' \ + '--s3-location-constraint[location constraint - must be set to match the region]:string' \ + '--s3-provider[choose your S3 provider]:string' \ + '--s3-region[region to connect to]:string' \ + '--s3-secret-access-key[AWS Secret access key (password)]:string' \ + '--s3-server-side-encryption[the server-side encryption algorithm used when storing this object in S3]:string' \ + '--s3-session-token[an AWS session token]:string' \ + '--s3-sse-kms-key-id[if using KMS ID you must provide the ARN of key]:string' \ + '--s3-storage-class[the storage class to use when storing new objects in S3]:string' \ + '--s3-upload-concurrency[concurrency for multipart uploads]:int [2]' \ + '--s3-v2-auth[if true use v2 authentication]' \ + '--s3-use-accelerate-endpoint[use the AWS S3 accelerated endpoint]' \ + '--sftp-ask-password[allow asking for SFTP password when needed]' \ + '--sftp-disable-hashcheck[disable the execution of SSH commands to determine if remote file hashing is available]' \ + '--sftp-host[SSH host to connect to]:string' \ + '--sftp-key-file[path to unencrypted PEM-encoded private key file, leave blank to use ssh-agent]:string' \ + '--sftp-pass[SSH password, leave blank to use ssh-agent]:string' \ + '--sftp-path-override[override path used by SSH connection]:string' \ + '--sftp-port[SSH port, leave blank to use default]:string [22]' \ + '--sftp-set-modtime[set the modified time on the remote if set. (default true)]' \ + '--sftp-use-insecure-cipher[enable the use of the aes128-cbc cipher]' \ + '--sftp-user[SSH username, leave blank for current username]:string' \ + "--skip-links[don't warn about skipped symlinks]" \ + '--swift-auth[authentication URL for server (OS_AUTH_URL)]:string' \ + '--swift-auth-token[aUTH token from alternate authentication - optional (OS_AUTH_TOKEN)]:string' \ + '--swift-auth-version[AuthVersion - optional - set to (1,2,3) if your auth URL has no version (ST_AUTH_VERSION)]:int' \ + '--swift-chunk-size[above this size files will be chunked into a _segments container]:size [5G]' \ + '--swift-domain[user domain - optional (v3 auth) (OS_USER_DOMAIN_NAME)]:string' \ + '--swift-endpoint-type[endpoint type to choose from the service catalogue (OS_ENDPOINT_TYPE)]:string [public]' \ + '--swift-env-auth[get swift credentials from environment variables in standard OpenStack form]' \ + '--swift-key[API key or password (OS_PASSWORD)]:string' \ + '--swift-region[region name - optional (OS_REGION_NAME)]:string' \ + '--swift-storage-policy[the storage policy to use when creating a new container]:string' \ + '--swift-storage-url[storage URL - optional (OS_STORAGE_URL)]:string' \ + '--swift-tenant[tenant name - optional for v1 auth, this or tenant_id required otherwise (OS_TENANT_NAME or OS_PROJECT_NAME)]:string' \ + '--swift-tenant-domain[tenant domain - optional (v3 auth) (OS_PROJECT_DOMAIN_NAME)]:string' \ + '--swift-tenant-id[tenant ID - optional for v1 auth, this or tenant required otherwise (OS_TENANT_ID)]:string' \ + '--swift-user[user name to log in (OS_USERNAME)]:string' \ + '--swift-user-id[user ID to log in - optional - most swift systems use user and leave this blank (v3 auth) (OS_USER_ID)]:string' \ + '--union-remotes[list of space separated remotes]:string' \ + '--webdav-bearer-token[bearer token instead of user/pass (eg a Macaroon)]:string' \ + '--webdav-pass[password]:string' \ + '--webdav-url[URL of http host to connect to]:string' \ + '--webdav-user[user name]:string' \ + '--webdav-vendor[name of the Webdav site/service/software you are using]:string' \ + '--yandex-client-id[Yandex client ID]:client ID' \ + '--yandex-client-secret[Yandex client secret]:secret' \ + '--yandex-unlink[remove existing public link to file/folder with link command rather than creating]' \ + "*: :->files_or_remotes" \ + && ret=0 + +if [[ $state == 'files_or_remotes' ]]; then + remotes=( $(_call_program rclone-remotes rclone listremotes) ) + _alternative \ + "remote:rclone-remotes:compadd -a remotes" \ + "file:files:_files" && ret=0 +fi + +return ret diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf index ce78baf27..42094742e 100644 --- a/Completion/Unix/Command/_readelf +++ b/Completion/Unix/Command/_readelf @@ -11,8 +11,6 @@ args=( '(-h --file-header)'{-h,--file-header}'[show file header]' '(-l --program-headers --segments)'{-l,--program-headers,--segments}'[show program headers]' '(-S --section-headers --sections)'{-S,--section-headers,--sections}'[show sections header]' - '(-s --syms --symbols)'{-s,--syms,--symbols}'[show symbol table]' - '(-n --notes)'{-n,--notes}'[show core notes (if present)]' '(-r --relocs)'{-r,--relocs}'[show relocations (if present)]' '(-d --dynamic)'{-d,--dynamic}'[show dynamic section (if present)]' '(-V --version-info)'{-V,--version-info}'[show version sections (if present)]' @@ -35,16 +33,25 @@ case $variant in '(-t --section-details)'{-t,--section-details}'[show section details]' '(-e --headers)'{-e,--headers}'[show file, program and sections headers]' '(-s --syms --symbols)'{-s,--syms,--symbols}'[show symbol table]' + '(-n --notes)'{-n,--notes}'[show core notes (if present)]' '(-u --unwind)'{-u,--unwind}'[show unwind info (if present)]' '(-D --use-dynamic)'{-D,--use-dynamic}'[use dynamic section info when showing symbols]' ) ;| - binutils) + elfutils|binutils) args+=( '--dyn-syms[show dynamic symbol table]' + ) + ;| + binutils) + args+=( \*{-R,--relocated-dump=}"[dump contents of specified section as relocated bytes]:section:($sections)" "--dwarf-depth=[don't show DIEs at greater than specified depth]:depth" '--dwarf-start=[show DIEs starting at specified depth or deeper]:depth' + '--ctf=[display compact C type format info from section]:section' + '--ctf-parent=[use specified section as the CTF parent]:section' + '--ctf-symbols=[use specified section as the CTF external symbol table]:section' + '--ctf-strings=[use specified section as the CTF external string table]:section' ) ;; elfutils) @@ -56,6 +63,8 @@ case $variant in '(-z --decompress)'{-z,--decompress}'[show compression information; decompress before dumping data]' '(--symbols)-s[show symbol table]' '(-s)--symbols=-[show symbol table]::section:(.dynsym .symtab)' + '(--notes)-n[show core notes (if present)]' + '(-n)--notes=-[show core notes (if present)]::section' ) ;; esac diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm index aa24a3fd6..ea9190de2 100644 --- a/Completion/Unix/Command/_rm +++ b/Completion/Unix/Command/_rm @@ -1,58 +1,70 @@ #compdef rm grm zf_rm -declare -a opts args +local variant +declare -a args opts=( -A '-*' ) args=( '(-f --force)'{-f,--force}'[ignore nonexistent files, never prompt]' '(-I --interactive)-i[prompt before every removal]' '(-r -R --recursive)'{-r,-R,--recursive}'[remove directories and their contents recursively]' '*:: :->file' ) -if _pick_variant gnu=gnu unix --help; then - opts+=(-S) - args+=( - '(-i --interactive)-I[prompt when removing many files]' - '(-i -I)--interactive=-[prompt under given condition (defaulting to always)]::when:((once\:"prompt when removing many files" - always\:"prompt before every removal"))' - '--one-file-system[stay within filesystems of files given as arguments]' - '( --preserve-root)--no-preserve-root[do not treat / specially]' - '(--no-preserve-root )--preserve-root[do not remove / (default)]' - '(-d --dir)'{-d,--dir}'[remove directories as well]' - '(-v --verbose)'{-v,--verbose}'[explain what is being done]' - '(- *)--help[display help message and exit]' - '(- *)--version[output version information and exit]' - ) -else - args=(${args:#*)--*\[*}) - case $OSTYPE in - darwin*|dragonfly*|freebsd*|netbsd*|openbsd*) - args+=( - '-d[remove directories as well]' - '-P[overwrite files before deleting them]' - '-v[explain what is being done]' - ) +_pick_variant -r variant -b zsh gnu=gnu $OSTYPE --help +case $variant; in + gnu) + opts=() + args+=( + '(-i --interactive)-I[prompt when removing many files]' + '(-i -I)--interactive=-[prompt under given condition (defaulting to always)]::when:((once\:"prompt when removing many files" + always\:"prompt before every removal"))' + '--one-file-system[stay within filesystems of files given as arguments]' + '( --preserve-root)--no-preserve-root[do not treat / specially]' + '(--no-preserve-root )--preserve-root[do not remove / (default)]' + '(-d --dir)'{-d,--dir}'[remove directories as well]' + '(-v --verbose)'{-v,--verbose}'[explain what is being done]' + '(- *)--help[display help message and exit]' + '(- *)--version[output version information and exit]' + ) + ;; + *) + args=(${args:#*)--*\[*}) + ;| + darwin*|dragonfly*|freebsd*|netbsd*|openbsd*|zsh) + args+=( + '-d[remove directories as well]' + ) ;| - darwin*|dragonfly*|freebsd*|netbsd*) - args+=( - '-W[attempt to undelete named files]' - ) + zsh) + args+=( + '-s[enable paranoid behavior]' + ) + ;; + darwin*|dragonfly*|freebsd*|netbsd*|openbsd*) + args+=( + '-P[overwrite files before deleting them]' + '-v[explain what is being done]' + ) ;| - dragonfly*|freebsd*|netbsd*) - args+=( - "-x[don't cross file systems when removing a hierarchy]" - ) + darwin*|dragonfly*|freebsd*|netbsd*) + args+=( + '-W[attempt to undelete named files]' + ) ;| - dragonfly*|freebsd*) - args+=( - '(-i)-I[prompt when removing many files]' - ) + dragonfly*|freebsd*|netbsd*) + args+=( + "-x[don't cross file systems when removing a hierarchy]" + ) + ;| + dragonfly*|freebsd*) + args+=( + '(-i)-I[prompt when removing many files]' + ) ;; - esac -fi +esac local curcontext=$curcontext state line ret=1 declare -A opt_args -_arguments -C -s $opts \ +_arguments -C -s -S $opts \ $args && ret=0 case $state in diff --git a/Completion/Unix/Command/_rmdir b/Completion/Unix/Command/_rmdir index 0f5e16912..501ffb1cc 100644 --- a/Completion/Unix/Command/_rmdir +++ b/Completion/Unix/Command/_rmdir @@ -1,23 +1,32 @@ -#compdef rmdir grmdir +#compdef rmdir grmdir zf_rmdir -local -a args +local variant +local -a args aopts=( -A '-*' ) args=( '(-p --parents)'{-p,--parents}'[remove each component of the specified paths]' ) -if _pick_variant gnu=GNU unix --version; then - args+=( - '--ignore-fail-on-non-empty[ignore failure if directory is non-empty]' - '(-v --verbose)'{-v,--verbose}'[be verbose]' - ) -else - args=(${args:#*\)--*}) - if [[ $OSTYPE == (dragonfly|freebsd)* ]]; then +_pick_variant -r variant -b zsh gnu=GNU $OSTYPE --version +case $variant; in + gnu) + aopts=() + args+=( + '--ignore-fail-on-non-empty[ignore failure if directory is non-empty]' + '(-v --verbose)'{-v,--verbose}'[be verbose]' + ) + ;; + zsh) + args=() + ;; + *) + args=(${args:#*\)--*}) + ;| + dragonfly*|freebsd*) args+=('-v[be verbose]') - fi -fi + ;; +esac -_arguments -s -S -A '-*' \ +_arguments -s -S $aopts \ $args \ - '*:directories:_directories' + '*: :_directories' diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync index c1404c908..56efd7b13 100644 --- a/Completion/Unix/Command/_rsync +++ b/Completion/Unix/Command/_rsync @@ -51,10 +51,11 @@ elif compset -P 1 '*::' || compset -P 1 'rsync://*/'; then fi remfiles=(${${(f)"$(_call_program files rsync $pat 2>/dev/null)"}:#([ ]|MOTD:)*}) + remfiles=( ${(M)remfiles:#*$'\t'*} ) remmodules=(${remfiles/[ ]##/:}) - _describe "remote modules" remmodules -S/ + _describe -V "remote modules" remmodules -S/ elif compset -P 'rsync://'; then _rsync_user_or_host / "$@" diff --git a/Completion/Unix/Command/_rubber b/Completion/Unix/Command/_rubber index f66540a9f..bd97470dd 100644 --- a/Completion/Unix/Command/_rubber +++ b/Completion/Unix/Command/_rubber @@ -59,7 +59,7 @@ case "$service" in '--boxes[report overfull and underfull boxes]' \ '--check[report errors or warnings default action]' \ '--deps[show the target file s dependencies]' \ - '--errors[show all errors that occured during compilation]' \ + '--errors[show all errors that occurred during compilation]' \ '--refs[show the list of undefined references]' \ '--warnings[show all LaTeX warnings]' \ ':LaTeX file:_files -g "*.(tex|dtx|lhs|w)(-.)"' diff --git a/Completion/Unix/Command/_ruby b/Completion/Unix/Command/_ruby index d69c378fc..3ed25a3f0 100644 --- a/Completion/Unix/Command/_ruby +++ b/Completion/Unix/Command/_ruby @@ -36,15 +36,24 @@ opts=( '-s[enable some switch parsing for switches after script name]' '-S[look for the script using PATH environment variable]' '-T-[turn on tainting checks]::taint level [1]:((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))' - '(-v --verbose)'{-v,--verbose}'[print version number, then turn on verbose mode]' + '(--verbose)-v[print version number, then turn on verbose mode]' + '(-v)--verbose[turn on verbose mode and disable script from stdin]' '-x-[strip off text before #!ruby line and perhaps cd to directory]:directory:_files -/' '(1 * -)--copyright[print the copyright]' - --{en,dis}'able=[enable or disable features]:feature:(gems did_you_mean rubyopt frozen_string_literal all)' + --{en,dis}'able=[enable or disable features]:feature:(gems did_you_mean rubyopt frozen_string_literal jit all)' \!--{en,dis}able-{gems,rubyopt,all} '--dump=[dump debug information]:information:_sequence compadd - insns yydebug parsetree parsetree_with_comment' --{external,internal}'-encoding=:charset:->charsets' '!'{-y,--yydebug} '!--dump=:target:(version copyright usage yydebug syntax parsetree parsetree_with_comment insns)' + '--jit[enable jit with default options]' + '--jit-warnings[enable printing JIT warnings]' + '--jit-debug[enable JIT debugging (very slow)]' + '--jit-wait[wait until JIT compilation is finished every time (for testing)]' + '--jit-save-temps[save JIT temporary files]' + '--jit-verbose=-[print JIT logs of level num or less to stderr]:maximum log level [0]' + '--jit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:number [1000]' + '--jit-min-calls=-[specify number of calls to trigger JIT]:calls [5]' ) irb=( @@ -70,7 +79,6 @@ irb=( erb=( "-P[don't evaluate lines which start with %]" - '-S[specify safe level for running script]:level:(1 2 3 4)' '-T[specify trim mode]:mode [0]:((0\:EOL\ remains 1\:EOL\ removed\ if\ line\ ends\ with\ %\> 2\:EOL\ removed\ if\ line\ starts\ with\ \<%\ and\ ends\ with\ %\> -\:EOL\ is\ removed\ if\ line\ ends\ with\ -%\>,\ leading\ whitespace\ removed\ after\ \<%-))' '(-d --debug)'{-d,--debug}'[set debugging flags (set $DEBUG to true)]' '-n[used with -x, prepends line number to output]' diff --git a/Completion/Unix/Command/_sablotron b/Completion/Unix/Command/_sablotron deleted file mode 100644 index 53e0bec92..000000000 --- a/Completion/Unix/Command/_sablotron +++ /dev/null @@ -1,52 +0,0 @@ -#compdef sabcmd - -local curcontext="$curcontext" state mode line expl ret=1 -typeset -A opt_args -local mopts='(-c -x -s -? -v --chain-xsl --batch-xml --batch-xsl --help --version)' - -_arguments -C \ - '(-b --base)'{-b,--base=}'[specify base URI]:URI' \ - '(-)--debug-options[show help on debug options]' \ - '(- *)'{-\?,--help}'[show help information]' \ - '(-L --log-file)'{-L,--log-file=}'[specify log file, turn on logging]:log file:_files' \ - '(-m --measure)'{-m,--measure}'[measure the processing time]' \ - '(- *)'{-v,--version}'[display version information]' \ - '--debugger[run the xslt debugger]' \ - $mopts{-c,--chain-xsl}'[single input file, multiple chained stylesheets]' \ - $mopts{-x,--batch-xml}'[single input file, multiple stylesheets]' \ - $mopts{-s,--batch-xsl}'[multiple input files, single stylesheet]' \ - '*: :->arguments' && ret=0 - -if [[ -n "$state" ]]; then - mode="${opt_args[(i)-c|--chain-xsl]:+chain}${opt_args[(i)-x|--batch-xml]:+batch-x}${opt_args[(i)-s|--batch-xsl]:+batch-s}" - [[ $mode = (chain|batch-[xs]) ]] || mode=default - _tags files assignments - while _tags; do - if _requested files; then - case $mode:${#words[1,CURRENT-1]:#(-*|*=*)}; in - default:1|chain:<3->|batch-x:2|batch-s:1) - _description files expl stylesheet - _files "$expl[@]" -g "*.xsl(-.)" && ret=0 - ;; - default:2|chain:1|batch-x:1|batch-s:2) - _description files expl 'input file' - _files "$expl[@]" && ret=0 - ;; - default:3|chain:2|batch-x:<3->|batch-s:<3->) - _description files expl 'output file' - _files "$expl[@]" && ret=0 - ;; - esac - fi - if _requested assignments; then - if [[ -prefix *= ]]; then - _message -e value value - else - _message -e parameter 'parameter name' && ret=0 - fi - fi - (( ret )) || break - done -fi - -return ret diff --git a/Completion/Unix/Command/_script b/Completion/Unix/Command/_script index 436c9661b..ac3bf3973 100644 --- a/Completion/Unix/Command/_script +++ b/Completion/Unix/Command/_script @@ -34,10 +34,6 @@ case $OSTYPE in darwin*|dragonfly*|netbsd*|freebsd*) args=( '-q[be quiet: suppress display of starting and ending lines]' - ) - ;| - darwin*|netbsd*|freebsd*) - args+=( '(-a -r -k)-d[suppress sleeps when playing back a session]' '(-a -r -k -t)-p[play back a recorded session]' '(-d -p)-r[record a session with input, output and timing data]' @@ -58,13 +54,13 @@ case $OSTYPE in ;| darwin*|dragonfly*|freebsd*) args+=( + '-F[send output to specified named pipe]:fifo:_files -g "*(p)"' '-t+[specify interval of data flushing]:interval (seconds)' '-k[log keys sent to the program as well as output]' '*:::arguments: _normal' ) ;| darwin*|freebsd*) - args+=( '-F[send output to specified named pipe]:fifo:_files -g "*(p)"' ) ;| *) args+=( diff --git a/Completion/Unix/Command/_seafile b/Completion/Unix/Command/_seafile new file mode 100644 index 000000000..bd36c0ac8 --- /dev/null +++ b/Completion/Unix/Command/_seafile @@ -0,0 +1,33 @@ +#compdef seaf-cli + +local -a commands + +commands=( + "init\:'initialize config directory'" + "start\:'start seafile daemon'" + "stop\:'stop seafile daemon'" + "list\:'list local libraries'" + "list-remote\:'list remote libraries'" + "status\:'show syncing status'" + "download\:'download a library from seafile server'" + "download-by-name\:'download a library defined by name from seafile server'" + "sync\:'sync a library with an existing foler'" + "desync\:'desync a library with seafile server'" + "create\:'create a library'" + "config\:'configure seafile client'" +) + +_arguments \ + ":command:(($commands))" \ + {-h,--help}'[show help]' \ + {-c,--confdir}'[specify config directory]:config directory:_files -/' \ + {-d,--dir,--folder}'[directory]:directory:_directories' \ + {-s,--server}'[URL for seafile server]':server \ + {-u,--username}'[username]':username \ + {-p,--password}'[password]':password \ + {-a,--tfa}'[two-factor authentication]':tfa \ + {-l,--library}'[library id]':library \ + {-e,--libpasswd}'[library password]':libpasswd \ + {-k,--key}'[configuration key]':key \ + {-v,--value}'[configuration value]':value \ + "*: :_files" diff --git a/Completion/Unix/Command/_sed b/Completion/Unix/Command/_sed index f03278364..73227901e 100644 --- a/Completion/Unix/Command/_sed +++ b/Completion/Unix/Command/_sed @@ -38,7 +38,7 @@ cmds_end=( 'n:read the next line of input into pattern space' 'N:append the next line of input to the pattern space' 'p:print the current pattern space' - 'P:print upto the first newline of the current pattern space' + 'P:print up to the first newline of the current pattern space' 'x:exchange hold and pattern spaces' '}:end group' ) @@ -66,6 +66,7 @@ elif _pick_variant -r variant gnu=GNU unix --version; then aopts=( ) (( $#words > 2 )) && ign='!' args+=( + '--debug[annotate program execution]' '--follow-symlinks[follow symlinks when processing in place]' '(-i --in-place -s --separate)'{-i-,--in-place=-}$inplace '(-c --copy)'{-c,--copy}'[copy instead of rename when shuffling files in in-place mode]' diff --git a/Completion/Unix/Command/_smartmontools b/Completion/Unix/Command/_smartmontools index c60322ee0..fe6496664 100644 --- a/Completion/Unix/Command/_smartmontools +++ b/Completion/Unix/Command/_smartmontools @@ -4,7 +4,7 @@ local context state state_descr line _arguments -s -S \ '(H -i --info)'{-i,--info}'[show identity information for device]' \ - '(H)--identify=-[show words and bits from indentification data]: : _values -S "" "words and bits" + '(H)--identify=-[show words and bits from identification data]: : _values -S "" "words and bits" "(n v)b[print all bits]" "w[print all words]" "(b v)n[suppress printing bits]" diff --git a/Completion/Unix/Command/_sqlite b/Completion/Unix/Command/_sqlite index 4604fb40c..0f03c61c1 100644 --- a/Completion/Unix/Command/_sqlite +++ b/Completion/Unix/Command/_sqlite @@ -46,9 +46,12 @@ options+=( $^dashes'-append[append the database to the end of the file]' $^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()]' '(-*batch -*interactive)'$^dashes'-batch[force batch I/O]' '(-*batch -*interactive)'$^dashes'-interactive[force interactive I/O]' $^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'-pagecache[specify size and number of slots for page cache memory]:size (bytes): :slots' @@ -69,6 +72,7 @@ if [[ -n $words[(r)-A*] ]]; then + '(commands)' \ '(-c --create)'{-c,--create}'[create a new archive]' '(-u --update)'{-u,--update}'[update or add files to an existing archive]' + '(-i --insert)'{-i,--insert}'[like -u but always add even if mtime unchanged]' '(-t --list)'{-t,--list}'[list contents of archive]' '(-x --extract)'{-x,--extract}'[extract files from archive]' ) diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index d1bd8f04b..0775590e6 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -3,13 +3,13 @@ # TODO: sshd, ssh-keysign _ssh () { - local curcontext="$curcontext" state line expl suf ret=1 - local args common common_transfer algopt tmp p1 file cmn cmds sdesc + local curcontext="$curcontext" state line expl suf arg ret=1 + local args sigargs common common_transfer algopt tmp p1 file cmn cmds sdesc tdesc typeset -A opt_args common=( - '(-6)-4[forces ssh to use IPv4 addresses only]' - '(-4)-6[forces ssh to use IPv6 addresses only]' + '(-6)-4[force ssh to use IPv4 addresses only]' + '(-4)-6[force ssh to use IPv6 addresses only]' '-C[compress data]' '-c+[select encryption cipher]:encryption cipher:->ciphers' '-F+[specify alternate config file]:config file:_files' @@ -17,6 +17,7 @@ _ssh () { '*-o+[specify extra options]:option string:->option' ) common_transfer=( + '-J+[connect via a jump host]: :->userhost' '-l+[limit used bandwidth]:bandwidth (Kbit/s)' '-P+[specify port on remote host]:port number on remote host' '-p[preserve modification times, access times and modes]' @@ -29,6 +30,7 @@ _ssh () { case "$service" in ssh) + (( $+words[(r)-[^-]#t*] )) && tdesc=' even if there is no controlling tty' _arguments -C -s \ '(-a)-A[enable forwarding of the authentication agent connection]' \ '(-A)-a[disable forwarding of authentication agent connection]' \ @@ -59,7 +61,7 @@ _ssh () { '-Q+[query parameters]:query option:((cipher\:"supported symmetric ciphers" cipher-auth\:"supported symmetric ciphers that support authenticated encryption" mac\:"supported message integrity codes" kex\:"key exchange algorithms" key\:"key types" key-cert\:"certificate key types" key-plain\:"non-certificate key types" protocol-version\:"supported SSH protocol versions" sig\:"supported signature algorithms" help\:"show supported queries"))' \ '-s[invoke subsystem]' \ '(-t)-T[disable pseudo-tty allocation]' \ - '(-T)-t[force pseudo-tty allocation]' \ + "(-T)*-t[force pseudo-tty allocation${tdesc}]" \ '-V[show version number]' \ '(-q)*-v[verbose mode (multiple increase verbosity, up to 3)]' \ '-W+[forward standard input and output to host]:stdinout forward:->hostport' \ @@ -75,6 +77,7 @@ _ssh () { _arguments -C -s \ '-3[copy through local host, not directly between the remote hosts]' \ '-B[batch mode (don'\''t ask for passphrases)]' \ + '-T[disable strict filename checking]' \ '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0 ;; ssh-add) @@ -95,6 +98,8 @@ _ssh () { '-M+[specify maximum number of signatures]:number' \ '-s+[add keys provided by the PKCS#11 shared library]:library:_files -g "*.(so|dylib)(|.<->)(-.)"' \ '-t+[set maximum lifetime for identity]:maximum lifetime (in seconds or time format):' \ + "-T[test usability of identity files' private keys]:*:public key file:_files -g '*.pub(-.)'" \ + '-v[verbose mode]' \ '-q[be quiet after a successful operation]' \ '-X[unlock the agent]' \ '-x[lock the agent with a password]' \ @@ -103,7 +108,7 @@ _ssh () { ;; ssh-agent) _arguments -s \ - '(-k)-a+[UNIX-domain socket to bind agent to]:UNIX-domain socket:_files' \ + '(-k)-a+[specify UNIX-domain socket to bind agent to]:UNIX-domain socket:_files' \ '(-k -s)-c[force csh-style shell]' \ '(-k)-d[debug mode]' \ '(-k)-D[foreground mode]' \ @@ -112,6 +117,7 @@ _ssh () { '(-k)-P[specify PKCS#11 shared library whitelist]:PKCS#11 library whitelist pattern' \ '(-k -c)-s[force sh-style shell]' \ '-t[set default maximum lifetime for identities]:maximum lifetime (in seconds or time format):' \ + '-v[verbose mode]' \ '*::command: _normal' return ;; @@ -120,53 +126,71 @@ _ssh () { (( CURRENT == 2 )) && p1='!' args=( '!-z:number' ) sdesc='certify keys with CA key' - (( $+words[(r)-s] )) && args=( '-z[specify serial number]:serial number' ) + (( $+words[(r)-I] )) && args=( '-z[specify serial number]:serial number' ) (( $+words[(r)-[ku]] )) && args=( '-z[specify version number]:version number' ) && sdesc='specify CA public key file' file=key - (( $+words[(r)-[HR]] )) && file=known_hosts + (( $+words[(r)-[FHR]] )) && file=known_hosts (( $+words[(r)-T] )) && file=input - if (( $+words[(r)-[kQ]] )); then + (( $+words[(r)-A] )) && file='prefix for host key' + if (( $+words[(r)-[kIQ]] )); then file=krl args+=( '*:file:_files' ) fi - cmds=( -p -i -e -y -c -l -B -D -H -R -r -G -T -s -L -A -k -Q ) # basic commands - cmn=( -b -P -N -C -m -v ) # options common to many basic commands (except -f which is common to most) - cms=( -E -q -t -g -M -S -a -J -j -K -W -I -h -n -O -V -u ) # options specific to one basic command + if (( arg = $words[(I)-Y*] )); then + [[ $words[arg] = -Y?* ]] || (( arg++ )) + case $words[arg] in + check*|verify) + sigargs+=( "$p1-s+[specify signature file]:signature file:-files" ) + ;| + sign) sigargs+=( '*:file:_files' ) ;; + verify) + args=() + sigargs+=( + '-I+[specify signer identity]:identity' + '-r+[specify revocation file]:revocation file:_files' + ) + ;; + esac + fi + cmds=( -p -i -e -y -c -l -B -D -F -H -R -r -G -T -s -L -A -k -Q -Y ) # basic commands + cmn=( -b -P -N -C -l -m -v ) # options common to many basic commands (except -f which is common to most) + cms=( -E -q -t -g -M -S -a -J -j -K -W -I -h -n -O -V -u -U ) # options specific to one basic command _arguments -s $args \ - "(${${(@)cmds:#-G}} -P -m ${${(@)cms:#-[MS]}})-b+[specify number of bits in key]:bits in key" \ - "$p1(${${(@)cmds:#-[pc]}} -b -C $cms)-P+[provide old passphrase]:old passphrase" \ - "(${${(@)cmds:#-p}} -m -v ${${(@)cms:#-[qt]}})-N+[provide new passphrase]:new passphrase" \ - "(${${(@)cmds:#-c}} -m -v $cms)-C+[provide new comment]:new comment" \ + "(${${(@)cmds:#-G}} -P ${${(@)cms:#-[MS]}})-b+[specify number of bits in key]:bits in key" \ + "$p1(${${(@)cmds:#-[pc]}} -b $cms)-P+[provide old passphrase]:old passphrase" \ + "(${${(@)cmds:#-p}} -v ${${(@)cms:#-[qt]}})-N+[provide new passphrase]:new passphrase" \ + "(${${(@)cmds:#-c}} -v $cms)-C+[provide new comment]:new comment" \ "(-D -G -M -S -I -h -n -O -V -A)-f+[$file file]:$file file:_files" \ - "$p1(${${(@)cmds:#-[ie]}})-m+[specify conversion format]:format:(PEM PKCS7 RFC4716)" \ + "$p1(${${(@)cmds:#-[FE]}} ${${(@)cmn:#-v}} ${${(@)cms:#-E}})-l[show fingerprint of key file]" \ + "$p1(${${(@)cmds:#-[iep]}} $cms)-m+[specify conversion format]:format [RFC4716]:(PEM PKCS8 RFC4716)" \ "(${${(@)cmds:#-[lGT]}} ${${(@)cmn:#-[bv]}} -f)*-v[verbose mode]" \ - '(commands)' \ - "(-b -P -C -v)-p[change passphrase of private key file]" \ - '(-b -P -N -C -v)-i[import key to OpenSSH format]' \ - '(-b -P -N -C -v)-e[export key to SECSH file format]' \ + "(-b -l -C -v)-p[change passphrase of private key file]" \ + '(-b -l -P -N -C -v)-i[import key to OpenSSH format]' \ + '(-b -l -P -N -C -v)-e[export key to SECSH file format]' \ "($cmn)-y[get public key from private key]" \ - '(-b -N -m -v)-c[change comment in private and public key files]' \ + '(-b -l -N -m -v)-c[change comment in private and public key files]' \ "($cmn)-B[show the bubblebabble digest of key]" \ "(-)-D+[download key stored in smartcard reader]:reader" \ + "(${${(@)cmn:#-[lv]}})-F+[search for host in known_hosts file]:host:_ssh_hosts" \ "($cmn)-H[hash names in known_hosts file]" \ "($cmn)-R+[remove host from known_hosts file]:host:_ssh_hosts" \ "($cmn)-L[print the contents of a certificate]" \ - "(-)-A[generate host keys for all key types]" \ + "($cmn -l)-A[generate host keys for all key types]" \ "($cmn)-Q[test whether keys have been revoked in a KRL]" \ - finger \ - "($cmn)-l[show fingerprint of key file]" \ "$p1($cmn)$algopt" \ - create \ - '(-P -m)-q[silence ssh-keygen]' \ - "(-P -m)-t+[specify the type of the key to create]:key type:(rsa dsa ecdsa ed25519)" \ + '(-P -l)-q[silence ssh-keygen]' \ + "(-P -l)-t+[specify the type of the key to create]:key type:(rsa dsa ecdsa ed25519)" \ - dns \ "($cmn)-r[print DNS resource record]:hostname:_hosts" \ "$p1($cmn)-g[use generic DNS format]" \ - primes \ - "(-P -N -C -m -f)-G[generate candidates for DH-GEX moduli]" \ - "$p1(-P -N -C -m -f)-M+[specify amount of memory to use for generating DH-GEX moduli]:memory (MB)" \ - "$p1(-P -N -C -m -f)-S+[specify start point]:start point (hex)" \ + "(-P -N -C -l -m -f)-G+[generate candidates for DH-GEX moduli]:output file:_files" \ + "$p1(-P -N -C -l -m -f)-M+[specify amount of memory to use for generating DH-GEX moduli]:memory (MB)" \ + "$p1(-P -N -C -l -m -f)-S+[specify start point]:start point (hex)" \ - screen \ "(${${(@)cmn:#-v}})-T+[screen candidates for DH-GEX moduli]:output file:_files" \ "${p1}(${${(@)cmn:#-v}})-a+[specify number of rounds]:rounds" \ @@ -176,26 +200,35 @@ _ssh () { "${p1}(${${(@)cmn:#-v}})-W[specify desired generator]:generator" \ - certify \ "($cmn)-s[$sdesc]:CA key:_files" \ - "$p1($cmn -f -u)-I+[specify key identifier to include in certificate]:key id" \ - "$p1($cmn -f -u)-h[generate host certificate instead of a user certificate]" \ - "$p1($cmn -f -u -D)-U[indicate that CA key is held by ssh-agent]" \ - "$p1($cmn -f -u -U)-D+[indicate the CA key is stored in a PKCS#11 token]:PKCS11 shared library:_files -g '*.(so|dylib)(|.<->)(-.)'" \ - "$p1($cmn -f -u)-n+[specify user/host principal names to include in certificate]:principals" \ - "$p1($cmn -f -u)*-O+[specify a certificate option]: : _values 'option' + "$p1($cmn -f -k -u)-I+[specify key identifier to include in certificate]:key id" \ + "$p1($cmn -f -k -u)-h[generate host certificate instead of a user certificate]" \ + "$p1($cmn -f -k -u -D)-U[indicate that CA key is held by ssh-agent]" \ + "$p1($cmn -f -k -u -U)-D+[indicate the CA key is stored in a PKCS#11 token]:PKCS11 shared library:_files -g '*.(so|dylib)(|.<->)(-.)'" \ + "$p1($cmn -f -k -u)-n+[specify user/host principal names to include in certificate]:principals" \ + "$p1($cmn -f -k -u)*-O+[specify a certificate option]: : _values 'option' clear critical\:name extension\:name force-command\:command\:_cmdstring no-agent-forwarding no-port-forwarding no-pty no-user-rc no-x11-forwarding permit-agent-forwarding permit-port-forwarding permit-pty permit-user-rc permit-x11-forwarding source-address\:source\ address" \ "$p1($cmn -f -u)-V+[specify certificate validity interval]:interval" \ - "($cmn -I -h -n -O -V)-k[generate a KRL file]" \ - "$p1($cmn -I -h -n -O -V)-u[update a KRL]" + "($cmn -I -h -n -D -O -U -V)-k[generate a KRL file]" \ + "$p1($cmn -I -h -n -D -O -U -V)-u[update a KRL]" \ + - signature \ + "($cmn)-Y+[signature action]:action:(( + sign\:sign\ a\ file\ using\ SSH\ key + verify\:verify\ a\ signature\ generated\ using\ the\ sign\ option + check-novalidate\:check\ signature\ structure + ))" \ + "$p1-n+[specify namespace]:namespace" \ + $sigargs return ;; ssh-keyscan) _arguments \ - '(-6)-4[forces ssh to use IPv4 addresses only]' \ - '(-4)-6[forces ssh to use IPv6 addresses only]' \ + '(-6)-4[force ssh to use IPv4 addresses only]' \ + '(-4)-6[force ssh to use IPv6 addresses only]' \ '-c[request certificates from target hosts instead of plain keys]' \ + '-D[print keys found as SSHFP DNS records]' \ '*-f+[read hosts from file, one per line]:file:_files' \ '-H[hash all hostnames and addresses in the output]' \ '-p+[specify port on remote host]:port number on remote host' \ @@ -212,7 +245,7 @@ _ssh () { '-D+[connect directly to a local sftp server]:sftp server path' \ '-f[request that files be flushed immediately after transfer]' \ '-R+[specify number of outstanding requests]:number of requests [64]' \ - '-s+[SSH2 subsystem or path to sftp server on the remote host]:subsystem/path' \ + '-s+[specify SSH2 subsystem or path to sftp server on the remote host]:subsystem/path' \ '1:file:->rfile' '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0 ;; ssh-copy-id) @@ -523,6 +556,7 @@ _ssh () { SendEnv \ ServerAliveCountMax \ ServerAliveInterval \ + SetEnv \ StreamLocalBindMask \ StreamLocalBindUnlink \ StrictHostKeyChecking \ diff --git a/Completion/Unix/Command/_stat b/Completion/Unix/Command/_stat index 2e84d6bf0..03b4552de 100644 --- a/Completion/Unix/Command/_stat +++ b/Completion/Unix/Command/_stat @@ -6,20 +6,14 @@ # Dragonfly by parsing the output of `lsof -N`, but it's not available by # default — is there another way? -local expl variant precmd ret=1 +local expl variant ret=1 local -a context line state state_descr args aopts=( -A '-*' ) local -A opt_args -if [[ $service == zstat ]] || [[ $precommands[-1] == builtin ]]; then - variant=zsh -else - [[ $precommands[-1] == command ]] && precmd=command - _pick_variant -c "${precmd:+$precmd }${words[1]}" -r variant \ - gnu='Free Soft' zsh='no files given' unix --version -fi +_pick_variant -r variant -b zsh gnu='Free Soft' $OSTYPE --version -case $OSTYPE-$variant in - *-zsh) +case $variant in + zsh) args=( "(-H)-A[assign the results to array, don't print]:array variable:_parameters -g '*array*'" - set1 @@ -43,7 +37,7 @@ case $OSTYPE-$variant in '-l[list stat types]' ) ;; - *-gnu) + gnu) aopts=( ) args=( '*: :_files' diff --git a/Completion/Unix/Command/_stdbuf b/Completion/Unix/Command/_stdbuf index e45b5a5cd..a18938ee1 100644 --- a/Completion/Unix/Command/_stdbuf +++ b/Completion/Unix/Command/_stdbuf @@ -4,7 +4,7 @@ local -a short long buf args local i opt gnu=0 short=( -e -i -o ) -long=( --error --output --input ) +long=( --error --input --output ) buf=( err in out ) opt='[set initial buffering for std${buf[i]}]:mode or size:((0\:unbuffered L\:line\ buffered' diff --git a/Completion/Unix/Command/_stow b/Completion/Unix/Command/_stow new file mode 100644 index 000000000..6a315fc57 --- /dev/null +++ b/Completion/Unix/Command/_stow @@ -0,0 +1,87 @@ +#compdef stow chkstow + +# +# A zsh completion script for GNU stow (https://www.gnu.org/software/stow/) +# + +(( $+functions[__stow_packages] )) || +__stow_packages() { + local stow_dir=${(Q)1} + local -a stow_pkg_list=( $stow_dir/*(-/N:t) ) + + if [[ ${#stow_pkg_list} -gt 0 ]]; then + _values -C "package from $stow_dir" ${${stow_pkg_list//\\/\\\\}//:/\\:} + else + _message "no package found in $stow_dir" + fi +} + +case $service in + stow) + local state line curcontext="$curcontext" ret=1 + typeset -A opt_args + # Others local variables + local stow_dir arguments + + arguments=( + '(- *)'{--help,-h}'[show help]' + '(- *)'{--version,-V}'[show version number]' + '(-d --dir)'{-d+,--dir=}'[set the stow dir (default is current dir)]:stow dir [$PWD]:_files -/' + '(-t --target)'{-t+,--target=}'[set the target dir (default is parent of stow dir)]:target dir [../$PWD]:_files -/' + # Several distinct actions can be specified in a single invocation + # of the stow command (stow/unstow/restow). However, neither the + # stow command nor this script will prevent you from using + # different actions on the same package. + '*'{-S,--stow}'[stow the package names that follow]: :->stow_package' + '*'{-D,--delete}'[unstow the package names that follow]: :->stow_package' + '*'{-R,--restow}'[restow (unstow and stow again) the package names that follow]: :->stow_package' + '--adopt[adopt already existing plain file]' + '--ignore=[ignore files ending with this perl regex]:regexp:' + "--defer=[don't stow files beginning with this perl regex]:regexp:" + '--override=[force stowing files beginning with this perl regex]:regexp:' + '--no-folding[disable any further tree folding or tree refolding]' + '--dotfiles[enable special handling for dotfiles]' + '(-p --compat)'{-p,--compat}'[use legacy algorithm for unstowing]' + '(-n -no --simulate)'{-n,--no,--simulate}'[do not actually make any filesystem changes]' + '*-v[increase verbosity]' + '*--verbose=-[increase verbosity]::level:(0 1 2 3 4 5)' + '*:stow package:->stow_package' + ) + + _arguments -s -C $arguments && ret=0 + + case $state in + (stow_package) + if (( $+opt_args[-d] )) ; then + stow_dir="$opt_args[-d]" + elif (( $+opt_args[--dir] )) ; then + stow_dir="$opt_args[--dir]" + elif [[ ${(t)STOW_DIR} == *export* ]] && [[ -n "$STOW_DIR" ]]; then + # if not provided from the command line, for the stow command, the stow + # directory is assumed to be the value of the "STOW_DIR" environment + # variable... + stow_dir="$STOW_DIR" + else + # ...if unset, the stow directory is assumed to be the current directory + stow_dir="$PWD" + fi + + __stow_packages "$stow_dir" && ret=0 + + ;; + esac + + return ret + ;; + chkstow) + local arguments + arguments=( + '(-t --target)'{-t+,--target=}'[set the target directory (default is /usr/local/)]:target dir:_files -/' + '(-b --badlinks)'{-b,--badlinks}'[report symlinks that point to non-existent files (default mode)]' + '(-a --aliens)'{-a,--aliens}'[report non-symlinks in the target directory]' + '(-l --list)'{-l,--list}'[list packages in the target directory]' + ) + _arguments $arguments + ;; +esac + diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index a066b0728..a1e9109de 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -11,11 +11,15 @@ _svn () { relative-url "the repository-relative URL" repos-root-url "the repository root URL" repos-uuid "the repository UUID" + repos-size "the size of TARGET in the repository (for files only)" revision "the revision of TARGET" last-changed-revision "the most recent revision in which TARGET was changed" last-changed-date "the date of the last-changed revision" last-changed-author "the author of the last-changed revision" wc-root "the working copy root path" + schedule "'normal', 'add', 'delete', 'replace'" + depth "'infinity', 'immediates', 'files', 'empty', 'exclude'" + changelist "the changelist this file was added to, if any" ) local update_policy @@ -30,11 +34,24 @@ _svn () { '1: :->cmds' \ '*:: :->args' && ret=0 + local _svn_help_takes_verbose + if _cache_invalid svn-help-takes-verbose || ! _retrieve_cache svn-help-takes-verbose; then + [[ $(_call_program svn-help-v svn help help) == *--verbose* ]] + _svn_help_takes_verbose=$(( ! $? )) + _store_cache svn-help-takes-verbose _svn_help_takes_verbose + fi + if (( _svn_help_takes_verbose )); then + readonly dash_v="-v" + else + readonly dash_v + fi + unset _svn_help_takes_verbose + if [[ -n $state ]] && (( ! $+_svn_cmds )); then typeset -gHA _svn_cmds if _cache_invalid svn-cmds || ! _retrieve_cache svn-cmds; then _svn_cmds=( - ${=${(f)${${"$(_call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z-]##)[[:space:]]#(\([a-z, ?-]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} + ${=${(f)${${"$(_call_program commands svn help $dash_v)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z-]##)[[:space:]]#(\([a-z, ?-]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} ) if (( $? == 0 )); then _store_cache svn-cmds _svn_cmds @@ -60,14 +77,14 @@ _svn () { if _cache_invalid svn-${cmd}-usage || \ ! _retrieve_cache svn-${cmd}-usage; then - usage=${${(M)${(f)"$(_call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] } + 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 || \ ! _retrieve_cache svn-${cmd}-args; then args=( - ${=${${${(M)${(f)"$(_call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]} + ${=${${${(M)${(f)"$(_call_program options svn help $dash_v -- $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]} ) while (( idx=$args[(I)*--accept:arg:] )); do args[idx]=( --accept'=:automatic conflict resolution action:((working\:working base\:base recommended\:recommended '"`for i j in p postpone mc mine-conflict tc theirs-conflict mf mine-full tf theirs-full e edit l launch; do print -rn $i\\\\:$j $j\\\\:$j ""; done `"'))' ) @@ -106,7 +123,19 @@ _svn () { case $cmd in; (add) args+=( - '*:file:_files -g "*(^e:_svn_controlled:)"' + '*:file:_files -g "*(e:_svn_uncontrolled:)"' + ) + ;; + (auth) + args+=( + '*:auth pattern: ' + ) + ;; + (changelist) + args[(r)--remove]='(1)--remove' + args+=( + '(--remove)1:changelist name:_svn_changelists' + '*:file:_files -g "*(e:_svn_controlled:)"' ) ;; (commit) @@ -145,6 +174,12 @@ _svn () { (mergeinfo) args[(r)--show-revs=:arg:]=( '--show-revs=:revisions:(merged eligible)' ) ;; + (patch) + args+=( + '1:patch file:_files' + '2::working copy to patch:_files' + ) + ;; (propget|propedit|propdel) args+=( '1:property name:_svn_props' @@ -159,7 +194,7 @@ _svn () { '*:path or url: _alternative "files:file:_files" "urls:URL:_svn_urls"' ) ;; - (resolved) + (resolve|resolved) args+=( '*:file:_files -g "*(e:_svn_conflicts:)"' ) @@ -169,9 +204,9 @@ _svn () { '*:file:_files -g "(.svn|*)(/e:_svn_deletedfiles:,e:_svn_status:)"' ) ;; - (unshelve) - args+=( '1:shelf name:compadd - ${${(f)"$(_call_program shelves svn unshelve -q --list)"}%% *}' ) - ;; + (x-unshelve) + args+=( '1:shelf name:compadd - ${(f)"$(_call_program shelves svn x-shelves --quiet)"}' '2::shelf version' ) + ;; (*) case $usage in *(SRC|DST|TARGET|URL*PATH)*) @@ -310,12 +345,27 @@ _svnadmin () { (( $+functions[_svn_controlled] )) || _svn_controlled() { - [[ -f ${(M)REPLY##*/}.svn/text-base/${REPLY##*/}.svn-base ]] + # For svn<=1.6, this was implemented as: + # [[ -f ${(M)REPLY##*/}.svn/text-base/${REPLY##*/}.svn-base ]] + # However, because that implementation returns false for all files on svn>=1.7, and + # because 1.6 has been deprecated for 8 years and EOL for 6 years, we opt to DTRT + # for >=1.7. Therefore: + + # TODO: Reimplement this function and _svn_uncontrolled for svn>=1.7. + # (Use 'svn st' or 'svn info', not 'svn ls') + return 0 +} + + +(( $+functions[_svn_uncontrolled] )) || +_svn_uncontrolled() { + # TODO: See comments in _svn_controlled + return 0 } (( $+functions[_svn_conflicts] )) || _svn_conflicts() { - [ -n $REPLY.(mine|r<->)(N[1]) ] + () { (( $# > 0 )) } $REPLY.(mine|r<->)(NY1) } (( $+functions[_svn_deletedfiles] )) || diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo index 10fa2e82e..41e32cbae 100644 --- a/Completion/Unix/Command/_sudo +++ b/Completion/Unix/Command/_sudo @@ -23,9 +23,9 @@ args=( \*{-l,--list}"[list user's privileges or check a specific command]" '(-n --non-interactive)'{-n,--non-interactive}'[non-interactive mode, no prompts are used]' '(-p --prompt)'{-p+,--prompt=}'[use the specified password prompt]:prompt' - '(-r --role)'{-r+,--role=}'[create SELinux security context with specified role]:role' + '(-r --role)'{-r+,--role=}'[create SELinux security context with specified role]: :_selinux_roles' '(-S --stdin)'{-S,--stdin}'[read password from standard input]' - '(-t --type)'{-t+,--type=}'[create SELinux security context with specified type]:type' + '(-t --type)'{-t+,--type=}'[create SELinux security context with specified type]: :_selinux_types' '(-T --command-timeout)'{-T+,--command-timeout=}'[terminate command after specified time limit]:timeout' '(-U --other-user)'{-U+,--other-user=}'[in list mode, display privileges for user]:user:_users' '(-u --user)'{-u+,--user=}'[run command (or edit file) as specified user]:user:_users' diff --git a/Completion/Unix/Command/_surfraw b/Completion/Unix/Command/_surfraw index d9df4170d..f945f1ca9 100644 --- a/Completion/Unix/Command/_surfraw +++ b/Completion/Unix/Command/_surfraw @@ -54,7 +54,7 @@ case $state in cddb) _arguments $args \ '-artists[search artists]' \ - '-albums[search albulms]' \ + '-albums[search albums]' \ '-songs[search songs]' \ '-all[search all artists, albums and songs]' && ret=0 ;; diff --git a/Completion/Unix/Command/_swaks b/Completion/Unix/Command/_swaks index a0ffb53ad..0e92221bd 100644 --- a/Completion/Unix/Command/_swaks +++ b/Completion/Unix/Command/_swaks @@ -1,5 +1,8 @@ #compdef swaks +local ign + +(( $#words > 2 )) && ign='!' _arguments \ '(-s --server -p --port)'{-s+,--server=}'[target host[:port\]]:host[\:port]:_hosts' \ '(-p --port)'{-p+,--port=}'[target port number]:port number:(25 465 587)' \ @@ -27,14 +30,27 @@ _arguments \ ESMTPS\:EHLO\ STARTTLS\ 25 ESMTPSA\:EHLO\ STARTTLS\ 25\ authenticated ))' \ - '-tls[TLS required]' \ - '(-tlsos --tls-optional-strict)'{-tlsos,--tls-optional-strict}'[TLS iff offered by target]' \ + '(-tls -tlsos --tls-optional-strict)-tls[TLS required]' \ + '(-tls -tlsos --tls-optional-strict)'{-tlsos,--tls-optional-strict}'[TLS iff offered by target]' \ '(-tlsc --tls-on-connect)'{-tlsc,--tls-on-connect}'[TLS on connect (port 465)]' \ '(-tlsp --tls-protocol)'{-tlsp,--tls-protocol=}':TLS protocol:(sslv2 sslv3 tlsv1 tlsv1_1 tlsv1_2)' \ '-tls-cipher:OpenSSL cipher string: ' \ '--tls-verify[verify TLS certificates]' \ '--tls-ca-path=:OpenSSL CAfile or CAdir:_files' \ '--tls-get-peer-cert=-:file to write (omit for STDOUT)' \ + '(-a --auth -ao --auth-optional -aos --auth-optional-strict)'{-a+,--auth=}'[use authentication, failing if no common auth-types found]::auth type:_sequence compadd - LOGIN PLAIN CRAM-MD5 DIGEST-MD5 CRAM-SHA1 NTLM SPA MSN' \ + '(-a --auth -ao --auth-optional -aos --auth-optional-strict)'{-ao,--auth-optional=}'[use authentication if common auth-types found]::auth type:_sequence compadd - LOGIN PLAIN CRAM-MD5 DIGEST-MD5 CRAM-SHA1 NTLM SPA MSN' \ + '(-a --auth -ao --auth-optional -aos --auth-optional-strict)'{-aos,--auth-optional-strict=}'[use authentication]::auth type:_sequence compadd - LOGIN PLAIN CRAM-MD5 DIGEST-MD5 CRAM-SHA1 NTLM SPA MSN' \ + '(-ap --auth-password)'{-ap,--auth-password=}'[provide the password to be used for authentication]::password' \ + \*{-ae,--auth-extra=}'[add extra information to authentication process]: :_values keywords + {realm,domain,dmd5-{serv-type,host,serv-name}}\:value' \ + \*{-am,--auth-map=}'[map alternate names for authentication types]:alias=type,...' \ + '(-apt --auth-plaintext)'{-apt,--auth-plaintext}'[show auth strings in plaintext when printing on screen]' \ + '(-ahp --auth-hide-password)'{-ahp,--auth-hide-password}'[replace passwords with dummy string when printing to terminal]' \ '(-d --data)'{-d+,--data=}'[specify DATA payload]:filename (or string with tokens):_files' \ '*'{-ah,--add-header=}'[add headers]:<Header>\: Value' \ - '*'{-h,--header=}'[replace headers]:<Header>\: Value' + '*'{-h,--header=}'[replace headers]:<Header>\: Value' \ + "${ign}(-)--support[display capabilities and exit]" \ + "--dump[display results of option processing but send no mail]" \ + "${ign}(-)--help[display usage information]" \ + "${ign}(-)--version[display version information]" diff --git a/Completion/Unix/Command/_sysctl b/Completion/Unix/Command/_sysctl index 2bdcc71f5..0416ca05e 100644 --- a/Completion/Unix/Command/_sysctl +++ b/Completion/Unix/Command/_sysctl @@ -85,7 +85,7 @@ case $OSTYPE in '(-A -a -M)-q[silently ignore nonexistent variables]' \ '(-M -x)-r[binary output]' \ '(-a -A -d -e -f -M -r)-w[write mode]' \ - '(-d -M -r)*-x[hex output. -xx for hexdupm-like output]' \ + '(-d -M -r)*-x[hex output. -xx for hexdump-like output]' \ '*:sysctl variable:_multi_parts ${words[(r)-w]:+-S=} -i . sysctlvars' ;; *) diff --git a/Completion/Unix/Command/_tac b/Completion/Unix/Command/_tac index 7a15bffff..083fce91f 100644 --- a/Completion/Unix/Command/_tac +++ b/Completion/Unix/Command/_tac @@ -1,11 +1,7 @@ #compdef tac gtac -local variant - -_pick_variant -r variant gnu='Free Soft' unix --version - # NetBSD (at least) has its own bare-bones version of this tool -[[ $variant == gnu ]] || { +_pick_variant gnu='Free Soft' unix --version || { _default return } diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar index 727fbd6b5..f9901c0c9 100644 --- a/Completion/Unix/Command/_tar +++ b/Completion/Unix/Command/_tar @@ -99,7 +99,7 @@ if [[ "$PREFIX" = --* ]]; then # ...long options after `--'. - _arguments -- -l '--owner=*:user:_users' \ + _arguments '-f+:' '-C+:' '*: : true' -- -l '--owner=*:user:_users' \ '--group=*:group:_groups' \ '--atime-preserve*::method:(replace system)' \ '--*-script=NAME:script file:_files' \ diff --git a/Completion/Unix/Command/_tcpdump b/Completion/Unix/Command/_tcpdump index 4b9950fa5..9aad84d7b 100644 --- a/Completion/Unix/Command/_tcpdump +++ b/Completion/Unix/Command/_tcpdump @@ -134,6 +134,7 @@ if [[ $OSTYPE = openbsd* ]]; then - capture ${(R)args:#(|\*)(|\(*\))--*} # removes any long-options '(-n)-a[attempt to convert network and broadcast addresses to names]' + '-B+[specify drop action to be used when filter expression matches a packet]:drop action:(pass capture drop)' '-D[select packet flowing in specified direction]:direction:(in out)' '-I[print the interface on each dump line]' '-o[print a guess of the possible operating system(s)]' diff --git a/Completion/Unix/Command/_tiff b/Completion/Unix/Command/_tiff index 128aeb0c0..da55b541c 100644 --- a/Completion/Unix/Command/_tiff +++ b/Completion/Unix/Command/_tiff @@ -249,7 +249,7 @@ if [[ -n "$state" ]]; then _message -e values "compression quality (0-100), or \`r' (output RGB)" ret=0 ;; - lzw|lzma|zip) + lzw|lzma|zip|zstd|webp) _values 'LZW and deflate option' \ '1[without differencing]' \ '2[with differencing]' && ret=0 @@ -260,7 +260,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 jpeg g3 && ret=0 + compadd "$expl[@]" -qS: - lzw zip lzma zstd webp jpeg g3 && ret=0 done (( ret )) || return 0 done diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux index 0e8fe2223..b564c955d 100644 --- a/Completion/Unix/Command/_tmux +++ b/Completion/Unix/Command/_tmux @@ -43,7 +43,6 @@ # # TODO: # -# - Implement __tmux-format # - Implement __tmux-style (possibly using existing helpers like # __tmux-attributes and __tmux-colours) # - in _tmux-list-panes, use __tmux-windows or __tmux-sessions @@ -96,6 +95,7 @@ _tmux_aliasmap=( prevl previous-layout renamew rename-window resizep resize-pane + resizew resize-window respawnp respawn-pane respawnw respawn-window rotatew rotate-window @@ -187,7 +187,7 @@ _tmux-break-pane() { [[ -n ${tmux_describe} ]] && print "break a pane from an existing into a new window" && return _arguments -s \ "-d[don't make the new window become the active one]" \ - '-F+[specify output format]:format:__tmux-format' \ + '-F+[specify output format]:format:__tmux-formats' \ '-P[print information of new window after it has been created]' \ '-n+[specify window name]:name' \ '-s+[specify source pane]:pane:__tmux-panes' \ @@ -301,17 +301,20 @@ _tmux-detach-client() { _tmux-display-message() { [[ -n ${tmux_describe} ]] && print "display a message in the status line" && return - _arguments -s -S \ + _arguments -s -S -A "-*" \ + '(-p -F :)-a[list the format variables and their values]' \ '-c+[specify target client]:client:__tmux-clients' \ - '-p[print message to stdout]' \ + '(-a)-p[print message to stdout]' \ '-t+[specify target pane]:pane:__tmux-panes' \ - '-F+[specify output format]:format:__tmux-formats' \ + '(-a)-F+[specify output format]:format:__tmux-formats' \ + '(-a)-v[prints verbose logging as the format is parsed]' \ ':message' } _tmux-display-panes() { [[ -n ${tmux_describe} ]] && print "display an indicator for each visible pane" && return _arguments -S \ + "-b[don't block other commands until indicator is closed]" \ '-d+[time to show indicator for]:duration (ms)' \ '-t+[specify target client]:client:__tmux-clients' \ '*:::command:= _tmux' @@ -324,6 +327,7 @@ _tmux-find-window() { '-N[match window name]' \ '-T[match window title]' \ '-t+[specify target window]:window:__tmux-windows' \ + '-Z[zoom the pane]' \ ':window search pattern' } @@ -584,10 +588,17 @@ _tmux-previous-window() { _tmux-refresh-client() { [[ -n ${tmux_describe} ]] && print "refresh a client" && return - _arguments -s \ + _arguments -s -S -A "-*" \ + '-C+[set the width and height of a control client]:width,height' \ + '-c[reset so that the position follows the cursor]' \ + '-D[move visible portion of window down]' \ + '-L[move visible portion of window left]' \ + '-l[request clipboard from the client and store it in a new paste buf using xterm(1) escape sequence]' \ "-S[only update the client's status bar]" \ '-t+[specify target client]:client:__tmux-clients' \ - '-C+:size' + '-R[move visible portion of window right]' \ + '-U[move visible portion of window up]' \ + ': :_guard "[0-9]#" "adjustment"' } _tmux-rename-session() { @@ -616,7 +627,22 @@ _tmux-resize-pane() { '-x+[specify width]:width' \ '-y+[specify height]:height' \ '-Z[toggle zoom of pane]' \ - ':adjustment' + ': :_guard "[0-9]#" "adjustment"' +} + +_tmux-resize-window() { + [[ -n ${tmux_describe} ]] && print "resize a window" && return + _arguments -s -A "-*" -S : \ + '-A[set size of largest session containing the window]' \ + '-a[set size of smallest session containing the window]' \ + '-D[resize downward]' \ + '-L[resize to the left]' \ + '-R[resize to the right]' \ + '-U[resize upward]' \ + '-t+[specify target pane]:pane:__tmux-windows' \ + '-x+[specify width]:width' \ + '-y+[specify height]:height' \ + ': :_guard "[0-9]#" "adjustment"' } _tmux-respawn-pane() { @@ -1071,7 +1097,7 @@ function __tmux-environment-variables() { if _describe -t parameters $msg descriptions; then : elif [[ -n $hint ]]; then - _message $msg + _message -e $msg fi ;; (value) @@ -1079,10 +1105,10 @@ function __tmux-environment-variables() { # TODO: this if/else is because '_description -x' prints the "No matches" error in addition to the message. if [[ -n $var_and_val ]]; then local -a expl - _description -x parameter-values expl "Value for ${words[-2]}" + _description -x parameter-values expl "value for ${words[-2]}" compadd "$expl[@]" - ${var_and_val#*=} else - _message "Value for ${words[-2]}" + _message -e "value for ${words[-2]}" fi ;; (*) @@ -1092,7 +1118,180 @@ function __tmux-environment-variables() { } __tmux-formats() { - _message 'not implemented yet' + local hash='#' open='{' close='}' paren='(' quest='?' + local tmux_variables expl + compquote hash open close paren quest + compset -p ${#PREFIX%$hash*} + if compset -P "${(q)hash}${open}"; then + if compset -P "${(q)quest}"; then + close=, + elif ! compset -P "([bdt]|s/[^/]#/[^/]#/|=(-|)<->):"; then + _describe -t operators operator '( + \?:conditional + \=:length\ limit + )' -S '' -- '( + m:fnmatch\ comparison + t:convert\ time\ to\ string + b:basename + c:search\ for\ fnmatch\ pattern\ in\ pane\ content + d:dirname + \==:comparison + \!=:comparison + )' -S : -- '( + s:substitution + )' -S / -- '( + \|\|:either\ of\ two\ conditions + \&\&:both\ of\ two\ conditions + )' -S , + fi + tmux_variables=( + 'alternate_on:if pane is in alternate screen' + 'alternate_saved_x:saved cursor X in alternate screen' + 'alternate_saved_y:saved cursor Y in alternate screen' + 'buffer_created:time buffer created' + 'buffer_name:name of buffer' + 'buffer_sample:sample of start of buffer' + 'buffer_size:size of the specified buffer in bytes' + 'client_activity:time client last had activity' + 'client_created:time client created' + 'client_control_mode:1 if client is in control mode' + 'client_discarded:bytes discarded when client behind' + 'client_height:height of client' + 'client_key_table:current key table' + "client_last_session:name of the client's last session" + 'client_name:name of client' + 'client_pid:PID of client process' + 'client_prefix:1 if prefix key has been pressed' + 'client_readonly:1 if client is readonly' + "client_session:name of the client's session" + 'client_termname:terminal name of client' + 'client_termtype:terminal type of client' + 'client_tty:pseudo terminal of client' + 'client_utf8:1 if client supports utf8' + 'client_width:width of client' + 'client_written:bytes written to client' + 'command:name of command in use, if any' + 'command_list_name:command name if listing commands' + 'command_list_alias:command alias if listing commands' + 'command_list_usage:command usage if listing commands' + 'cursor_flag:pane cursor flag' + 'cursor_character:character at cursor in pane' + 'cursor_x:cursor X position in pane' + 'cursor_y:cursor Y position in pane' + 'history_bytes:number of bytes in window history' + 'history_limit:maximum window history lines' + 'history_size:size of history in lines' + 'hook:name of running hook, if any' + 'hook_pane:ID of pane where hook was run, if any' + 'hook_session:ID of session where hook was run, if any' + 'hook_session_name:name of session where hook was run, if any' + 'hook_window:ID of window where hook was run, if any' + 'hook_window_name:name of window where hook was run, if any' + 'host:hostname of local host' + 'host_short:hostname of local host (no domain name)' + 'insert_flag:pane insert flag' + 'keypad_cursor_flag:pane keypad cursor flag' + 'keypad_flag:pane keypad flag' + 'line:line number in the list' + 'mouse_any_flag:pane mouse any flag' + 'mouse_button_flag:pane mouse button flag' + 'mouse_standard_flag:pane mouse standard flag' + 'mouse_all_flag:pane mouse all flag' + 'pane_active:1 if active pane' + 'pane_at_bottom:1 if pane is at the bottom of window' + 'pane_at_left:1 if pane is at the left of window' + 'pane_at_right:1 if pane is at the right of window' + 'pane_at_top:1 if pane is at the top of window' + 'pane_bottom:bottom of pane' + 'pane_current_command:current command if available' + 'pane_dead:1 if pane is dead' + 'pane_dead_status:exit status of process in dead pane' + 'pane_format:1 if format is for a pane (not assuming the current)' + 'pane_height:height of pane' + 'pane_id:unique pane ID' + 'pane_in_mode:if pane is in a mode' + 'pane_input_off:if input to pane is disabled' + 'pane_index:index of pane' + 'pane_left:left of pane' + 'pane_mode:name of pane mode, if any.' + 'pane_pid:PID of first process in pane' + 'pane_pipe:1 if pane is being piped' + 'pane_right:right of pane' + 'pane_search_string:last search string in copy mode' + 'pane_start_command:command pane started with' + 'pane_synchronized:if pane is synchronized' + 'pane_tabs:pane tab positions' + 'pane_title:title of pane' + 'pane_top:top of pane' + 'pane_tty:pseudo terminal of pane' + 'pane_width:width of pane' + 'pid:server PID' + 'rectangle_toggle:1 if rectangle selection is activated' + 'scroll_region_lower:bottom of scroll region in pane' + 'scroll_region_upper:top of scroll region in pane' + 'scroll_position:scroll position in copy mode' + 'selection_present:1 if selection started in copy mode' + 'session_alerts:list of window indexes with alerts' + 'session_attached:number of clients session is attached to' + 'session_activity:time of session last activity' + 'session_created:time session created' + 'session_format:1 if format is for a session (not assuming the current)' + 'session_last_attached:time session last attached' + 'session_group:name of session group' + 'session_group_size:size of session group' + 'session_group_list:list of sessions in group' + 'session_grouped:1 if session in a group' + 'session_id:unique session ID' + 'session_many_attached:1 if multiple clients attached' + 'session_name:name of session' + 'session_stack:window indexes in most recent order' + 'session_width:width of session' + 'session_windows:number of windows in session' + 'socket_path:server socket path' + 'start_time:server start time' + 'version:server version' + 'window_activity:time of window last activity' + 'window_activity_flag:1 if window has activity' + 'window_active:1 if window active' + 'window_bell_flag:1 if window has bell' + 'window_flags:window flags' + 'window_format:1 if format is for a window (not assuming the current)' + 'window_height:height of window' + 'window_id:unique window ID' + 'window_index:index of window' + 'window_last_flag:1 if window is the last used' + 'window_layout:window layout description, ignoring zoomed window panes' + 'window_linked:1 if window is linked across sessions' + 'window_name:name of window' + 'window_offset_x:X offset into window if larger than client' + 'window_offset_y:Y offset into window if larger than client' + 'window_panes:number of panes in window' + 'window_silence_flag:1 if window has silence alert' + 'window_stack_index:index in session most recent stack' + 'window_visible_layout:window layout description, respecting zoomed window panes' + 'window_width:width of window' + 'window_zoomed_flag:1 if window is zoomed' + 'wrap_flag:pane wrap flag' + ) + _describe -t variables variable tmux_variables -S "$close" + elif compset -P "${(q)hash}${(q)paren}"; then + compset -S '(\\|)\)*' + _cmdstring + elif [[ $PREFIX = ${hash}* ]]; then + _describe -t variables variable '( + \#H:local\ hostname + \#h:short\ local\ hostname + \#D:pane\ id + \#P:pane\ index + \#T:pane\ title + \#S:session\ name + \#F:window\ flags + \#I:window\ index + \#W:window\ name + )' -S '' + else + _wanted format-specifiers expl 'format specifier' compadd -S '' \# + fi } function __tmux-colours() { @@ -1128,7 +1327,7 @@ function __tmux-get-optarg() { } __tmux-nothing-else() { - _message "no further arguments" + _message -e "no further arguments" } function __tmux-option-guard() { @@ -1140,12 +1339,13 @@ function __tmux-option-guard() { int_guard='_guard "[0-9]#" "'${opt}': numeric value"' if [[ ${mode} == 'session' ]]; then options=( + 'activity-action:DESC:any none current other' 'assume-paste-time:'${int_guard} 'base-index:'${int_guard} 'bell-action:DESC:any none current other' - 'bell-on-alert:DESC:on off' 'default-command:MSG:command string' 'default-shell:MSG:shell executable' + 'default-size:MSG:XxY' 'destroy-unattached:DESC:on off' 'detach-on-destroy:DESC:on off' 'display-panes-colour:__tmux-colours' @@ -1164,7 +1364,9 @@ function __tmux-option-guard() { 'repeat-time:'${int_guard} 'set-titles:DESC:on off' 'set-titles-string:MSG:title format string' + 'silence-action:DESC:any none current other' 'status:DESC:on off' + 'status-format:MSG:format string' 'status-interval:'${int_guard} 'status-justify:DESC:left centre right' 'status-keys:DESC:vi emacs' @@ -1177,6 +1379,7 @@ function __tmux-option-guard() { 'status-right-style:__tmux-style' 'status-style:__tmux-style' 'update-environment:MSG:string listing env. variables' + 'user-keys:MSG:key' 'visual-activity:DESC:on off' 'visual-bell:DESC:on off' 'visual-silence:DESC:on off' @@ -1185,13 +1388,14 @@ function __tmux-option-guard() { elif [[ ${mode} == 'server' ]]; then options=( 'buffer-limit:'${int_guard} + 'command-alias:MSG:alias' 'default-terminal:MSG:terminal string' 'escape-time:'${int_guard} + 'exit-empty:DESC:on off' 'exit-unattached:DESC:on off' 'focus-events:DESC:on off' 'history-file:_path-files -g "*(-.)"' 'message-limit:'${int_guard} - 'quiet:DESC:on off' 'set-clipboard:DESC:on off' 'terminal-overrides:MSG:overrides string' ) @@ -1204,13 +1408,12 @@ function __tmux-option-guard() { 'automatic-rename-format:DESC:__tmux-format' 'clock-mode-colour:__tmux-colours' 'clock-mode-style:DESC:12 24' - 'force-height:'${int_guard} - 'force-width:'${int_guard} 'main-pane-height:'${int_guard} 'main-pane-width:'${int_guard} 'mode-keys:DESC:vi emacs' 'mode-style:__tmux-style' 'monitor-activity:DESC:on off' + 'monitor-bell:DESC:on off' 'monitor-silence:DESC:on off' 'other-pane-height:'${int_guard} 'other-pane-width:'${int_guard} @@ -1230,6 +1433,7 @@ function __tmux-option-guard() { 'window-status-last-style:__tmux-style' 'window-status-separator:MSG:separator string' 'window-status-style:__tmux-style' + 'window-size:MSG:XxY' 'window-style:__tmux-style' 'wrap-search:DESC:on off' 'xterm-keys:DESC:on off' @@ -1241,12 +1445,11 @@ function __tmux-option-guard() { _message "unknown ${mode} option: ${opt}" return fi - _message "${mode} option value" guard=${guard#*:} case ${guard} in ('') ;; (MSG:*) - _message ${guard#*:} + _message -e ${guard#*:} ;; (DESC:*) eval "desc=( ${guard#*:} )" @@ -1261,12 +1464,13 @@ function __tmux-option-guard() { function __tmux-session-options() { local -a tmux_session_options tmux_session_options=( + 'activity-action:set action on window activity when monitor-activity is on' 'assume-paste-time:assume keys are pasted instead of typed if this fast' 'base-index:define where to start numbering' 'bell-action:set action on window bell' - 'bell-on-alert:ring the terminal bell when an alert occurs' 'default-command:default command for new windows' 'default-shell:default shell executable' + 'default-size:set the default size of windows when the size is not set' 'destroy-unattached:destroy session if no client is attached' 'detach-on-destroy:detach client if attached session is destroyed' 'display-panes-colour:colour used for display-panes' @@ -1286,7 +1490,9 @@ function __tmux-session-options() { 'repeat-time:time for multiple commands without prefix-key presses' 'set-titles:try to set xterm window titles' 'set-titles-string:format used by set-titles' + 'silence-action:set action on window silence when monitor-silence is on' 'status:show or hide the status bar' + 'status-format:specify the format to be used for each line of the status line' 'status-interval:interval (in seconds) for status bar updates' 'status-justify:position of the window list in status bar' 'status-keys:mode to use in status bar modes (vi/emacs)' @@ -1299,6 +1505,7 @@ function __tmux-session-options() { 'status-right-style:style of right part of status line' 'status-style:style status line' "update-environment:list of variables to be copied to a session's environment" + 'user-keys:set list of user-defined key escape sequences' 'visual-activity:display status line messages upon activity' 'visual-bell:use visual bell instead of audible' 'visual-silence:print a message if monitor-silence is on' @@ -1352,13 +1559,14 @@ function __tmux-server-options() { local -a tmux_server_options tmux_server_options=( 'buffer-limit:number of buffers kept per session' + 'command-alias:custom command aliases' 'default-terminal:default terminal definition string' 'escape-time:set timeout to detect single escape characters (in msecs)' 'exit-unattached:make server exit if it has no attached clients' + 'exit-empty:exit when there are no active sessions' 'focus-events:request focus events from terminal' 'history-file:tmux command history file name' 'message-limit:set size of message log per client' - 'quiet:enable/disable the display of various informational messages' 'set-clipboard:use esc sequences to set terminal clipboard' 'terminal-overrides:override terminal descriptions' ) @@ -1420,13 +1628,12 @@ function __tmux-window-options() { 'automatic-rename-format:format for automatic renames' 'clock-mode-colour:set clock colour' 'clock-mode-style:set clock hour format (12/24)' - 'force-height:force a windows to a certain height' - 'force-width:force a windows to a certain width' 'main-pane-height:set height for main-* layouts' 'main-pane-width:set width for main-* layouts' 'mode-keys:mode to use in copy and choice modes (vi/emacs)' 'mode-style:set window modes style' 'monitor-activity:monitor window activity' + 'monitor-bell:monitor for a bell in the window' 'monitor-silence:monitor window for inactivity' 'other-pane-height:height of other panes' 'other-pane-width:width of other panes' @@ -1446,6 +1653,7 @@ function __tmux-window-options() { 'window-status-last-style:style of last window in status bar' 'window-status-separator:separator drawn between windows in status line' 'window-status-style:general status bar style' + 'window-size:indicate how to automatically size windows' 'window-style:style of window' 'wrap-search:search wrap around at the end of a pane' 'xterm-keys:generate xterm-style function key sequences' diff --git a/Completion/Unix/Command/_top b/Completion/Unix/Command/_top index f9d2733fc..652432166 100644 --- a/Completion/Unix/Command/_top +++ b/Completion/Unix/Command/_top @@ -8,6 +8,7 @@ opts=( -s -w -C ) case $OSTYPE in *linux*) + # based on procps-ng-3.3.15 fields=( '%CPU:CPU usage' '%MEM:memory usage (res)' 'CGROUPS:control groups' 'CODE:code size' 'COMMAND:Command name/line' 'DATA:data + stack size' @@ -26,25 +27,33 @@ case $OSTYPE in 'nTH:number of threads' 'nsIPC:IPC namespace' 'nsMNT:MNT namespace' 'nsNET:NET namespace' 'nsPID:PID namespace' 'nsUSER:USER namespace' 'nsUTS:UTS namespace' 'vMj:major page fault count delta' - 'vMn:minor page fault count delta' + 'vMn:minor page fault count delta' 'LXC:lxc container name' + 'OOMa:out of memory adjustment factor' 'OOMs:out of memory source' + 'Rsan:resident anonymous memory size' + 'RSfd:resident file-backed memory size' 'RSlk:resident locked memory size' + 'RSsh:resident shared memory size' 'CGNAME:control group name' + 'NU:last known NUMA node' ) order=( '+:descending (default)' '-:ascending' ) + local -a units=( 'k:KiB' 'm:MiB' 'g:GiB' 't:TiB' 'p:PiB' 'e:EiB' ) specs=( '(-)-'{h,v}'[show version and usage]' '-b[batch mode]' '-c[command line/program name toggle]' '-d+[delay time interval]:interval' + '-E+[specify the memory scaling unit]: : _describe -V -t units unit units' '-H[threads mode operation]' '-i[idle process toggle]' '-n+[number of iterations]:number of iterations' '-o+[override sort field]:fieldname:->sortkey' '-O[output field names]' - '*-p+[monitor pids]: :_sequence -s , _pids' + '(-u -U)*-p+[monitor pids]: :_sequence -s , _pids' '-s[secure mode operation]' '-S[cumulative time toggle]' - '(-U)-u+[effective user filter mode]: :_users' - '(-u)-U+[user filter mode]: :_users' + '(-U -p)-u+[effective user filter mode]: :_users' + '(-u -p)-U+[user filter mode]: :_users' '-w+[output width override]::number' + '-1[single/separate cpu states toggle]' );; freebsd*|openbsd*) fields=( cpu size res time pri pid ) @@ -56,6 +65,7 @@ case $OSTYPE in '-i[interactive mode]' '-n[non-interactive mode (identical to batch mode)]' '-o+[sort process display by the specified field]:field:( $fields )' + '-p+[filter by the specified pid]: :_pids' '-q[renice top to -20]' '-S[show system processes]' '-s+[specify delay interval]:seconds:' @@ -63,7 +73,7 @@ case $OSTYPE in '1: :_guard "^-*" "number of processes to display"' );| freebsd*) - fields+=( threads total read write fault vcsw ivcsw jid ) + fields+=( threads total read write fault vcsw ivcsw jid swap ) specs+=( '-C[CPU display mode]' '-a[display command names via argv]' @@ -83,7 +93,6 @@ case $OSTYPE in '-1[combine CPU statistic into one line]' '-C[show command arguments as well as process name]' '-g+[filter processes by the specified string]:string' - '-p+[filter by the specified pid]: :_pids' '-U+[filter processes by the specified user]: :_users -M "L\:|-="' );; darwin*) @@ -127,6 +136,8 @@ case $OSTYPE in 'sysmach:total Mach syscalls' 'pageins:total pageins' 'boosts:number of boosts held by the process' + 'instrs:number of instructions retired by the process' + 'cycles:number of cycles spent in the process' ) order=( '-:descending (default)' '+:ascending' ) specs=( diff --git a/Completion/Unix/Command/_transmission b/Completion/Unix/Command/_transmission new file mode 100644 index 000000000..8a4bebec3 --- /dev/null +++ b/Completion/Unix/Command/_transmission @@ -0,0 +1,503 @@ +#compdef transmission-remote + +# arrays of options + +# `general_options`: *options* which can be used for any action +local exclusive_auth_options='(-n --auth -ne --authenv -N --netrc)' +local general_options=( + {-d,--debug}'[enable debugging mode]' + $exclusive_auth_options{-n-,--auth=}'[set the username and password for authentication]:username\:password: ' + $exclusive_auth_options{-ne,--authenv}'[set the authentication information from the TR_AUTH environment variable]' + $exclusive_auth_options{-N-,--netrc=}'[set the authentication information from a netrc file]:file:_files' + '--find[tell Transmission where to look for the current torrents'"'"' data]' +) +# `general_actions`: *actions* that can be specified when a specific set of torrents is either specified or either not +local general_actions=( + '(- :)'{-gsr,--global-seedratio}'[all torrents, unless overridden by a per-torrent setting, should seed until a specific ratio]:ratio:{_message "ratio in kB/sec"}' + '(- :)'{-GSR,--no-global-seedratio}'[all torrents, unless overridden by a per-torrent setting, should seed regardless of ratio]' + '(- :)'{-pr,--peers}'[set the maximum number of peers]:number: ' + '(- :)'{-d-,--downlimit=}'[limit the maximum download speed to limit kB/s]:limit:{_message "limit in kB/sec"}' + '(- :)'{-D,--no-downlimit}'[disable download speed limits]' +) +# `global_only_actions`: *actions* that can be specified only when no specific torrent is specified +local global_only_actions=( + '(- :)'{-as,--alt-speed}'[use the alternate Limits]' + '(- :)'{-AS,--not-alt-speed}'[don'"'"'t use the alternate Limits]' + '(- :)'{-asd,--alt-speed-downlimit}'[limit the alternate download speed to limit kilobytes per second]' + '(- :)'{-asu,--alt-speed-uplimit}'[limit the alternate upload speed to limit kilobytes per second]' + '(- :)'{-asc,--alt-speed-scheduler}'[use the scheduled on/off times]' + '(- :)'{-asc,--not-alt-speed-scheduler}'[don'"'"'t use the scheduled on/off times]' + '(- :)--alt-speed-time-begin[time to start using the alt speed limits]:hhmm:_transmission-remote_time' + '(- :)--alt-speed-time-end[time to stop using the alt speed limits]:hhmm:_transmission-remote_time' + '(- :)--alt-speed-days[set the number of days on which to enable the speed scheduler]:days:_transmission-remote_days' + '(- :)--torrent-done-script[specify a file to run each time a torrent finishes]:script:_files' + '(- :)--no-torrent-done-script[don'"'"'t run any script when a torrent finishes]' + '(- :)'{-e-,--cache=}'[set the session'"'"'s maximum memory cache size in MiB]:size (MiB):' + '(- :)'{-er,--encryption-required}'[encrypt all peer connections]' + '(- :)'{-ep,--encryption-preferred}'[prefer encrypted peer connections]' + '(- :)'{-et,--encryption-tolerated}'[prefer unencrypted peer connections]' + '(- :)'{-h,--help}'[print command-line option descriptions]' + '(- :)--exit[tell the Transmission to initiate a shutdown]' + '(- :)'{-V,--version}'[show version number and exit]' + {-t,--torrent=}'[set the current torrent(s) for use by subsequent options]:torrent:_transmission-remote_torrent' + '(- :)'{-si,--session-info}'[list session information from the server]' + '(- :)'{-st,--session-stats}'[list statistical information from the server]' + {-a-,--add=}'[add torrents to transmission]:filename\|url:_transmission-remote_add' + '(- :)'{-l,--list}'[list all torrents]' + '(- :)'{-p,--port}'[set the port for use when listening for incoming peer connections]:port:' + '(- :)--start-paused[start added torrents paused]' + '(- :)--no-start-paused[start added torrents unpaused]' + '(- :)'{-m,--portmap}'[enable portmapping via NAT-PMP or UPnP]' + '(- :)'{-M,--no-portmap}'[disable portmapping]' + '(- :)'{-o,--dht}'[enable distributed hash table]' + '(- :)'{-O,--no-dht}'[disable distributed hash table]' + '(- :)'{-u,--uplimit}'[limit the maximum upload speed to limit kB/s]:limit:{_message "limit in kB/sec"}' + '(- :)'{-U,--no-uplimit}'[disable upload speed limits]' + '(- :)--utp[enable uTP for peer connections]' + '(- :)--no-utp[disable uTP for peer connections]' + '(- :)'{-x,--pex}'[enable peer exchange (PEX)]' + '(- :)'{-X,--no-pex}'[disable peer exchange (PEX)]' + '(- :)'{-y,--lss}'[enable local peer discovery (LPD)]' + '(- :)'{-Y,--no-lss}'[disable local peer discovery (LPD)]' + '(- :)'{-pi,--peer-info}"[list the current torrent's connected peers]" + "(- :)--blocklist-update[update blocklist from URL specified in remote client's settings with blocklist-url key]" + '*:host\:port:_hosts' +) +# `torrent_add_options`: *options* that can be used only when *adding* a torrent +local torrent_add_options=( + '(-C --no-incomplete-dir)'{-c-,--incomplete-dir=}'[when adding new torrents, store their contents in directory until the torrent is done]:dir:{_files -/}' + '(-c --incomplete-dir)'{-C,--no-incomplete-dir}'[don'"'"'t store incomplete torrents in a different directory]' + {-w-,--download-dir=}'[when used in conjunction with --add, set the new torrent'"'"'s download folder]:dir:{_files -/}' +) +# `torrent_action_only_actions`: *actions* that can be specified only when explicitly selecting a specific set of torrents +local torrent_action_only_actions=( + {-f,--files}'[get a file list for the current torrent(s)]' + {-g,--get}'[mark file(s) for download]:torrent_file:_transmission-remote_torrent_get' + {-G,--no-get}'[mark file(s) for not downloading]:torrent_file:_transmission-remote_torrent_no_get' + {-i,--info}'[show details of the current torrent(s)]' + {-if,--info-files}'[list the specified torrent'"'"'s files]' + {-ip,--info-peers}'[list the specified torrent'"'"'s peers]' + {-ic,--info-pieces}'[list the specified torrent'"'"'s pieces]' + {-it,--info-trackers}'[list the specified torrent'"'"'s trackers]' + '--trash-torrent[delete torrents after adding]' + '--no-trash-torrent[do not delete torrents after adding]' + {-td-,--tracker-add=}'[add a tracker to a torrent]:tracker:_urls' + {-tr-,--tracker-remove=}'[remove a tracker from a torrent]:tracker_id:_transmission-remote_torrent_tracker_id' + {-s,--start}'[start the current torrent(s)]' + {-S,--stop}'[stop the current torrent(s) from downloading or seeding]' + {-r,--remove}'[remove the current torrent(s) without deleting the downloaded data]' + {-rad,--remove-and-delete}'[remove the current torrent(s) and delete the downloaded data]' + '--reannounce[reannounce the current torrent(s)]' + '--move[move the current torrents'"'"' data from their current locations to the specified directory]:{_files -/}' + {-sr-,--seedratio=}'[let the current torrent(s) seed until a specific ratio]:ratio:{_message "ratio in kB/sec"}' + {-SR,--no-seedratio}'[let the current torrent(s) use the global seedratio settings]' + {-hl,--honor-session}'[make the current torrent(s) honor the session limits]' + {-HL,--no-honor-session}'[make the current torrent(s) not honor the session limits]' + {-Bh,--bandwidth-high}'[give this torrent first chance at available bandwidth]' + {-Bn,--bandwidth-normal}'[give this torrent the bandwidth left over by high priority torrents]' + {-Bl,--bandwidth-low}'[give this torrent the bandwidth left over by high and normal priority torrents]' + {-ph,--priority-high}'[try to download the specified file(s) first]:torrent_file:_transmission-remote_torrent_priority_not_high' + {-pn,--priority-normal}'[try to download the specified files normally.]:torrent_file:_transmission-remote_torrent_priority_not_normal' + {-pl,--priority-low}'[try to download the specified files last]:torrent_file:_transmission-remote_torrent_priority_not_low' + {-v,--verify}'[verify the current torrent(s)]' +) + +# helper functions + +# complete argument specified after global only action: `--alt-speed-time-begin` +# completes time in HHMM format +(( $+functions[_transmission-remote_time] )) || +_transmission-remote_time(){ + _message "time in format HHMS" +} +# complete argument specified after global only action: `--alt-speed-days` +# completes days in a list such as "2,4-6". +(( $+functions[_transmission-remote_days] )) || +_transmission-remote_days(){ + _values -s , -S '-' days {1..7} +} +# complete argument specified after global only action: `--add` +(( $+functions[_transmission-remote_add] )) || +_transmission-remote_add(){ +_alternative \ + 'args:torrent:_files -g ".torrent"' \ + 'args:url:_urls' +} +# complete torrents +(( $+functions[_transmission-remote_torrent] )) || +_transmission-remote_torrent(){ + local authentication_args + for k in '--auth' '--netrc'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k"="${authentication_args}" + break + fi + done + if [[ -z "${authentication_args}" ]]; then + for k in '-n' '-N'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k""${authentication_args}" + break + fi + done + fi + if [[ -z "${authentication_args}" ]]; then + for k in '--authenv' '-ne' '--netrc' '-N'; do + if [[ ${+opt_args[$k]} == "1" ]]; then + authentication_args="$k" + break + fi + done + fi + local torrents_list_lines=(${(f)"$(transmission-remote "${authentication_args}" --list 2> /dev/null)"}) + local -a parts + local -a torrents_ids torrents_names + # While iterating through every line in the output above, we don't need the + # first and last line which are just a header and summary + for (( t = 2; t < ${#torrents_list_lines[@]} - 1; ++t )); do + parts=(${(@s. .)torrents_list_lines[$t]}) + torrents_ids+=("${parts[1]}") + torrents_names+=("${parts[10,${#parts[@]}]}") + done + _describe -t torrents torrent torrents_names torrents_ids +} +# complete action specified after *--torrent*: `--get` +(( $+functions[_transmission-remote_torrent_get] )) || +_transmission-remote_torrent_get(){ + local authentication_args + for k in '--auth' '--netrc'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k"="${authentication_args}" + break + fi + done + if [[ -z "${authentication_args}" ]]; then + for k in '-n' '-N'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k""${authentication_args}" + break + fi + done + fi + if [[ -z "${authentication_args}" ]]; then + for k in '--authenv' '-ne' '--netrc' '-N'; do + if [[ ${+opt_args[$k]} == "1" ]]; then + authentication_args="$k" + break + fi + done + fi + local selected_torrent + for k in '-t' '--torrent'; do + if [[ ! -z ${opt_args[$k]} ]]; then + selected_torrent="${opt_args[$k]}" + fi + done + if [[ -z "${selected_torrent}" ]]; then + _message -r "no torrent was selected on the command line enabling completion of files" + return + fi + local files_info_lines=(${(f)"$(transmission-remote "${authentication_args}" --torrent "${selected_torrent}" --info-files 2> /dev/null)"}) + local -a parts + local -a files + local torrent_name + for (( f = 3; f < ${#files_info_lines[@]}; ++f )); do + parts=(${(@s. .)files_info_lines[$f]}) + torrent_name="${parts[7,${#parts[@]}]%/*}" + if [[ ${parts[4]} == "No" ]]; then + files+=("${parts[1]%:}""[""${parts[7,${#parts[@]}]#*/}"]) + fi + done + if [[ -z "${files}" ]]; then + _message -r "No files are marked for not downloading in torrent ${torrent_name}" + return + fi + _values -s , -S '-' "files from ${torrent_name}" "${files[@]}" +} +# complete action specified after *--torrent*: `--no-get` +(( $+functions[_transmission-remote_torrent_no_get] )) || +_transmission-remote_torrent_no_get(){ + local authentication_args + for k in '--auth' '--netrc'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k"="${authentication_args}" + break + fi + done + if [[ -z "${authentication_args}" ]]; then + for k in '-n' '-N'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k""${authentication_args}" + break + fi + done + fi + if [[ -z "${authentication_args}" ]]; then + for k in '--authenv' '-ne' '--netrc' '-N'; do + if [[ ${+opt_args[$k]} == "1" ]]; then + authentication_args="$k" + break + fi + done + fi + local selected_torrent + for k in '-t' '--torrent'; do + if [[ ! -z ${opt_args[$k]} ]]; then + selected_torrent="${opt_args[$k]}" + fi + done + if [[ -z "${selected_torrent}" ]]; then + _message -r "no torrent was selected on the command line enabling completion of files" + return + fi + local files_info_lines=(${(f)"$(transmission-remote "${authentication_args}" --torrent "${selected_torrent}" --info-files 2> /dev/null)"}) + local -a parts + local -a files + local torrent_name + for (( f = 3; f < ${#files_info_lines[@]}; ++f )); do + parts=(${(@s. .)files_info_lines[$f]}) + torrent_name="${parts[7,${#parts[@]}]%/*}" + if [[ ${parts[4]} == "Yes" ]]; then + files+=("${parts[1]%:}""[""${parts[7,${#parts[@]}]#*/}"]) + fi + done + if [[ -z "${files}" ]]; then + _message -r "No files are marked for downloading in torrent ${torrent_name}" + return + fi + _values -s , -S '-' "files from ${torrent_name}" "${files[@]}" +} +# complete action specified after *--torrent*: `--priority-low` or `--priority-normal` +(( $+functions[_transmission-remote_torrent_priority_not_high] )) || +_transmission-remote_torrent_priority_not_high(){ + local authentication_args + for k in '--auth' '--netrc'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k"="${authentication_args}" + break + fi + done + if [[ -z "${authentication_args}" ]]; then + for k in '-n' '-N'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k""${authentication_args}" + break + fi + done + fi + if [[ -z "${authentication_args}" ]]; then + for k in '--authenv' '-ne' '--netrc' '-N'; do + if [[ ${+opt_args[$k]} == "1" ]]; then + authentication_args="$k" + break + fi + done + fi + local selected_torrent + for k in '-t' '--torrent'; do + if [[ ! -z ${opt_args[$k]} ]]; then + selected_torrent="${opt_args[$k]}" + fi + done + if [[ -z "${selected_torrent}" ]]; then + _message -r "no torrent was selected on the command line enabling completion of files" + return + fi + local files_info_lines=(${(f)"$(transmission-remote "${authentication_args}" --torrent "${selected_torrent}" --info-files 2> /dev/null)"}) + local -a parts + local -a files + local torrent_name + for (( f = 3; f < ${#files_info_lines[@]}; ++f )); do + parts=(${(@s. .)files_info_lines[$f]}) + torrent_name="${parts[7,${#parts[@]}]%/*}" + if [[ ${parts[3]} != "High" ]]; then + files+=("${parts[1]%:}""[""${parts[7,${#parts[@]}]#*/}"]) + fi + done + if [[ -z "${files}" ]]; then + _message -r "No files are marked with non-high priority in torrent ${torrent_name}" + return + fi + _values -s , -S '-' "files from ${torrent_name}" "${files[@]}" +} +# complete action specified after *--torrent*: `--priority-low` or `--priority-high` +(( $+functions[_transmission-remote_torrent_priority_not_normal] )) || +_transmission-remote_torrent_priority_not_normal(){ + local authentication_args + for k in '--auth' '--netrc'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k"="${authentication_args}" + break + fi + done + if [[ -z "${authentication_args}" ]]; then + for k in '-n' '-N'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k""${authentication_args}" + break + fi + done + fi + if [[ -z "${authentication_args}" ]]; then + for k in '--authenv' '-ne' '--netrc' '-N'; do + if [[ ${+opt_args[$k]} == "1" ]]; then + authentication_args="$k" + break + fi + done + fi + local selected_torrent + for k in '-t' '--torrent'; do + if [[ ! -z ${opt_args[$k]} ]]; then + selected_torrent="${opt_args[$k]}" + fi + done + if [[ -z "${selected_torrent}" ]]; then + _message -r "no torrent was selected on the command line enabling completion of files" + return + fi + local files_info_lines=(${(f)"$(transmission-remote "${authentication_args}" --torrent "${selected_torrent}" --info-files 2> /dev/null)"}) + local -a parts + local -a files + local torrent_name + for (( f = 3; f < ${#files_info_lines[@]}; ++f )); do + parts=(${(@s. .)files_info_lines[$f]}) + torrent_name="${parts[7,${#parts[@]}]%/*}" + if [[ ${parts[3]} != "Normal" ]]; then + files+=("${parts[1]%:}""[""${parts[7,${#parts[@]}]#*/}"]) + fi + done + if [[ -z "${files}" ]]; then + _message -r "No files are marked with non-high priority in torrent ${torrent_name}" + return + fi + _values -s , -S '-' "files from ${torrent_name}" "${files[@]}" +} +# complete action specified after *--torrent*: `--priority-normal` or `--priority-high` +(( $+functions[_transmission-remote_torrent_priority_not_low] )) || +_transmission-remote_torrent_priority_not_low(){ + local authentication_args + for k in '--auth' '--netrc'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k"="${authentication_args}" + break + fi + done + if [[ -z "${authentication_args}" ]]; then + for k in '-n' '-N'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k""${authentication_args}" + break + fi + done + fi + if [[ -z "${authentication_args}" ]]; then + for k in '--authenv' '-ne' '--netrc' '-N'; do + if [[ ${+opt_args[$k]} == "1" ]]; then + authentication_args="$k" + break + fi + done + fi + local selected_torrent + for k in '-t' '--torrent'; do + if [[ ! -z ${opt_args[$k]} ]]; then + selected_torrent="${opt_args[$k]}" + fi + done + if [[ -z "${selected_torrent}" ]]; then + _message -r "no torrent was selected on the command line enabling completion of files" + return + fi + local files_info_lines=(${(f)"$(transmission-remote "${authentication_args}" --torrent "${selected_torrent}" --info-files 2> /dev/null)"}) + local -a parts + local -a files + local torrent_name + for (( f = 3; f < ${#files_info_lines[@]}; ++f )); do + parts=(${(@s. .)files_info_lines[$f]}) + torrent_name="${parts[7,${#parts[@]}]%/*}" + if [[ ${parts[3]} != "Low" ]]; then + files+=("${parts[1]%:}""[""${parts[7,${#parts[@]}]#*/}"]) + fi + done + if [[ -z "${files}" ]]; then + _message -r "No files are marked with non-high priority in torrent ${torrent_name}" + return + fi + _values -s , -S '-' "files from ${torrent_name}" "${files[@]}" +} +# complete action specified after *--torrent*: `--tracker-remove` +(( $+functions[_transmission-remote_torrent_tracker_id] )) || +_transmission-remote_torrent_tracker_id(){ + local authentication_args + for k in '--auth' '--netrc'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k"="${authentication_args}" + break + fi + done + if [[ -z "${authentication_args}" ]]; then + for k in '-n' '-N'; do + authentication_args="${opt_args[${k}]}" + if ! [[ -z "${authentication_args}" ]]; then + authentication_args="$k""${authentication_args}" + break + fi + done + fi + if [[ -z "${authentication_args}" ]]; then + for k in '--authenv' '-ne' '--netrc' '-N'; do + if [[ ${+opt_args[$k]} == "1" ]]; then + authentication_args="$k" + break + fi + done + fi + local selected_torrent + for k in '-t' '--torrent'; do + if [[ ! -z ${opt_args[$k]} ]]; then + selected_torrent="${opt_args[$k]}" + fi + done + if [[ -z "${selected_torrent}" ]]; then + _message -r "no torrent was selected on the command line enabling completion of files" + return + fi + local trackers_info_lines=(${(f)"$(transmission-remote "${authentication_args}" --torrent $selected_torrent --info-trackers 2> /dev/null)"}) + local -a parts + local -a trackers_urls trackers_ids + for (( t = 1; t < ${#trackers_info_lines[@]}; ++t )); do + parts=(${(@s. .)trackers_info_lines[$t]}) + if [[ ( ${parts[1]} == "Tracker" && ${parts[2]} =~ "[0-9]+:" ) ]]; then + trackers_ids+=("${parts[2]%:}") + # descriptions passed to _describe need to have their ':' quoted. + trackers_urls+=("${parts[3]//:/\\:}") + fi + done + if [[ -z "${trackers_ids}" ]]; then + _message -r "Specified torrent has no trackers" + return + fi + _describe -t trackers-remove "tracker" trackers_urls trackers_ids +} + +# The real thing goes here +_arguments \ + "${general_options[@]}" \ + "${global_only_actions[@]}" \ + "${general_actions[@]}" \ + "${torrent_add_options[@]}" \ + "${torrent_action_only_actions[@]}" diff --git a/Completion/Unix/Command/_tree b/Completion/Unix/Command/_tree index 4fd9aed44..595249126 100644 --- a/Completion/Unix/Command/_tree +++ b/Completion/Unix/Command/_tree @@ -49,6 +49,7 @@ _arguments -s -S \ '(-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 -/' diff --git a/Completion/Unix/Command/_unison b/Completion/Unix/Command/_unison index 5725575c5..2a3333742 100644 --- a/Completion/Unix/Command/_unison +++ b/Completion/Unix/Command/_unison @@ -34,7 +34,7 @@ _arguments \ '-backups[keep backup copies of all files]' \ '-backupsuffix[a suffix to be added to names of backup files]:suffix:' \ '-confirmbigdel[ask about whole-replica (or path) deletes (default true)]' \ - '-confirmmerge[ask for confirmation before commiting results of a merge]' \ + '-confirmmerge[ask for confirmation before committing results of a merge]' \ '-contactquietly[suppress the "contacting server" message during startup]' \ '-copyprog[external program for copying large files]:program:_files -g "*(-x)"' \ '-copyprogrest[variant of copyprog for resuming partial transfers]:program:_files -g "*(-x)"' \ @@ -61,7 +61,7 @@ _arguments \ '-maxthreads[maximum number of simultaneous file transfers]:number:' \ '-merge[add a pattern to the merge list]:pattern:' \ '-mountpoint[abort if this path does not exist]:mountpoint:_files -/' \ - '-numericids[dont map uid/gid values by user/group names]' \ + "-numericids[don't map uid/gid values by user/group names]" \ '-preferpartial[add a pattern to the preferpartial list]:pattern:' \ '-pretendwin[use creation times for detecting updates]' \ '-repeat[synchronize repeatedly (text interface only)]:repeat:' \ diff --git a/Completion/Unix/Command/_user_admin b/Completion/Unix/Command/_user_admin index fe28c13f5..c7e1efc80 100644 --- a/Completion/Unix/Command/_user_admin +++ b/Completion/Unix/Command/_user_admin @@ -103,10 +103,10 @@ case ${service%???}:${(M)service%???}:$OSTYPE in user:mod:linux*) args+=( '(-a --append)'{-a,--append}'[add user to supplementary groups without removing from other groups]' - \*{-v,--add-sub-uids}'[add a range of subordinate uids]:uids (first-last)' - \*{-V,--del-sub-uids}'[remove a range of subordinate uids]:uids (first-last)' - \*{-w,--add-sub-gids}'[add a range of subordinate gids]:gids (first-last)' - \*{-W,--del-sub-gids}'[remove a range of subordinate gids]:gids (first-last)' + \*{-v,--add-subuids}'[add a range of subordinate uids]:uids (first-last)' + \*{-V,--del-subuids}'[remove a range of subordinate uids]:uids (first-last)' + \*{-w,--add-subgids}'[add a range of subordinate gids]:gids (first-last)' + \*{-W,--del-subgids}'[remove a range of subordinate gids]:gids (first-last)' ) ;| user:mod:*) diff --git a/Completion/Unix/Command/_uzbl b/Completion/Unix/Command/_uzbl deleted file mode 100644 index 570b20266..000000000 --- a/Completion/Unix/Command/_uzbl +++ /dev/null @@ -1,10 +0,0 @@ -#compdef uzbl uzbl-browser uzbl-tabbed - -_arguments \ - '(-u --uri)'{-u,--uri=}':uri to load:_urls' \ - '(-v --verbose)'{-v,--verbose}'[verbose]' \ - '(-n --name)'{-n,--name=}':instance name' \ - '(-c --config)'{-c,--config=}':config file:_files' \ - '--display=:X display:_x_display' \ - '--help[help]' - diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim index 8853fac30..d9dc1a5b3 100644 --- a/Completion/Unix/Command/_vim +++ b/Completion/Unix/Command/_vim @@ -19,69 +19,86 @@ typeset -A opt_args local arguments arguments=( - '( -e -E -s -d -y)-v[vi mode]' - '(-v -E -d -y)-e[ex mode]' - '(-v -e -d -y)-E[improved ex mode]' - '(-v -e -E -s -d )-y[easy mode]' '-m[modifications (writing files) not allowed]' '-M[modifications in text not allowed]' '-b[binary mode]' '-l[lisp mode]' - '-C[start in compatible mode]' - '-N[start in incompatible mode]' - '(--nofork -f)'{--nofork,-f}'[do not detach the GUI version from the shell]' '-V-[verbosity level]::verbosity [10]:->verbosity' '-D[debugging mode]' '-n[no swap file (memory only)]' - '-nb[start as NetBean server]' {-r,-L}'[list swap files and exit or recover from a swap file]::swap file:_vim_files -g "*.sw?(-.)"' '( -H -F)-A[start in Arabic mode]' '(-A -F)-H[start in Hebrew mode]' '(-A -H )-F[start in Farsi mode]' - '-T[set terminal type]:::_terminals' - '--not-a-term[skip warning for input/output not being a terminal]' - '--ttyfail[exit if input or output is not a terminal]' '-u[use given vimrc file instead of default .vimrc]:config:->config' "--noplugin[don't load plugin scripts]" '-o-[number of windows to open (default: one for each file)]::window count: ' '-O-[number of windows to vertically split open (default is one for each file)]::window count: ' '-p-[number of tabs to open (default: one for each file)]::tab count: ' - '(* -t)-q-[quickfix file]:*:file:_vim_files' + '(* -t)-q+[quickfix file]::file:_files' '*--cmd[execute given command before loading any RC files]:command: ' '-c[execute given command after loading the first file]:command: ' - '-S[source a session file after loading the first file]:session file:_files' + '-S[source a session file after loading the first file]::session file:_files' '-s[read normal-mode commands from script file]:script file:_files' '-w[append all typed commands to given file]:output file:_files' '-W[write all typed commands to given file, overwriting existing file]:output file:_files' - '-x[edit encrypted files]' - '-X[do not connect to X server]' - '--remote[edit given files in a vim server if possible]:*:file:_vim_files' - '--remote-silent[as --remote but without complaining if not possible]:*:file:_vim_files' - '--remote-wait[as --remote but wait for files to have been edited]:*:file:_vim_files' - '--remote-wait-silent[as --remote-wait but without complaining if not possible]:*:file:_vim_files' - '--remote-send[send given keys to vim server if possible]:keys: ' - '--remote-tab[as --remote but open tab page for each file]:*:file:_vim_files' - '--remote-tab-silent[as --remote-silent but open tab page for each file]:*:file:_vim_files' - '--remote-tab-wait[as --remote-wait but open tab page for each file]:*:file:_vim_files' - '--remote-tab-wait-silent[as --remote-wait-silent but open tab page for each file]:*:file:_vim_files' - '--remote-expr[evaluate given expression in a vim server and print result]:expression: ' - '--literal[do not expand wildcards in arguments (this is useless with ZSH)]' - '(- *)--serverlist[list available vim servers and exit]' - '--servername[name of vim server to send to or name of server to become]:server name:->server' '--startuptime[write startup timing messages to given file]:log file:_files' - '--socketid[run GVIM in another window]' - '-i[use specified viminfo file]:viminfo file [~/.viminfo]:_files' '(- *)'{-h,--help}'[print help and exit]' '(- *)--version[print version information and exit]' - '(* -q)-t[edit file where tag is defined]:tag:_complete_tag' + '(* -q)-t+[edit file where tag is defined]:tag:_complete_tag' '(-t -q)*:file:_vim_files' - '--clean[start with defaults in non-compatible mode]' ) -[[ $service != *g* ]] && arguments+='-g[start with GUI]' +if [[ $service = nvim ]]; then + arguments+=( + '(-e -E -es -Es -s -d)-e[ex mode, read stdin as ex command]' + '(-e -E -es -Es -s -d)-E[ex mode, read stdin as text]' + '(-e -E -es -Es -s -d)-es[silent mode, read stdin as ex command]' + '(-e -E -es -Es -s -d)-Es[silent mode, read stdin as text]' + '-i[use the specified shada file]:shada file:_files' + '(- *)-v[print version information and exit]' + '(- *)--api-info[print msgpack-encoded api-metadata and exit]' + '--headless[do not start user interface]' + '--embed[use standard input and output as a msgpack-rpc channel]' + '--listen[start RPC server on the specified socket or named pipe]:address' + ) +else + arguments+=( + '(-v -E -d -y)-e[ex mode]' + '(-v -e -d -y)-E[improved ex mode]' + '( -e -E -s -d -y)-v[vi mode]' + '(-v -e -E -s -d )-y[easy mode]' + '-C[start in compatible mode]' + '-N[start in incompatible mode]' + '-nb[start as NetBean server]' + '-T[set terminal type]:::_terminals' + '--not-a-term[skip warning for input/output not being a terminal]' + '--ttyfail[exit if input or output is not a terminal]' + '-X[do not connect to X server]' + '-x[edit encrypted files]' + '--remote[edit given files in a vim server if possible]:*:file:_vim_files' + '--remote-silent[as --remote but without complaining if not possible]:*:file:_vim_files' + '--remote-wait[as --remote but wait for files to have been edited]:*:file:_vim_files' + '--remote-wait-silent[as --remote-wait but without complaining if not possible]:*:file:_vim_files' + '--remote-send[send given keys to vim server if possible]:keys: ' + '--remote-tab[as --remote but open tab page for each file]:*:file:_vim_files' + '--remote-tab-silent[as --remote-silent but open tab page for each file]:*:file:_vim_files' + '--remote-tab-wait[as --remote-wait but open tab page for each file]:*:file:_vim_files' + '--remote-tab-wait-silent[as --remote-wait-silent but open tab page for each file]:*:file:_vim_files' + '--remote-expr[evaluate given expression in a vim server and print result]:expression: ' + '--literal[do not expand wildcards in arguments (this is useless with ZSH)]' + '(- *)--serverlist[list available vim servers and exit]' + '--servername[name of vim server to send to or name of server to become]:server name:->server' + '--socketid[run GVIM in another window]' + '-i[use specified viminfo file]:viminfo file [~/.viminfo]:_files' + '--clean[start with defaults in non-compatible mode]' + ) +fi +[[ $service != *g* && $service != nvim ]] && arguments+='-g[start with GUI]' [[ $service != r* ]] && arguments+='-Z[restricted mode]' -[[ $service != *diff ]] && arguments+='(-v -e -E -s -y)-d[diff mode]' +[[ $service != *diff ]] && arguments+='(-v -e -E -es -Es -s -y)-d[diff mode]' [[ $service != *view ]] && arguments+='-R[readonly mode]' [[ $service = *g* ]] || (( ${words[(I)-g]} )) && arguments+=( + '(--nofork -f)'{--nofork,-f}'[do not detach the GUI version from the shell]' '-font:font:_xft_fonts' '-geometry:geometry:_x_geometry' '(-rv -reverse)'{-rv,-reverse}'[use reverse video]' diff --git a/Completion/Unix/Command/_vmstat b/Completion/Unix/Command/_vmstat index 7d3008592..f3ac1af14 100644 --- a/Completion/Unix/Command/_vmstat +++ b/Completion/Unix/Command/_vmstat @@ -21,15 +21,28 @@ case $OSTYPE in '(- :)'{-D,--disk-sum}'[summarize disk statistics]' ) ;; - *bsd*) + *bsd*|dragonfly*) specs=( '-c+[specify number of times to refresh the display]:count' - '-f[report on the number fork syscalls since boot and pages of virtual memory for each]' '-i[report the number of interrupts taken by devices since boot]' '-M+[specify core file to extract values associated with the name list from]:core:_files' '-N+[specify file to extract the name list from]:system:_files' '-w+[specify delay between each display]:delay (seconds)' - '*:disk:_files' + '*: :_bsd_disks' + ) + ;| + *bsd*) + specs+=( + '-f[report on the number fork syscalls since boot and pages of virtual memory for each]' + ) + ;| + freebsd*|dragonfly*) + specs+=( + '-m[report on the usage of kernel dynamic memory allocated using malloc(9) by type]' + '-n+[change the maximum number of disks to display]:number of disks to display [2]' + '*-p+[specify which types of devices to display]: :->devices' + '-s[display the contents of the SUM structure]' + '-z[report on memory used by the kernel zone allocator, uma(9), by zone]' ) ;| freebsd*) @@ -37,13 +50,8 @@ case $OSTYPE in '-a[include statistics about all interrupts]' '-h[human readable memory columns output]' '-H[scriptable memory columns output]' - '-m[report on the usage of kernel dynamic memory allocated using malloc(9) by type]' - '-n+[change the maximum number of disks to display]:number of disks to display' '-o[list virtual memory objects]' '-P[report per-cpu system/user/idle cpu statistics]' - '-p+[specify which types of devices to display]: :->devices' - '-s[display the contents of the SUM structure]' - '-z[report on memory used by the kernel zone allocator, uma(9), by zone]' ) ;| (net|open)bsd*) @@ -73,12 +81,14 @@ case $OSTYPE in '-W[print more information about kernel memory pools]' ) ;; - freebsd*|solaris*) + dragonfly*) specs+=( - '::disk:_files -W /dev -g "*(-%b)"' - ': :_guard "[0-9]#" "interval (seconds)"' ':count' + '-b[use brief format for formatted numbers]' + '-o[report usage of kernel object cache]' + '-u[output unformatted numeric values]' + '-v[include IRQ numbers and IRQ target CPU numbers before device names (with -i)]' ) - ;| + ;; solaris2.<11->) specs+=( '(-i -s)-T+[specify time format]:time format:((u\:seconds\ since\ epoch d\:standard\ date\ format))' ) ;& @@ -90,30 +100,20 @@ case $OSTYPE in '-p[report paging activity]' '(-T)-s[display the total number of system events since boot]' '-S[report on swapping rather than paging activity]' + '::disk:_files -W /dev -g "*(-%b)"' + ': :_guard "[0-9]#" "interval (seconds)"' '::count' ) ;; esac if (( $#specs )); then local curcontext=$curcontext state state_descr line ret=1 - typeset -A {opt,val}_args + typeset -A opt_args _arguments -C -s -w -A '-*' : "$specs[@]" && ret=0 if [[ $state == devices ]]; then - local -a types - types=( - 'da[direct access devices]' 'sa[sequential access devices]' - 'printer[printers]' 'proc[processor devices]' - 'worm[write once read multiple devices]' 'cd[CD devices]' - 'scanner[scanner devices]' 'optical[optical memory devices]' - 'changer[medium changer devices]' 'comm[communication devices]' - 'array[storage array devices]' 'enclosure[enclosure services devices]' - 'floppy[floppy devices]' 'IDE[Integrated Drive Electronics devices]' - 'SCSI[Small Computer System Interface devices]' - 'other[any other device interface]' 'pass[passthrough devices]' - ) - _values -s , 'device type' "$types[@]" && ret=0 + _fbsd_device_types && ret=0 elif [[ $state == hashes ]]; then local -a tables tables=( ${${${(f)"$(_call_program hashes $words[1] -L)"}[2,-1]#?}/ ##/:} ) diff --git a/Completion/Unix/Command/_vux b/Completion/Unix/Command/_vux deleted file mode 100644 index 1ed56dca6..000000000 --- a/Completion/Unix/Command/_vux +++ /dev/null @@ -1,63 +0,0 @@ -#compdef vux vuxctl - -local expl - -case "$service" in - (vux) - - _arguments -s -C \ - '-x:action:((play\:play\ music generate\:generate\ new\ scorelist - merge\:merge\ new\ songs - weed\:prune\ songs\ from\ scorelist - ratings\:show\ statistics force\:force-rate))' \ - '-s:file:_files' \ - '-a:file:_files' \ - '-z:file:_files' \ - '-y:file:_files' \ - '-p:file:_files' \ - '-w:ratings:(b t)' \ - '-W:repeats:(a c)' \ - '-G:age bypass method:(t s n)' \ - '-e:pattern' \ - '-O:device:_files' \ - '-M:minimum age val' \ - '-S[disable saving scorelist]' \ - '-A[disable saving agelist]' \ - '-Z[disable saving countlist]' \ - '-Y[disable missing log]' \ - '-c[disable rating check]' \ - '-d[disable rating updates on play]' \ - '-l[disable rating updates on skip]' \ - '-j[disable repeat check]' \ - '-b[disable repeat updates on play]' \ - '-k[disable repeat updates on skip]' \ - '-n[disable player]' \ - '-t:percent' \ - '-T:percent' \ - '-C:factor' \ - '-D:factor' \ - '-I:factor' \ - '-U:rating' \ - '-X:score' \ - '-N:count' \ - '-f:rating' \ - '-J[accelerate decreases]' \ - '-K[accelerate increases]' \ - '-u[check age before rating]' \ - '-R[show ratings after processing]' \ - '-V[verbose file manipulation]' \ - '-v[show version and exit]' \ - '-F[skip songs with -n and -xf]' \ - '-q[minimize vux output]' \ - '-P[always play new songs]' \ - '-g[print stats in xgraph format]' \ - '-h[show summary of options]' - ;; - - (vuxctl) - - _wanted vuxcmd expl 'vux control command' \ - compadd start clean double half up down next previous forward \ - replay pause resume stop reload save history help - ;; -esac diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget index 2a4e722d8..49c8e8b01 100644 --- a/Completion/Unix/Command/_wget +++ b/Completion/Unix/Command/_wget @@ -16,6 +16,7 @@ _arguments -C -s \ '*-n+[turn off flags]:flags:->noflags' \ '--report-speed=:type:(bits)' \ '(--input-file -i)'{--input-file=,-i+}'[specify input file]:file containing URLs:_files' \ + '--input-metalink=[download files covered in local Metalink file]:file:_files' \ '(--force-html -F)'{--force-html,-F}'[treat input file as html]' \ '(--base -B)'{--base=,-B+}'[prepend URL to relative links]:base URL:_urls' \ '--config=[specify config file]:config file:_files' \ @@ -57,7 +58,11 @@ _arguments -C -s \ '--local-encoding=[specify local encoding for IRIs]:encoding' \ '--remote-encoding=[specify default remote encoding]:encoding' \ '--unlink[remove file before clobber]' \ - '--no-xattr[turn off storage of metadata in extended file attributes]' \ + '--keep-badhash[Keep files with checksum mismatch (append .badhash)]' \ + '--metalink-index=[metalink application/metalink4+xml metaurl ordinal]:number' \ + '--metalink-over-http[use Metalink metadata from HTTP response headers]' \ + '--preferred-location[preferred location for Metalink resources]' \ + '--xattr[turn on storage of metadata in extended file attributes]' \ '(-nd --no-directories)'{-nd,--no-directories}"[don't create directories]" \ '(--force-directories -x)'{--force-directories,-x}'[force creation of directories]' \ '(-nH --no-host-directories)'{-nH,--no-host-directories}"[don't create host directories]" \ @@ -102,7 +107,7 @@ _arguments -C -s \ "--ca-directory=[specify dir where hash list of CA's are stored]:directory:_directories" \ '--crl-file=[specify file with bundle of CRLs]:file:_files' \ '--pinnedpubkey=:file:_files' \ - '--random-file[specify file with random data for seeding generator]:file:_files' \ + '!--random-file=:file:_files' \ '--egd-file=[specify filename of EGD socket]:file:_files' \ '--ciphers=[set the priority string (GnuTLS) or cipher list string (OpenSSL) directly]:string' \ '--no-hsts[disable HSTS]' \ diff --git a/Completion/Unix/Command/_xargs b/Completion/Unix/Command/_xargs index 8b543341d..f21784ef1 100644 --- a/Completion/Unix/Command/_xargs +++ b/Completion/Unix/Command/_xargs @@ -47,6 +47,7 @@ case $variant in '(-0 --null -d --delimiter)'{-0,--null}'[expect NUL characters as input separators]' '(-d --delimiter -0 --null)'{-d+,--delimiter=}'[specify delimiter of input items]:delimiter' '(-l -L --max-lines -n --max-args -s --max-chars)--max-lines=-[call program for every number of lines]::number of input lines' + '(-o --open-tty)'{-o,--open-tty}'[reopen stdin as /dev/tty in the child process before executing the command]' '--process-slot-var=[set environment variable to unique value in child processes]:variable:_parameters -g "*export*"' '(-r --no-run-if-empty)'{-r,--no-run-if-empty}"[don't run command in absence of input]" '(- *)--help[show help information]' diff --git a/Completion/Unix/Command/_xmlsoft b/Completion/Unix/Command/_xmlsoft index 7b4b0b03d..487974fdb 100644 --- a/Completion/Unix/Command/_xmlsoft +++ b/Completion/Unix/Command/_xmlsoft @@ -53,7 +53,7 @@ case $service in '--catalogs[use SGML catalogs]' \ '--xinclude[do XInclude processing on document input]' \ '--xincludestyle[do XInclude processing on stylesheets]' \ - '--load-trace[print trace of all external entites loaded]' \ + '--load-trace[print trace of all external entities loaded]' \ {--profile,--norman}'[dump profiling information]' \ '1:stylesheet:_files -g "*.xslt#(-.)"' \ ':file:_files -g "*.xml(-.)"' && return @@ -71,7 +71,7 @@ case $service in '--noenc[ignore any encoding specified inside the document]' \ "(--output -o)--noout[don't output the result tree]" \ '--path[provide a set of paths for resources]:paths:_files -/' \ - '--load-trace[print trace of all external entites loaded]' \ + '--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]' \ diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs index ce5df5877..814358bc7 100644 --- a/Completion/Unix/Command/_zfs +++ b/Completion/Unix/Command/_zfs @@ -145,7 +145,6 @@ _zfs() { # set the sorting for *size properties to false by default? rw_properties=( "aclinherit:value:(discard noallow restricted passthrough passthrough-x)" - "aclmode:value:(discard mask passthrough)" "atime:value:(on off)" "canmount:value:(on off noauto)" "checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)" @@ -185,6 +184,15 @@ _zfs() { $share_rw_properties ) + if [[ "$OSTYPE" == "linux-gnu" ]]; then + rw_properties+=("acltype:value:(off noacl posixacl)") + elif [[ "$implementation" == "solaris" ]]; then + rw_properties+=("aclmode:value:(discard mask passthrough)") + else + rw_properties+=("aclmode:value:(discard groupmask passthrough restricted)") + fi + + create_properties=( $rw_properties "casesensitivity:value:(sensitive insensitive mixed)" diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool index 4d4793eea..d9c2caa52 100644 --- a/Completion/Unix/Command/_zpool +++ b/Completion/Unix/Command/_zpool @@ -14,7 +14,7 @@ _zpool() { ) if [[ $implementation = openzfs ]] && [[ $OSTYPE != solaris* ]]; then - subcmds+=(labelclear) + subcmds+=( labelclear initialize ) fi versions=( @@ -158,6 +158,14 @@ _zpool() { '::pool name:_zfs_pool' ;; + (initialize) + _arguments -A "-*" \ + '(-c --cancel)'{-c,--cancel}'[cancel initializing on specified devices]' \ + '(-s --suspend)'{-s,--suspend}'[suspend initializing on specified devices]' \ + ':pool name:_zfs_pool' \ + '*:device:_files' + ;; + (iostat) _arguments -A "-*" \ '-l[Display configuration in /dev/chassis location form]' \ |