diff options
Diffstat (limited to 'Completion/Unix')
114 files changed, 3888 insertions, 1172 deletions
diff --git a/Completion/Unix/Command/_a2ps b/Completion/Unix/Command/_a2ps index c700c205d..aa2f4c3ba 100644 --- a/Completion/Unix/Command/_a2ps +++ b/Completion/Unix/Command/_a2ps @@ -7,7 +7,7 @@ if [[ "$words[1]" != "$_cache_a2ps_cmd" ]]; then _cache_a2ps_cmd="$words[1]" - descr=( "${(@)${(f@)$(_call_program features LC_ALL=C $words[1] --list=features)// + descr=( "${(@)${(f@)$(_call_program features $words[1] --list=features)// / }:#}" ) _cache_a2ps_values=( diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb index 6b56d1748..776a03cbc 100644 --- a/Completion/Unix/Command/_adb +++ b/Completion/Unix/Command/_adb @@ -1,12 +1,11 @@ #compdef adb -value-,ADB_TRACE,-default- -value-,ANDROID_SERIAL,-default- -value-,ANDROID_LOG_TAGS,-default- -local ADB_DEVICE_SPECIFICATION LOG_REDIRECT - _adb() { # rely on localoptions setopt nonomatch - ADB_DEVICE_SPECIFICATION="" + local -a ADB_DEVICE_SPECIFICATION + local LOG_REDIRECT if [[ $1 = -l ]]; then # Run to load _adb and associated functions but do @@ -23,7 +22,6 @@ _adb() { (ANDROID_SERIAL) _adb_device_serial - ADB_DEVICE_SPECIFICATION="-s ${ANDROID_SERIAL}" ;; (ANDROID_LOG_TAGS) @@ -80,18 +78,18 @@ _adb() { (( $+functions[_adb_device_specification] )) && _adb_device_specification - adb ${=ADB_DEVICE_SPECIFICATION} shell exit 2>/dev/null || { + if ! adb ${ADB_DEVICE_SPECIFICATION} shell exit 2>/dev/null; then # early bail-out until a single valid device/emulator is specified and up-and-running - _message -r "No (started) device specified, completions do not yet work" + [[ $words[CURRENT-1] = -s ]] || _message -r "No (started) device specified, completions do not yet work" _arguments \ - '(-d -e )-s[serial]: :_adb_device_serial' \ - '( -e -s)-d[device]' \ - '(-d -s)-e[emulator]' \ + '-s[serial]: :_adb_device_serial' \ + '( -e)-d[device]' \ + '(-d )-e[emulator]' \ '1:options:_adb_options_handler' \ '*: : _default' - return; - } + return + fi (( $+functions[_adb_check_log_redirect] )) && _adb_check_log_redirect @@ -163,27 +161,13 @@ _adb_sanitize_context () { (( $+functions[_adb_device_specification] )) || _adb_device_specification () { - local integer i=1 - foreach word ($words) - do - i=$(( ++i )) - case ${words[$i]} in - (-d|-e) - ADB_DEVICE_SPECIFICATION="${words[$i]}" - break - ;; - (-s) - ADB_DEVICE_SPECIFICATION="-s ${words[$i + 1]}" - break - ;; - (-*) - continue - ;; - (*) - break - ;; - esac - done + local -a word + word=($words[(R)-[des]]) + if [[ $words[(R)-s] == -s ]]; then + local i=$words[(I)-s] + word=($words[i,i+1]) + fi + ADB_DEVICE_SPECIFICATION=($word) } (( $+functions[_adb_dispatch_shell] )) || @@ -230,8 +214,10 @@ _adb_pm_list () { ;; (features) ;; + (users) + ;; (*) - _wanted pm_list_argument expl 'pm list argument' compadd packages permission-groups permissions instrumentation features + _wanted pm_list_argument expl 'pm list argument' compadd packages permission-groups permissions instrumentation features users ;; esac } @@ -319,16 +305,10 @@ _adb_package_manager_handler () { (( $+functions[_adb_dispatch_uninstall] )) || _adb_dispatch_uninstall () { - argcount=${#${(M)words#-*}} - if [[ $CURRENT -gt (( argcount + 2 )) ]] - then - _message -r "Notice: you can only uninstall one package at a time" - return - fi - _arguments \ '-k[keep data and cache]' \ - '*:installed package:_adb_installed_packages' + '--user[uninstall for user id]:user id:_adb_users' \ + '1:installed package:_adb_installed_packages' } (( $+functions[_adb_dispatch_install] )) || @@ -390,7 +370,7 @@ _adb_dispatch_connection_handling () { (( $+functions[_adb_check_log_redirect] )) || _adb_check_log_redirect () { - LOG_REDIRECT=${$(adb ${=ADB_DEVICE_SPECIFICATION} shell getprop log.redirect-stdio 2>/dev/null)// + LOG_REDIRECT=${$(adb ${ADB_DEVICE_SPECIFICATION} shell getprop log.redirect-stdio 2>/dev/null)// /} [[ ${LOG_REDIRECT[1,4]} == "true" ]] && _message -r "Notice: stdio log redirection enabled on the device, so some completions will not work" } @@ -414,18 +394,27 @@ _adb_trace_opts() { (( $+functions[_adb_device_serial] )) || _adb_device_serial() { local expl - _wanted dev_serial expl 'available devices' compadd $(command adb devices | sed -n 's/^\([^[:space:]]*\)\t.*$/\1/p') + local -a devices device_desc + local device + devices=( $(adb devices -l | sed -n 's/^\([^[:space:]]*\)[[:space:]]*.*product:\([^[:space:]]*\).*$/\1:\2/p') ) + zstyle -a :completion:${curcontext} device-names device_desc + for device in $device_desc; do + if [[ -n $devices[(r)${device%:*}:*] ]]; then + devices[(i)${device%:*}:*]=$device + fi + done + _describe -t dev_serial 'available devices' devices } (( $+functions[_adb_logcat_filter_specification] )) || _adb_logcat_filter_specification() { zstyle ":completion:${curcontext}:" cache-policy _adb_cache_policy_single_command - local cacheid=logcat_filter_cache_${$(adb ${=ADB_DEVICE_SPECIFICATION} get-serialno)} + local cacheid=logcat_filter_cache_${$(adb ${ADB_DEVICE_SPECIFICATION} get-serialno)} typeset -a logcat_filter_tags if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" then - logcat_filter_tags=( $(command adb ${=ADB_DEVICE_SPECIFICATION} logcat -d | sed -n 's#^[VDIWEF]/\([^[:space:](]*\).*#\1#p' |sort | uniq) ) + logcat_filter_tags=( $(command adb ${ADB_DEVICE_SPECIFICATION} logcat -d -v brief | sed -n 's#^[VDIWEF]/\([^[:space:](]*\).*#\1#p' |sort | uniq) ) _store_cache "$cacheid" logcat_filter_tags fi local expl @@ -466,7 +455,7 @@ _adb_shell_commands_handler() { (( $+functions[_adb_device_available] )) || _adb_device_available() { - [[ $(adb ${=ADB_DEVICE_SPECIFICATION} get-state 2>&1) == "device" ]] && return 0 + [[ $(adb ${ADB_DEVICE_SPECIFICATION} get-state 2>&1) == "device" ]] && return 0 return 1 } @@ -480,7 +469,7 @@ _adb_remote_folder () { pref=${pref%/*}/ fi # yes, this ls is sickening to look at, but android doesn't have printf or find - files=(${${(f)"$(adb ${=ADB_DEVICE_SPECIFICATION} shell 'ls -d 2> /dev/null '$pref'*/ '$pref'*')"}%$'\r'}) + files=(${${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} shell 'ls -1d 2> /dev/null '$pref'*/ '$pref'*')"}%$'\r'}) dirs=(${${(M)files:#*/}%/}) files=(${${files:|dirs}:#*\*(/|)}) _adb_device_available && \ @@ -495,17 +484,24 @@ _adb_installed_packages() { zstyle ":completion:${curcontext}:" cache-policy _adb_cache_policy_single_command fi - local cacheid=package_cache_${$(adb ${=ADB_DEVICE_SPECIFICATION} get-serialno)} + local cacheid=package_cache_${$(adb ${ADB_DEVICE_SPECIFICATION} get-serialno)} typeset -a installed_packages if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" then - installed_packages=(${$( adb ${=ADB_DEVICE_SPECIFICATION} shell pm list packages )//#package:/}) + installed_packages=(${$( adb ${ADB_DEVICE_SPECIFICATION} shell pm list packages )//#package:/}) _store_cache "$cacheid" installed_packages fi _wanted adb_installed_packages expl 'packages that are installed' compadd ${installed_packages} } +(( $+functions[_adb_users] )) || +_adb_users() { + local -a users + users=( ${${${(M)${(f)"$(adb shell pm list users)"}:#*UserInfo*}#*UserInfo\{}%:*} ) + _describe -t users 'users' users +} + (( $+functions[_adb_cache_policy_single_command] )) || _adb_cache_policy_single_command () { typeset -a old diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible new file mode 100644 index 000000000..f05dac8a6 --- /dev/null +++ b/Completion/Unix/Command/_ansible @@ -0,0 +1,281 @@ +#compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault + +local curcontext="$curcontext" plug plugvar ret=1 +local -a args state line +local -A opt_args + +case $service in + ansible|ansible-console|ansible-doc|ansible-playbook) + args=( + \*{-M+,--module-path=}'[specify path to modules]:module path:_dir_list' + ) + ;| + ansible|ansible-console|ansible-playbook|ansible-pull) + args+=( + '(-K --ask-become-pass)'{-K,--ask-become-pass}'[ask for privilege escalation password]' + '(-k --ask-pass)'{-k,--ask-pass}'[ask for connection password]' + '(-T --timeout)'{-T+,--timeout=}'[override the connection timeout]:timeout (seconds) [10]' + '(-c --connection)'{-c+,--connection=}'[specify connection type]:connection type [smart]:->connect-types' + '(-u --user)'{-u+,--user=}'[specify remote user for connection]:remote user:_users' + '--private-key=[specify file to use to authenticate the connection]:private key file:_files' + '--ssh-common-args=[specify common arguments to pass to sftp/scp/ssh]:ssh option' + '--sftp-extra-args=[specify extra arguments to pass to sftp]:sftp option' + '--scp-extra-args=[specify extra arguments to pass to scp]:scp option' + '--ssh-extra-args=[specify extra arguments to pass to ssh]:ssh option' + ) + ;| + ansible|ansible-console|ansible-playbook) + args+=( + '(-C --check)'{-C,--check}"[don't make any changes]" + '(-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)' + '--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' + ) + ;| + ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull|ansible-vault) + args+=( + '--ask-vault-pass[ask for vault password]' + '--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' + '--vault-id=[specify vault identity to use]:vault identity' + '--vault-password-file=[specify vault password file]:vault password file:_files' + ) + ;| + ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull) + args+=( + '--list-hosts[output list of matching hosts]' + '(-i --inventory)'{-i+,--inventory=}'[specify inventory host file]:inventory file:_files' + '!(-i --inventory)--inventory-file=:inventory file:_files' + '(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts' + ) + ;| + ansible|ansible-playbook|ansible-pull) + args+=( + '(-e --extra-vars)'{-e+,--extra-vars=}'[set additional variables]:key=value or YAML/JSON' + ) + ;| + ansible-playbook|ansible-pull) + args+=( + '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]' + "--skip-tags[only run plays and tasks whose tags don't match]" + ) + ;| + ansible|ansible-pull) + args+=( + '(-m --module-name)'{-m+,--module-name=}'[specify module]:module:->plugins' + ) + ;| + ansible) + args+=( + '(-a --args)'{-a+,--args=}'[specify command or module arguments]:arguments:->args' + '(-B --background)'{-B+,--background=}'[run asynchronously, failing after specified time]:fail timeout (seconds)' + '(-o --one-line)'{-o,--one-line}'[condense output]' + '(-P --poll)'{-P+,--poll=}'[specify the poll interval if using -B]:interval (seconds) [15]' + '(-t --tree)'{-t+,--tree=}'[specify directory for log output]:directory:_directories' + '--output[output file name for encrypt or decrypt; use - for stdout]:output file:_files' + ':host:->hosts' + ) + ;; + ansible-config) + args+=( + '(-c --config)'{-c+,--config=}'[specify configuration file]:config file:_files' + '1:action:(( + list\:list\ all\ configuration + dump\:show\ the\ current\ settings,\ merge\ specified\ configuration + view\:display\ the\ current\ config\ file + ))' + ) + [[ -n $words[(r)dump] ]] && args+=( '--only-changed[only show configuration that is changed from the default]' ) + ;; + ansible-console) + args+=( + '--step[one-step-at-a-time: confirm each task before running]' + ) + ;; + ansible-doc) + args+=( + '(-l --list)'{-l,--list}'[list available plugins]' + '(-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)' + '*:plugin:->plugins' + ) + ;; + ansible-inventory) + args+=( + '(-y --yaml)--graph[output inventory graph]' + '--host[output specific host information]' + '--list[output all hosts information]' + '(-y --yaml)--vars[add variables to the graph display]' + '(-y --yaml --vars --graph)'{-y,--yaml}'[use YAML format instead of JSON]' + ) + ;; + ansible-galaxy) + args+=( -A "-*" $args + '--list[list integrations]' + '(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]' + '(-s --server)'{-s+,--server=}'[specify API server destination]:server destination' + '--remove=[remove integration]:integration id' + '1:action:(delete import info init install list login remove search setup)' + '*::args:->galaxy' + ) + ;; + ansible-playbook) + args+=( + '--flush-cache[clear the fact cache]' + '--force-handlers[run handlers even if a task fails]' + '--list-tags[list all available tags]' + '--list-tasks[list all tasks that would be executed]' + '--start-at-task=[start the playbook at specified task]:task' + '--key-file=[specify file to use to authenticate the connection]:private key file:_files' + '*:playbook:_files -g "(#i)*.y(|a)ml"' + ) + ;; + ansible-pull) + args+=( + "--check[don't make any changes]" + '(-d --directory)'{-d+,--directory=}'[specify directory to checkout repository to]:directory:_directories' + '--full[do a full instead of a shallow clone]' + '--accept-host-key[adds the hostkey for the repo url if not already added]' + '--purge[purge checkout after playbook run]' + '(-f --force)'{-f,--force}'[run the playbook even if the repository could not be updated]' + '(-C --checkout)'{-C,--checkout}'[specify branch/tag/commit to checkout]:branch/tag/commit' + '--track-subs[submodules will track the latest changes]' + '(-o --only-if-changed)'{-o,--only-if-changed}'[only run the playbook if the repository has been updated]' + '(-s --sleep)'{-s+,--sleep=}'[delay for random duration before starting]:max delay (seconds)' + '(-U --url)'{-U+,--url=}'[specify URL of the playbook repository]:url:_urls' + '--verify-commit[verify GPG signature of checked out commit]' + '*:playbook:_files -g "(#i)*.y(|a)ml"' + ) + ;; + ansible-vault) + args=( -A "-*" $args + '*::args:->vault' + ) + ;; +esac + +_arguments -s -S -C $args \ + '(- :)--version[display version information]' \ + '(- :)'{-h,--help}'[display usage information]' \ + \*{-v,--verbose}"[verbose mode (repeat to increase)]" && ret=0 + +plug=${(v)opt_args[(i)-(t|-type)]:-module} +case $state in + args) + case ${(v)opt_args[(I)-(m|module)]} in + *) # shell, command or no module specified + _cmdstring && ret=0 + ;; + esac + ;; + hosts) + local alts + [[ -prefix - ]] && return ret + compset -P '*[,:](|[&!~])' + compset -S '[:,]*' + if compset -P '@'; then + _files && ret=0 + else + local -a inventory + typeset -ga _ansible_hosts _ansible_groups + if (( !$#_ansible_hosts || !$#_ansible_groups )); then + inventory=( ${(f)"$(_call_program groups ansible-inventory --graph)"} ) + _ansible_hosts=( ${${(M)inventory%--[^:]#}#--} ) + _ansible_groups=( ${${${(M)inventory%@*:}%:}#@} ) + fi + [[ $IPREFIX = *[:,] ]] && + alts=( 'operators:operator:_values -S "" operator "![exclude hosts]" "&[intersection of hosts]" "~[regular expression pattern]"' ) + _alternative $alts \ + 'groups:group:compadd -qS: -a _ansible_groups' \ + 'hosts:host:compadd -qS: -a _ansible_hosts' && ret=0 + fi + ;; + connect-types) + plug=connection + ;& + plugins) + plugvar=_ansible_${plug}_plugins + typeset -ga ${plug} + (( ${(P)#plugvar} )) || set -A ${plugvar} \ + ${${(f)"$(_call_program plugins ansible-doc -t $plug -l)"}/ ##/:} + _describe -t plugins "${plug} plugin" $plugvar && ret=0 + ;; + galaxy) + curcontext="${curcontext%:*}-${line[1]}:" + args=() + case $line[1] in + info|search|list|remove|install) + args=( '(-p --roles-path)'{-p,--roles-path}'[specify location of roles]:path:_directories' ) + ;| + info|init) + args+=( "--offline[don't query the galaxy API]" ) + ;| + init|install) + args+=( '(-f --force)'{-f,--force}'[force overwriting an existing role]' ) + ;| + search) + args+=( + '--author=[specify GitHub username]:username' + '--galaxy-tags=[specify list of galaxy tags to filter by]:galaxy tags' + '--platforms=[specify list of OS platforms to filter by]:platforms' + '*: :_guard "^-*" "search term"' + ) + ;; + setup) + args=( + '--list[list integrations]' + '--remove=[remove integration]:integration id' + ) + ;; + init) + args+=( + '--container-enabled[initialize the skeleton role with default contents for a Container Enabled role]' + '--init-path=[specify path in which the skeleton role will be created]:path:_directories' + '--role-skeleton=[specify path to a role skeleton that the new role should be based upon]' + ) + ;; + install) + args+=( + '(-n --no-deps)'{-n,--no-deps}"[don’t download roles listed as dependencies]" + '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors and continue with the next specified role]' + '(-r --role-file)'{-r+,--role-file=}'[specify file containing a list of roles to be imported]:file:_files' + ) + ;; + import) + args+=( + '--status[check the status of the most recent import request for given github_user/github_repo]' + "--no-wait[don’t wait for import results]" + '--branch=[specify branch to import]:branch' + '--role-name=[specify name the role should have]:role' + ) + ;; + login) + args+=( + '--github-token=[identify with github token rather than username and password]' + ) + ;; + esac + _arguments -s -S $args && ret=0 + ;; + vault) + curcontext="${curcontext%:*}-${line[1]}:" + args=() + case $line[1] in + (de|en)crypt*) args=( '--output=[specify output file name]:file:_files' ) ;| + encrypt_string) + args+=( + '(-p --prompt)'{-p,--prompt}'[prompt for the string to encrypt]' + '(-n --name)'{-n+,--name=}'[specify the variable name]:variable' + '--stdin-name=[specify the variable name for stdin]:variable' + ) + ;; + esac + _arguments -s -S $args && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_arp b/Completion/Unix/Command/_arp index 80e829022..5b047b2b8 100644 --- a/Completion/Unix/Command/_arp +++ b/Completion/Unix/Command/_arp @@ -2,7 +2,7 @@ local state line expl curcontext="$curcontext" ret=1 typeset -A opt_args -local -a cmds args +local -a cmds args vopt flags flags=( temp pub ) cmds=( diff --git a/Completion/Unix/Command/_arping b/Completion/Unix/Command/_arping index bd9bc8ccc..66ce7bc18 100644 --- a/Completion/Unix/Command/_arping +++ b/Completion/Unix/Command/_arping @@ -29,6 +29,7 @@ _arguments -s -S -A "-*" \ '-D[display answers as exclamation marks and missing packets as dots]' \ '-e[like -a but beep when there is no reply]' \ "-F[don't try to be smart about the interface name]" \ + '-g+[specify group to setgid() to]:group [nobody]:_groups' \ '-m+[specify type of timestamp for incoming packets]:timestamp type' \ '(:)-B[255.255.255.255]' \ '-0[source 0.0.0.0]' \ @@ -36,6 +37,7 @@ _arguments -s -S -A "-*" \ '-S+[set source IP]:source IP address:_hosts' \ '-T+[target IP]:target IP address:_hosts' \ '-p[turn on promiscuous mode]' \ + '-Q+[specify 802.1p priority to set]:priority [0]' \ '-s[set source MAC address]:source MAC address' \ '-t[set target MAC address]:target MAC address' \ '-c[send this many requests]:count' \ @@ -45,7 +47,8 @@ _arguments -s -S -A "-*" \ '-P[send ARP replies instead of requests]' \ '-u[show index=received/sent instead of just index=received when pinging MACs]' \ '-U[send unsolicited ARP]' \ - '-w+[specify time to wait between pings (ms)]:time (ms)' \ + '-V+[specify VLAN tag to set]:vlan' \ + '-w+[specify time to wait between pings (microseconds)]:time (microseconds)' \ '-W+[specify time to wait between pings (seconds)]:time (seconds)' \ '(-B):address:_hosts' diff --git a/Completion/Unix/Command/_attr b/Completion/Unix/Command/_attr index df1fb7da4..2030064dc 100644 --- a/Completion/Unix/Command/_attr +++ b/Completion/Unix/Command/_attr @@ -1,4 +1,4 @@ -#compdef attr getfattr setfattr +#compdef attr getfattr setfattr xattr case $service in attr) @@ -45,4 +45,23 @@ case $service in '*:file:_files' return ;; + # The Python xattr module ships with a utility called xattr which might appear + # on some systems; it is not entirely compatible with the Darwin variant, but + # does seem inspired by it, to the degree that this is probably close enough + xattr) + _arguments -s -S -A '-*' : \ + '(: -)'{-h,--help}'[display help information]' \ + '(-c -d -w)-l[display in long format]' \ + '-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]' \ + '*: :_files' \ + + '(op)' \ + '(-l -x)-c[remove all attributes]' \ + '(-l -x)-d[remove specified attribute]:attribute name' \ + '-p[display value of specified attribute]:attribute name' \ + '(-l -v)-w[set value of specified attribute]:attribute name: :attribute value' + return + ;; esac diff --git a/Completion/Unix/Command/_awk b/Completion/Unix/Command/_awk index 9050c2f7d..4063743e5 100644 --- a/Completion/Unix/Command/_awk +++ b/Completion/Unix/Command/_awk @@ -53,6 +53,7 @@ case $variant in '*'{-l+,--load}'[load dynamic extension]:extension:->extension' {-M,--bignum}'[select arbitrary-precision arithmetic on numbers]' {-o-,--pretty-print=-}'[pretty-print awk program]::output file:_files' + '(-s --no-optimize)'{-s,--no-optimize}'[disable default optimizations upon the internal program representation]' {-S,--sandbox}'[disable system(), redirections and dynamic extensions]' ) ;; diff --git a/Completion/Unix/Command/_cat b/Completion/Unix/Command/_cat index 46180f2c8..e383f8c6b 100644 --- a/Completion/Unix/Command/_cat +++ b/Completion/Unix/Command/_cat @@ -1,4 +1,4 @@ -#compdef cat +#compdef cat gcat local -a args diff --git a/Completion/Unix/Command/_chmod b/Completion/Unix/Command/_chmod index 85e6df1ae..af64b9eb9 100644 --- a/Completion/Unix/Command/_chmod +++ b/Completion/Unix/Command/_chmod @@ -3,7 +3,7 @@ local curcontext="$curcontext" state line expl ret=1 local -a args privs -args=( '*:file:->files' '1:mode:->mode' ) +args=( '*: :->files' '1: :_file_modes' ) if _pick_variant gnu=Free\ Soft unix --version; then args+=( @@ -45,35 +45,12 @@ else '(1)-I[removes all inherited entries from named files ACLs]' ) ;; - solaris*) privs=( 'l[mandatory locking]' ) ;; esac fi _arguments -C -s "$args[@]" && ret=0 case "$state" in - mode) - compset -P \*, - compset -S ,\* - if [[ -prefix [0-7] ]]; then - _message -e number 'numeric mode' - elif compset -P '[a-z]#[+-=]'; then - _values -S '' privilege \ - 'r[read]' 'w[write]' 'x[execute]' \ - 's[set uid/gid]' 't[sticky]' \ - 'X[execute only if directory or executable to another]' \ - "u[owner's current permissions]" \ - "g[group's current permissions]" \ - "o[other's current permissions]" \ - "$privs[@]" && ret=0 - else - suf=( -S '' ) - compset -P '*' - _alternative -O suf \ - 'who:who:((u\:user g\:group a\:all o\:others))' \ - 'operators:operator:(+ - =)' && ret=0 - fi - ;; files) if [[ -n $opt_args[--reference] ]]; then zmodload -F zsh/stat b:zstat 2>/dev/null diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown index 5750c65ab..c3abb5858 100644 --- a/Completion/Unix/Command/_chown +++ b/Completion/Unix/Command/_chown @@ -1,4 +1,4 @@ -#compdef chown chgrp zf_chown=chown zf_chgrp=chgrp +#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 diff --git a/Completion/Unix/Command/_cowsay b/Completion/Unix/Command/_cowsay index 19e73811c..8a1b4c4c9 100644 --- a/Completion/Unix/Command/_cowsay +++ b/Completion/Unix/Command/_cowsay @@ -3,26 +3,29 @@ local context state line typeset -A opt_args -_arguments \ - '-e:eye string:' \ - '-f:cowfile:->cowfile' \ - '-T:tongue string:' \ - '-W:wrap column:' \ - '-b[borg mode]' \ - '-d[dead mode]' \ - '-g[greedy mode]' \ - '-h[help]' \ - '-l[list]' \ - '-n[no wordwrap]' \ - '-p[paranoia mode]' \ - '-s[stoned mode]' \ - '-t[tired mode]' \ - '-w[wired mode]' \ - '-y[youthful mode]' \ - ':message:' && return 0 +_arguments -s -S -A "-*" \ + "(H mode)-e+[specify cow's eyes]:eye string [oo]" \ + '(H)-f+[specify cowfile]:cowfile:->cowfile' \ + "(H mode)-T+[specify cow's tongue]:tongue string" \ + '(H)-W+[specify width for message word wrap]:wrap column [40]' \ + '(H)-n[no wordwrap]' \ + '*:message' \ + + 'H' \ + '(- *)-h[display usage information]' \ + '(- *)-l[list all cowfiles]' \ + + '(mode)' \ + '(H -e -T)-b[borg mode]' \ + '(H -e -T)-d[dead mode]' \ + '(H -e -T)-g[greedy mode]' \ + '(H -e -T)-p[paranoia mode]' \ + '(H -e -T)-s[stoned mode]' \ + '(H -e -T)-t[tired mode]' \ + '(H -e -T)-w[wired mode]' \ + '(H -e -T)-y[youthful mode]' && return case "$state" in (cowfile) - compadd ${=${(f)"$($service -l 2>/dev/null)"}:#*\:} || _files + _wanted -C option-f-1 cowfiles expl 'cow file' compadd \ + ${=${(f)"$(_call_program cowfiles $words[1] -l)"}:#*\:} || _files -g "*.cow(-.)" ;; esac diff --git a/Completion/Unix/Command/_cp b/Completion/Unix/Command/_cp index 5c3f37983..88750b330 100644 --- a/Completion/Unix/Command/_cp +++ b/Completion/Unix/Command/_cp @@ -55,7 +55,7 @@ else 'netbsd*' "-N[don't copy file flags]" \ '(darwin|dragonfly|freebsd|netbsd)*' '-a[archive mode, same as -RpP]' \ '(dragonfly|freebsd)*' '-l[link files instead of copying]' \ - '(darwin|dragonfly|freebsd|netbsd)*' '-v[show file names as they are copied]' \ + '(darwin|dragonfly|*bsd)*' '-v[show file names as they are copied]' \ 'darwin*' "-X[don't copy extended attributes or resource forks]" \ '(dragonfly|freebsd)*' "-x[don't traverse file systems]" \ 'freebsd<10->.*' '-s[make symbolic links instead of copies of non-directories]' diff --git a/Completion/Unix/Command/_cut b/Completion/Unix/Command/_cut index caf8f32b7..d3b1e2b10 100644 --- a/Completion/Unix/Command/_cut +++ b/Completion/Unix/Command/_cut @@ -1,4 +1,4 @@ -#compdef cut +#compdef cut gcut typeset -A _cut_args diff --git a/Completion/Unix/Command/_cvs b/Completion/Unix/Command/_cvs index 0552d2175..cba3eb773 100644 --- a/Completion/Unix/Command/_cvs +++ b/Completion/Unix/Command/_cvs @@ -882,7 +882,7 @@ _cvs_modified_entries() { } (( $+_cvs_ignore_default )) || -_cvs_ignore_default=( +local _cvs_ignore_default=( RCS SCCS CVS CVS.adm RCSLOG 'cvslog.*' tags TAGS .make.state .nse_depinfo '*\~' '\#*' '.\#*' ',*' '_$*' '*$' '*.old' '*.bak' '*.BAK' '*.orig' '*.rej' '.del-*' '*.a' '*.olb' '*.o' '*.obj' '*.so' '*.exe' '*.Z' '*.elc' '*.ln' diff --git a/Completion/Unix/Command/_dconf b/Completion/Unix/Command/_dconf new file mode 100644 index 000000000..bfb314c72 --- /dev/null +++ b/Completion/Unix/Command/_dconf @@ -0,0 +1,71 @@ +#compdef dconf + +local curcontext="$curcontext" state line cmds ret=1 +local cmd=$words[1] + +cmds=( + 'help:display help information' + 'read:read the value of a key' + 'list:list the contents of a directory' + 'write:change the value of a key' + 'reset:reset the value of a key or directory' + 'compile:compile a binary database from keyfiles' + 'update:update the system databases' + 'watch:watch a path for changes' + 'dump:dump an entire subpath to stdout' + 'load:populate a subpath from stdin' +) + +if (( CURRENT == 2 )); then + _describe -t commands command cmds + return +fi + +curcontext="${curcontext%:*}-$words[2]:" +shift words +(( CURRENT-- )) + +case $words[1] in + dump|list|load) state=dirs ;; + watch) state=keys ;; + read) + _arguments -A "-*" '-d[read default values]' '1:key:->keys' && ret=0 + ;; + write) + _arguments '1:key:->keys' '2:value' && ret=0 + ;; + reset) + _arguments -A "-*" '-f[reset entire directory]' '1:key:->keys' && ret=0 + [[ $+opt_args[-f] = 1 && state = keys ]] && state=dirs + ;; + compile) + _arguments '1:file:_files' '2:path:_directories' && ret=0 + ;; + help) + _describe -t commands command cmds && ret=0 + ;; + *) _default && ret=0 ;; +esac + +case $state in + keys) + compset -P '*/' + dirs=( ${${${(f)"$(_call_program keys dconf _complete \'\' "${IPREFIX:-/}")"}#$IPREFIX}%% #} ) + _tags keys + while _tags; do + if _requested keys; then + _description keys expl keu + compadd "$expl[@]" -qS ' ' ${dirs:#*/} && ret=0 + compadd "$expl[@]" -S '' ${(M)dirs:#*/} && ret=0 + fi + (( ret )) || break + done + ;; + dirs) + compset -P '*/' + _wanted keys expl directory compadd -S '' - \ + ${${(f)"$(_call_program keys dconf _complete / "${IPREFIX:-/}")"}#$IPREFIX} && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_dd b/Completion/Unix/Command/_dd index 1a2ae871a..e51337f21 100644 --- a/Completion/Unix/Command/_dd +++ b/Completion/Unix/Command/_dd @@ -1,4 +1,4 @@ -#compdef dd +#compdef dd gdd _values -w 'option' \ 'if[specify input file]:input file:_tilde_files' \ diff --git a/Completion/Unix/Command/_devtodo b/Completion/Unix/Command/_devtodo index 2380399b9..8363495cd 100644 --- a/Completion/Unix/Command/_devtodo +++ b/Completion/Unix/Command/_devtodo @@ -5,7 +5,7 @@ typeset -a arg_generic arg_add todo_opts \ priorities typeset -A arg_pair arg_desc typeset -i i -typeset expl +typeset expl arg for ((i=2; i <= $#words; i++)) { if [[ $words[$i] == '--database' ]]; then diff --git a/Completion/Unix/Command/_df b/Completion/Unix/Command/_df index d20ddea7e..2586f4358 100644 --- a/Completion/Unix/Command/_df +++ b/Completion/Unix/Command/_df @@ -1,4 +1,4 @@ -#compdef df +#compdef df gdf local curcontext="$curcontext" state state_descr line args spec ret=1 local -A opt_args @@ -8,12 +8,15 @@ if _pick_variant gnu=GNU unix --version; then '--total[produce a grand total]' '(-T --print-type)'{-T,--print-type}'[print file system type]' '(-a --all)'{-a,--all}'[include dummy file systems]' + '--direct[show statistics for a file instead of mount point]' '(-l --local)'{-l,--local}'[limit listing to local file systems]' '*'{-t+,--type=}'[limit listing to file systems of specified type]:file system type:_file_systems' '*'{-x+,--exclude-type=}'[exclude file systems of specified type]:file system type:_file_systems' '(--no-sync)--sync[invoke sync before getting usage info]' '(--sync)--no-sync[do not invoke sync before getting usage info (default)]' - '-v[(ignored)]' + '--output=-[output all or specified fields]::field:_values -s , "field" + source fstype itotal iused iavail ipcent size used avail pcent file target' + '!-v' '(- : *)--help[display help and exit]' '(- : *)--version[output version information and exit]' '*:files:_umountable' diff --git a/Completion/Unix/Command/_dhclient b/Completion/Unix/Command/_dhclient index 10cb551e0..b5889df21 100644 --- a/Completion/Unix/Command/_dhclient +++ b/Completion/Unix/Command/_dhclient @@ -7,19 +7,20 @@ case $OSTYPE in args+=( '-c+[specify configuration file]:file:_files' '-l+[specify leases file]:file:_files' - '-u[reject leases with unknown options]' ) ;| freebsd*) args+=( '(-d)-b[immediately move to the background]' '-p+[specify PID file]:file:_files' + '-u[reject leases with unknown options]' ) ;; openbsd*) args+=( '-i+[ignore values provided by leases for specified options]:options' '-L+[specify file to write option data too]:file:_files' + "-n[don't configure any interfaces]" ) ;; *) # ISC implementation, used on Linux and NetBSD @@ -60,6 +61,7 @@ case $OSTYPE in '-V[specify vendor-class-identifier option]:option' '--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)' ) ;; esac diff --git a/Completion/Unix/Command/_dig b/Completion/Unix/Command/_dig index a4e175808..5feb71fef 100644 --- a/Completion/Unix/Command/_dig +++ b/Completion/Unix/Command/_dig @@ -1,14 +1,5 @@ #compdef dig -_dns_types() { - local expl - _description dns-types expl 'DNS type' - compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z}' \ - ANY A AAAA AFSDB APL AXFR CAA CDNSKEY CDS CERT CNAME DHCID DLV DNAME \ - DNSKEY DS HIP HINFO IPSECKEY IXFR KEY KX LOC MX NAPTR NS NSEC NSEC3 \ - NSEC3PARAM OPT PTR RRSIG RP SIG SOA SPF SRV SSHFP TA TKEY TLSA TSIG TXT -} - local curcontext="$curcontext" state line expl local -a alts args [[ -prefix + ]] && args=( @@ -66,7 +57,7 @@ local -a alts args '*+'{no,}'besteffort[try to parse even malformed messages]' '*+'{no,}'dnssec[request DNSSEC records]' '*+'{no,}'sigchase[chase DNSSEC signature chains]' - '*+trusted-key=[specify file conrtaing trusted kets]:file:_files' + '*+trusted-key=[specify file containing trusted keys]:file:_files' '*+'{no,}'topdown[do DNSSEC validation in top down mode]' '*+'{no,}'nsid[include EDNS name server ID request in query]' '*+'{no,}'ttlid[display the TTL whening printing the record]' diff --git a/Completion/Unix/Command/_drill b/Completion/Unix/Command/_drill new file mode 100644 index 000000000..68fa7917b --- /dev/null +++ b/Completion/Unix/Command/_drill @@ -0,0 +1,46 @@ +#compdef drill + +local curcontext="$curcontext" ret=1 +local -a state line expl + +_arguments -s -S -C \ + '-D[enable DNSSEC (DO bit)]' \ + '-T[trace from the root down]' \ + '-S[chase signature(s) to a known key]' \ + '-I[specify source address to query from]:source address' \ + '(-Q)-V+[specify verbosity]:number (0-5)' \ + '(-V)-Q[quiet mode (overrules -V)]' \ + '-f+[read packet from file and send it]:file:_files' \ + '-i+[read packet from file and print it]:file:_files' \ + '-w+[write answer packet to file]:file:_files' \ + '-q+[write query packet to file]:file:_files' \ + '(- *)-h[display usage information]' \ + '(- *)-v[display version information]' \ + '(-6)-4[stay on ipv4]' \ + '(-4)-6[stay on ipv6]' \ + '-a[fallback to EDNS0 and TCP if the answer is truncated]' \ + '-b+[specify buffer size (defaults to 512 b)]:size (bytes) [512]' \ + '-c+[use specified file for rescursive nameserver configuration]:file [/etc/resolv.conf]:_files' \ + '-k+[specify a file that contains a trusted DNSSEC key]:file:_files' \ + '*-o+[set/unset header bits]:mnemonic (uppercase sets, lower unsets):_sequence compadd - QR qr AA aa TC tc RD rd CD cd RA ra AD ad' \ + '-p+[use specified remote port number]:port:_ports' \ + '-s[show the DS RR for each key in a packet]' \ + '-x[do a reverse lookup]' \ + '-r+[use specified file as root servers hint file]:file:_files' \ + '-t[send the query with tcp]' '!(-t)-u' \ + '-d+[use specified domain as the start point for the trace]:domain' \ + '-y+[specify named base64 tsig key, and optional algorithm]:name\:key\:algorithm [hmac-md5.sig-alg.reg.int]' \ + "-z[don't randomize the nameservers before use]" \ + '*:args:->args' && ret=0 + +if [[ -n $state ]]; then + if compset -P @; then + _wanted hosts expl 'DNS server' _hosts && ret=0; + else + _alternative 'hosts:host:_hosts' \ + 'types:query type:_dns_types' \ + 'classes:query class:compadd -M "m:{a-z}={A-Z}" - IN CS CH HS' && ret=0 + fi +fi + +return ret diff --git a/Completion/Unix/Command/_enscript b/Completion/Unix/Command/_enscript index d10acb25f..3e09da5a4 100644 --- a/Completion/Unix/Command/_enscript +++ b/Completion/Unix/Command/_enscript @@ -1,9 +1,10 @@ #compdef enscript -local state context line curcontext="$curcontext" match +local curcontext="$curcontext" state line match typeset -A opt_args +local -a libpath -_arguments -C -s \ +_arguments -C -s -S \ '( -2 --columns)-1' \ '(-1 --columns)-2' \ '(-1 -2 )--columns=:columns:' \ @@ -11,14 +12,11 @@ _arguments -C -s \ '(-a)--pages=:pages:(even odd)' \ '(--file-align)-A+:align:' \ '(-A)--file-align=:align:' \ - '(--header)-b+:page header:' \ - '(-b)--header=:page header:' \ - '(--no-header)-B' \ - '(-B)--no-header' \ + '(--header -b -B --no-header --lineprinter -l)'{-b+,--header=}':page header:->formats' \ + '(--header -b -B --no-header --lineprinter -l)'{-B,--no-header} \ '(--truncate-lines)-c' \ '(-c)--truncate-lines' \ - '(--line-numbers)-C-:start line:' \ - '(-C)--line-numbers=-:start line:' \ + '(--line-numbers -C)'{-C-,--line-numbers=-}'::start line [1]' \ '(--printer -d )-P+:printer name: _printers' \ '(--printer -P)-d+:printer name: _printers' \ '( -d -P)--printer=:printer name: _printers' \ @@ -26,34 +24,24 @@ _arguments -C -s \ '*--setpagedevice=:key\:value:' \ '(--escapes)-e-:escape character:' \ '(-e)--escapes=-:escape character:' \ - '(--pretty-print)-E-:input language:->inputlang' \ - '(-E)--pretty-print=-:input language:->inputlang' \ - '(--font)-f+:fontname:' \ - '(-f)--font=:fontname:' \ - '(--header-font)-F+:fontname:' \ - '(-F)--header-font=:fontname:' \ + '(-E --highlight)'{-E-,--highlight=-}':input language:->inputlang' \ + '(--font -f)'{-f+,--font=}':fontname:->fonts' \ + '(--header-font -F)'{-F+,--header-font=}':fontname:->fonts' \ '(--print-anyway)-g' \ '(-g)--print-anyway' \ '(--fancy-header)-G' \ - '(-G)--fancy-header=-:name:' \ + '(-G)--fancy-header=:header:->headers' \ '(--no-job-header)-h' \ '(-h)--no-job-header' \ - '(--highlight-bars)-H-:lines:' \ - '(-H)--highlight-bars=-:lines:' \ - '(--indent)-i+:indent length:' \ - '(-i)--indent=:indent length:' \ - '(--filter)-I+:input filter:->commandline' \ - '(-I)--filter=:input filter:->commandline' \ + '(--highlight-bars -H)'{-H-,--highlight-bars=-}'::height (lines) [2]' \ + '(--indent -i)'{-i+,--indent=}':indent width' \ + '(--filter -I)'{-I+,--filter=}':input filter:_cmdstring' \ '(--borders)-j' \ '(-j)--borders' \ - '(--page-prefeed)-k' \ - '(-k)--page-prefeed' \ - '(--no-page-prefeed)-K' \ - '(-K)--no-page-prefeed' \ - '(--lineprinter)-l' \ - '(-l)--lineprinter' \ - '(--lines-per-page)-L+:lines per page:' \ - '(-L)--lines-per-page=:lines per page:' \ + '(-k --page-prefeed -K --no-page-prefeed)'{-k,--page-prefeed} \ + '!(-k --page-prefeed -K --no-page-prefeed)'{-K,--no-page-prefeed} \ + '(--lineprinter -l --lines-per-page -L --header -b -B --no-header)'{-l,--lineprinter} \ + '(--lines-per-page -L --lineprinter -l)'{-L+,--lines-per-page=}':lines per page' \ '(--mail)-m' \ '(-m)--mail' \ '(--media)-M+:media name:(A4)' \ @@ -63,37 +51,30 @@ _arguments -C -s \ '( -n -#)--copies=:number of copies:' \ '(--newline)-N+:newline type:((n\:unix r\:mac))' \ '(-N)--newline=:newline type:((n\:unix r\:mac))' \ - '(--output -p )-o+:output file:' \ - '(--output -o)-p+:output file:_files' \ - '( -p -o)--output=:output file:_files' \ + '(-o -p --output -p)'{-o+,-p+,--output=}':output file:_files' \ '(--missing-characters)-O' \ '(-O)--missing-characters' \ '(--quiet --silent)-q' \ '(-q --silent)--quiet' \ '(-q --quiet)--silent' \ - '(--landscape)-r' \ - '(-r)--landscape' \ - '(--portrait)-R' \ - '(-R)--portrait' \ - '(--baselineskip)-s+:baseline skip:' \ - '(-s)--baselineskip=:baseline skip:' \ + '(-r --landscape -R --portrait)'{-r,--landscape} \ + '(-r --landscape -R --portrait)'{-R,--portrait} \ + '(--baselineskip -s)'{-s+,--baselineskip=}':baseline skip (PostScript points) [1]' \ '*-S+:key\:value:' \ '*--statusdict=:key\:value:' \ '(--title -t )-J+:banner title:' \ '(--title -J)-t+:banner title:' \ '( -t -J)--title=:banner title:' \ - '(--tabsize)-T+:tabsize:(8)' \ - '(-T)--tabsize=:tabsize:(8)' \ + '(--tabsize -T)'{-T+,--tabsize=}':tabsize [8]' \ '(--underlay)-u-:underlay text:' \ '(-u)--underlay=-:underlay text:' \ '(--nup)-U+:pages:(4)' \ '(-U)--nup=:pages:(4)' \ '(--verbose)-v' \ '(-v)--verbose=-:level:' \ - '(--version)-V' \ - '(-V)--version' \ - '(--language)-W+:output language:(PostScript html overstrike rtf)' \ - '(-W)--language=:output language:(PostScript html overstrike rtf)' \ + '(- *)'{-V,--version} \ + '(-w --language)'{-w-,--language=}':output language:(PostScript html overstrike rtf)' \ + '(-W --option)'{-W-,--option=}':helper option' \ '(--encoding)-X+:character encoding:(88591 latin1 88592 latin2 88593 latin3 88594 latin4 88595 cyrillic 88597 greek 88599 latin5 885910 latin6 ascii asciifise asciifi asciise asciidkno asciidk asciino ibmpc pc dos mac vms hp8 koi8 ps PS pslatin1 ISOLatin1Encoding)' \ '(-X)--encoding=:character encoding:(88591 latin1 88592 latin2 88593 latin3 88594 latin4 88595 cyrillic 88597 greek 88599 latin5 885910 latin6 ascii asciifise asciifi asciise asciidkno asciidk asciino ibmpc pc dos mac vms hp8 koi8 ps PS pslatin1 ISOLatin1Encoding)' \ '(--no-formfeed)-z' \ @@ -101,47 +82,111 @@ _arguments -C -s \ '(--pass-through)-Z' \ '(-Z)--pass-through' \ '--color=-:use color:(false true)' \ + '--continuous-page-numbers' \ '--download-font=:fontname:' \ + '--extended-return-values' \ '--filter-stdin=:stdin name:(-)' \ + '--footer=:page footer:->formats' \ '--h-column-height=:horizontal column height:' \ - '--help' \ - '--help-pretty-print' \ - '--highlight-bar-gray=:gray level:' \ + '(- *)--help' \ + '(- *)--help-highlight' \ + '--highlight-bar-gray=:gray level (0-1):' \ '--list-media' \ - '--list-options' \ '--margins=:left\:right\:top\:bottom:' \ - '--mark-wrapped-lines=-:wrapped line style:(none plus box arrow)' \ - '--non-printable-format=:format to visualze non printable characters:(caret octal questionmark space)' \ - '--nup-xpad=:x-padding:(10)' \ - '--nup-ypad=:y-padding:(10)' \ + '--mark-wrapped-lines=-:wrapped line style [none]:(none plus box arrow)' \ + '--non-printable-format=:rendering of non-printable characters:(caret octal questionmark space)' \ + '--nup-columnwise' \ + '--nup-xpad=:x-padding [10]' \ + '--nup-ypad=:y-padding [10]' \ '--page-label-format=:page label format:(short long)' \ '--ps-level=:PostScript language level:(1 2)' \ '--printer-options=:extra options:' \ '--rotate-even-pages' \ - '--slice=:virtical slice number:' \ - '--style=:highlighting style:' \ + '--slice=:vertical slice number' \ + '--style=:highlighting style:(a2ps emacs emacs_verbose ifh msvc)' \ + '--swap-even-page-margins' \ '--toc' \ '--word-wrap' \ - '--ul-angle=:underlay text'\''s angle:(45)' \ - '--ul-font=:underlay text'\''s fontname:(Times-Roman200)' \ - '--ul-gray=:underlay text'\''s gray level:(.8)' \ - '--ul-position=:underlay text'\''s position:(+0+0 -0-0)' \ - '--ul-style=:underlay text'\''s style:(outline filled)' \ + '--ul-angle=:angle' \ + '--ul-font=:fontname [Times-Roman200]:->fonts' \ + '--ul-gray=:gray level (0..1) [.8]' \ + '--ul-position=:position [+0+0 -0-0]' \ + '--ul-style=:style [outline]:(outline filled)' \ '*:filename:_files' && return 0 case "$state" in -commandline) - compset -q - _normal + fonts) + if compset -P 1 '*@'; then + _message -e size 'pointsize, optionally width/height' + else + libpath=( {${commands[enscript]:h:h},/usr}/share/enscript/afm/font.map(N) ) + _wanted fonts expl font compadd -qS @ - ${${(f)"$(<$libpath[1])"}%% *} + fi ;; - -inputlang) - if (( ! $+_enscript_input_languages )); then - _enscript_input_languages=(${${(f)${(F)${(M)${(f)"$(enscript --help-pretty-print)"}:#(Name|Description):*}}//(#b)Name: ([^ + formats) + local -a specs + local suf='{' + compquote suf + if [[ ${PREFIX} = *[%$]D${suf}[^}]# ]]; then + _strftime + elif [[ ${(Q)PREFIX} = *\$\([^\)]# ]]; then + compset -P '*\(' + _parameters -g '*export*' -S '\)' + elif [[ ${(Q)PREFIX} = *\$ ]]; then + specs=( + '$:a dollar symbol' + '%:current page number' + '=:number of pages in the current file' + 'p:number of pages processed so far' + {C,\*}':file modification time (hh:mm:ss)' + 'n:basename of the input file name' + 'N:full input file name' + 'E:file modification date (yy/mm/dd)' + 'F:file modification date (dd.mm.yyyy)' + 't:file modification time (12-hour)' + 'T:file modification time (24-hour)' + 'v:sequence number of current input file' + 'V:sequence number of current input file in table of contents format' + 'W:file modification date (mm/dd/yy)' + '\(:environment variable' + ) + compset -P "*" + _describe -t format-specifiers 'format specifier' specs -S '' -- '( D:modification\ date )' -qS $suf + elif [[ ${(Q)PREFIX} = *% ]]; then + specs=( + 'c:trailing component of the current working directory' + {C,\*}':current time (hh:mm:ss)' + 'E:current date (yy/mm/dd)' + 'F:current date (dd.mm.yyyy)' + 'H:document title' + 'L:lines in the input file' + 'm:hostname in short form' + 'M:hostname in fully qualified form' + 'n:user login name' + 'N:user gecos field first component' + 't:current time (12-hour)' + 'T:current time (24-hour)' + 'W:current date (mm/dd/yy)' + ) + compset -P "*" + _describe -t format-specifiers 'format specifier' specs -S '' -- '( D:current\ time )' -qS $suf + else + compset -P "*" + _wanted format-specifiers expl 'format specifier' compadd -S '' % \$ + fi + ;; + headers) + libpath=( {${commands[enscript]:h:h},/usr}/share/enscript(N/) ~/.enscript(N/) ) + _wanted headers expl header compadd $^libpath/*.hdr(N:r:t) + ;; + inputlang) + if (( ! $+_cache_enscript_languages )); then + typeset -ga _cache_enscript_languages + _cache_enscript_languages=(${${(f)${(F)${(M)${(f)"$(_call_program languages enscript --help-pretty-print)"}:#(Name|Description):*}}//(#b)Name: ([^ ]##)( Description: ([^ ]##)|)/$match[1]:$match[3]}%:}) - fi - _describe 'input language' _enscript_input_languages -- + fi + _describe -t languages 'input language' _cache_enscript_languages ;; esac diff --git a/Completion/Unix/Command/_entr b/Completion/Unix/Command/_entr index 8a830ae71..a8d43fc5e 100644 --- a/Completion/Unix/Command/_entr +++ b/Completion/Unix/Command/_entr @@ -1,9 +1,23 @@ #compdef entr +local curcontext="$curcontext" state state_descr line ret=1 +typeset -A opt_args + _arguments -s -S \ '-c[execute clear before invoking utility]' \ '-d[track directories and exit if a new file is added]' \ '-p[postpone first execution of the utility]' \ '-r[reload a persistent child process]' \ - '(-):command name:_command_names -e' \ - '*::arguments:_normal' + '(*)-s[evaluate the first argument using interpreter specified by $SHELL]' \ + '(-): :->command' \ + '*::arguments:_normal' && ret=0 + +if [[ -n $state ]]; then + if (( $+opt_args[-s] )); then + _cmdstring && ret=0 + else + _command_names -e && ret=0 + fi +fi + +return ret diff --git a/Completion/Unix/Command/_env b/Completion/Unix/Command/_env index 9b2a1e011..96e96bd7b 100644 --- a/Completion/Unix/Command/_env +++ b/Completion/Unix/Command/_env @@ -1,4 +1,4 @@ -#compdef env +#compdef env genv local context state line variant args ret=1 @@ -7,7 +7,8 @@ case $variant in gnu) args=( '(-)'{-i,--ignore-environment}'[start with empty environment]' - '(--ignore-environment -i --help --version)*'{-u,--unset=}'[remove variable from the environment]:env var to remove:_parameters -g "*export*"' + '(--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' '(- *)--help[display help information]' '(- *)--version[display version information]' ) diff --git a/Completion/Unix/Command/_ffmpeg b/Completion/Unix/Command/_ffmpeg index d68a094d4..c0b229f35 100644 --- a/Completion/Unix/Command/_ffmpeg +++ b/Completion/Unix/Command/_ffmpeg @@ -100,7 +100,7 @@ typeset -A _ffmpeg_flags local -a _ffmpeg_argspecs { - local lastopt + local lastopt REPLY local lastopt_description local lastopt_takesargs local lastopt_type diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find index 3854d6cce..edd46ac1c 100644 --- a/Completion/Unix/Command/_find +++ b/Completion/Unix/Command/_find @@ -139,7 +139,7 @@ _arguments -C $args \ '*-nogroup' \ '*-nouser' \ '*-ok:program: _command_names -e:*\;::program arguments: _normal' \ - '*-perm:file permission bits' \ + '*-perm: :_file_modes' \ '*-print' \ '*-prune' \ '*-size:file size (blocks)' \ diff --git a/Completion/Unix/Command/_flac b/Completion/Unix/Command/_flac new file mode 100644 index 000000000..82b6f0160 --- /dev/null +++ b/Completion/Unix/Command/_flac @@ -0,0 +1,120 @@ +#compdef flac metaflac + +local shortops common shared blocktypes level + +shortops=( + --show-md5sum + --show-min-blocksize + --show-max-blocksize + --show-min-framesize + --show-max-framesize + --show-sample-rate + --show-channels + --show-bps + --show-total-samples + --show-vendor-tag + '--show-tag=:FLAC tag' + '--remove-tag=:FLAC tag' + '--remove-first-tag=:FLAC tag' + --remove-all-tags + '*--set-tag=:FLAC tag and value: ' + '*--set-tag-from-file=:tag' + '--import-tags-from=:flat file:_files' + '--export-tags-to=:new file: ' + '--import-cuesheet-from=:file:_files' + '--export-cuesheet-to=:new file:_files' + '--import-picture-from=:file or specification:_files' + '--export-picture-to=:file:_files' + --scan-replay-gain + --remove-replay-gain + --add-replay-gain + '*--add-seekpoint=:seek point' + '--add-padding=:length (bytes)' +) + +blocktypes=( STREAMINFO PADDING APPLICATION SEEKTABLE VORBIS_COMMENT PICTURE ) +common=( + '--block-number=:block number' + '(--except-block-type)--block-type=:block type:_sequence compadd - $blocktypes' + '(--block-type)--except-block-type=:block type:_sequence compadd - $blocktypes' +) +shared=( + '--no-utf8-convert' + '--preserve-modtime' +) +level=( -{,-compression-level-}{0,1,2,3,4,5,6,7,8} --best --fast ) + +case $service in + flac) + _arguments -s -S $shared \ + '(H -c --stdout)'{-c,--stdout}'[write output to stdout]' \ + '(H -s --silent --totally-silent)'{-s,--silent}"[don't output runtime statistics]" \ + '(H)--totally-silent' \ + '(H -w --warnings-as-errors)'{-w,--warnings-as-errors}'[treat all warnings as errors]' \ + '(H -f --force)'{-f,--force}'[overwrite output files]' \ + '(H -o --output-name -c --stdout)'{-o,--output-name=}'[specify output file name]' \ + '(H)--output-prefix=[prepend specified string to output file names]' \ + '(H)--delete-input-file' \ + '(H)--keep-foreign-metadata' \ + '(H)--skip=[skip initial samples from each input]:skip (mm:ss.ss)' \ + '(H)--until=[stop at specified sample for each input]:stop (+-mm:ss.ss)' \ + '(H)--ogg[use ogg as a transport layer]' \ + '(H)--serial-number=[serial number to use for the FLAC stream]:serial number' \ + '(H --force-aiff-format --force-rf64-format --force-wave64-format)--format-raw-format' \ + '*:file:_files -F line -g "(#i)*.(${${opt_args[(i)decode-*]:+flac|oga}:-wav|aif|aiff|raw|rf64|w64})(-.)"' \ + - 'H' \ + '(-)'{-v,--version}'[display version information]' \ + '(-)'{-h,--help}'[display help information]' \ + '(-)'{-H,--explain}'[display detailed explanation of usage and options]' \ + - encode \ + '(-V --verify)'{-V,--verify}'[verify a correct encoding]' \ + --lax --ignore-chunk-sizes '!--sector-align' --replay-gain \ + '--cuesheet=:file:_files' \ + '--picture=:specification:' \ + \*{-T,--tag}'[add a FLAC tag]:field=value' \ + '--tag-from-file=:field=file' \ + \*{-S,--seekpoint=}':seek point' \ + '(-P --padding)'{-P,--padding=}'[add space for metadata]:length (bytes)' \ + "($level[*])"$^level \ + '(-b --blocksize)'{-b,--blocksize=}'[specify block size in samples]:size:(192 576 1152 2304 4608 256 512 1024 2048 4096 8192 16384)' \ + '(-m --mid-side -M --adaptive-mid-side)'{-m,--mid-side}'[try mid-side coding for each frame]' \ + '(-m --mid-side -M --adaptive-mid-side)'{-M,--adaptive-mid-side}'[adaptive mid-side coding for all frames]' \ + '(-e --exhaustive-model-search)'{-e,--exhaustive-model-search}'[do exhaustive model search]' \ + \*{-A,--apodization=}'[window audio data with given the function]:function:(bartlett bartlett_hann blackman blackman_harris_4term_92dbconnes flattop gauss hamming hann kaiser_bessel nuttall rectangle triangle tukey welch)' \ + '(-l --max-lpc-order)'{-l,--max-lpc-order=}'[specify max LPC order]:order' \ + '(-p --qlp-coeff-precision-search -q --qlp-coeff-precision)'{-p,--qlp-coeff-precision-search}'[exhaustively search LP coeff quantization]' \ + '(-p --qlp-coeff-precision-search -q --qlp-coeff-precision)'{-q,--qlp-coeff-precision=}'[specify precision]:precision (bits)' \ + '(-r --rice-partition-order)'{-r,--rice-partition-order=}'[set min/max residual partition order]:order' \ + '--endian=:byte order:(big little)' \ + '--channels=:channels' \ + '--bps=:bits per sample' \ + '--sample-rate=:sample rate (Hz)' \ + '--sign=:sign of samples [signed]:(signed unsigned)' \ + '--input-size=:size (bytes)' \ + - decode \ + '(-d --decode -t --test -a --analyze)'{-d,--decode}'[decode a FLAC encoded file]' \ + '(-d --decode -t --test -a --analyze --delete-input-file)'{-t,--test}'[test a FLAC encoded file]' \ + '(-d --decode -t --test -a --analyze --delete-input-file)'{-a,--analyze}'[analyze a FLAC encoded file]' \ + '(-d --decode -t --test)'{--residual-text,--residual-gnuplot} \ + '(-F --decode-through-errors)'{-F,--decode-through-errors}'[continue decoding through stream errors]' \ + '--apply-replaygain-which-is-not-lossless=:specification' \ + '--cue=[set the beginning and ending cuepoints to decode]:cue point' \ + '(--force-raw-format --force-rf64-format --force-wave64-format)--force-aiff-format' \ + '(--force-raw-format --force-aiff-format --force-wave64-format)--force-rf64-format' \ + '(--force-raw-format --force-aiff-format --force-rf64-format)--force-wave64-format' \ + ;; + metaflac) + _arguments -S $shared \ + '(--no-filename)--with-filename[prefix output with filename]' \ + '(--with-filename)--no-filename' \ + '--dont-use-padding[always rewrite the file]' \ + "*:FLAC file:_files -g \*.flac\(-.\)" \ + - 'short' $shortops \ + - 'list' $common --list \ + '--application-data-format=:format:(text hexdump)' \ + - 'remove' $common --remove \ + - '(ops)' \ + '(-)--help' '(-)--version' \ + --remove-all --merge-padding --sort-padding + ;; +esac diff --git a/Completion/Unix/Command/_fmt b/Completion/Unix/Command/_fmt index 759396637..87c7005b9 100644 --- a/Completion/Unix/Command/_fmt +++ b/Completion/Unix/Command/_fmt @@ -1,4 +1,4 @@ -#compdef fmt +#compdef fmt gfmt local variant local -a args diff --git a/Completion/Unix/Command/_fold b/Completion/Unix/Command/_fold new file mode 100644 index 000000000..1a3ef8b55 --- /dev/null +++ b/Completion/Unix/Command/_fold @@ -0,0 +1,24 @@ +#compdef fold gfold + +local variant +local -a args + +_pick_variant -r variant busybox=BusyBox gnu='Free Soft' unix --version + +args=( + '(-b --bytes)'{-b,--bytes}'[count bytes rather than columns]' + '(: -)--help[display help information]' + '(-s --spaces)'{-s,--spaces}'[fold on whitespace]' + '(-w --width)'{-w+,--width=}'[specify line width]:line width (columns or bytes)' + '(: -)--version[display version information]' + '*: :_files' +) + +# Non-GNU variants don't support long options (except BusyBox's --help) +if [[ $variant == *busybox* ]]; then # See also: _busybox + args=( ${args:#((#s)|*\))(\*|)--^help*} ) +elif [[ $variant != gnu ]]; then + args=( ${args:#((#s)|*\))(\*|)--*} ) +fi + +_arguments -s -S : $args diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc index 28a2ccbda..415909d24 100644 --- a/Completion/Unix/Command/_gcc +++ b/Completion/Unix/Command/_gcc @@ -353,7 +353,7 @@ args+=( '-print-file-name=-[Display the full path to library <library>]:library:->library' '-print-prog-name=-[Display the full path to compiler component <program>]:program:' '*-specs=-[Override built-in specs with the contents of <file>]:file:_files' - '-std=-[assume that the input sources are for specified standard]:standard:(c90 c89 c99 c11 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z)' + '-std=-[assume that the input sources are for specified standard]:standard:(c90 c89 c99 c11 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 gnu++17 c++2a gnu++2a)' '*-include:include file:_files -g \*.h\(-.\)' '*-imacros:macro input file:_files -g \*.h\(-.\)' '*-idirafter:second include path directory:_files -/' diff --git a/Completion/Unix/Command/_gem b/Completion/Unix/Command/_gem new file mode 100644 index 000000000..5b048f86d --- /dev/null +++ b/Completion/Unix/Command/_gem @@ -0,0 +1,303 @@ +#compdef gem -P gem[0-9.]# + +local curcontext="$curcontext" state line expl ret=1 +local -A opt_args def +local -a args cmds helptopics proxy lropts filter +local cmd="unknown" + +proxy=( + '(-p --http-proxy)'{-p,--http-proxy=}'[use HTTP proxy for remote operations]:proxy url:_urls' +) +lropts=( $proxy + '${def[local]}(-l --local -r --remote -b --both)'{-l,--local}'[restrict operations to the LOCAL domain]' + '${def[remote]}(-l --local -r --remote -b --both)'{-r,--remote}'[restrict operations to the REMOTE domain]' + '${def[both]}(-l --local -r --remote -b --both)'{-b,--both}'[allow LOCAL and REMOTE operations]' + '(-B --bulk-threshold)'{-B,--bulk-threshold=}'[specify threshold for switching to bulk synchronization]:threshold [1000]' + '--clear-sources[clear the gem sources]' + \*{-s,--source=}'[append specified URL to list of gem sources]:url:_urls' +) + +_arguments -C -s \ + '(* -)'{-h,--help}'[display usage information]' \ + '(* -)'{-v,--version}'[display version information]' \ + '*::command:->command' && ret=0 + +if [[ $state = command ]]; then + if (( CURRENT == 1 )); then + cmd=subcommands + else + cmds=( + build cert check cleanup contents dependency environment fetch + generate_index help install 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 + cmd="$cmds[1]" + curcontext="${curcontext%:*:*}:gem-${cmd}:" + fi + fi + case $cmd in + help) + helptopics=( + 'commands:list all gem commands' + 'examples:show some examples of usage' + 'gem_dependencies:gem dependencies file guide' + 'platforms:show information about platforms' + ) + _describe -t topics 'help topics' helptopics -- && ret=0 + ;& + subcommands) + cmds=( ${${${(M)${(f)"$(_call_program commands gem help commands)"}:# [^ ]*}## #}/ ##/:} ) + _describe -t commands 'gem command' cmds -- && ret=0 + return ret + ;; + 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) + args+=( '*:gem:->gems-remote' ) + ;| + cleanup|uninstall) + args+=( '(-D --check-development)'{-D,--check-development}'[check development dependencies while uninstalling]' ) + ;| + contents|pristine|rdoc) + args+=( '(*)--all[apply to all installed gems]' ) + ;| + list|query) def[local]='!' ;| + search) def[remote]='!' ;| + 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]' + '(-d --details)'{-d,--details}'[display detailed gem information]' + '!(-d --details)--no-details' + ) + ;| + check|contents|dependency|fetch|install|list|open|pristine|query|rdoc|search|specification|uninstall|unpack|yank) + args+=( '(-v --version)'{-v,--version=}'[specify version of gem]:version' ) + ;| + dependency|fetch|install|outdated|specification|uninstall|update|yank) + args+=( '--platform=[specify the platform of gem]:platform' ) + ;| + dependency|fetch|install|list|query|search|specification|update) + args+=( '--prerelease[include prerelease versions of a gem]' '!(--prerelease)--no-prerelease' ) + ;| + install|unpack|update) + args+=( '(-P --trust-policy)'{-P,--trust-policy=}'[specify gem trust policy]:policy' ) + ;| + install|update) + def[both]='!' + args+=( ${(e)lropts} + '(-N --no-document)--document=[generate documentation for installed gems]::documentation type:_sequence compadd - rdoc ri' + '(-N --no-document --document)'{-N,--no-document}'[disable documentation generation]' + '--build-root=[specify temporary installation root]:directory:_directories' + '--vendor[install gem into the vendor directory]' + '(-f --force)'{-f,--force}'[force gem to install, bypassing dependency checks]' + "(-w --wrappers)--no-wrappers[don't install bin wrappers]" + '--format-executable[add matching version suffix on executables to ruby]' + "--user-install[install in user's home directory]" + '--development[install additional development dependencies]' + '--development-all[install development dependencies for all gems]' + "--conservative[don't attempt to upgrade gems already meeting version requirement]" + "--minimal-deps[don't upgrade any dependencies that already meet version requirements]" + '--post-install-message[print post install message]' + '(-g --file)'{-g,--file=}'[read from a gem dependencies API file and install the listed gems]:file:_files' + '--without=[omit the named groups when installing gem dependencies]:group' + "--default[add the gem's full specification to specifications/default and extract only its bin]" + '--explain[rather than install the gems, indicate which would be installed]' + "--no-lock[don't create a lock file]" + '--suggestions[suggest alternates when gems are not found]' + ) + ;| + (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) + args+=( $proxy ) + ;| + owner|push|yank) + args+=( '(-k --key)'{-k,--key=}'[use specified API key from ~/.gem/credentials]:key name' ) + ;| + owner|push|signin|yank) + args+=( '--host=[use another gemcutter-compatible host]:host:_urls' ) + ;| + 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]' + '1:gemspec file:_files -g "*.gemspec(-.)"' + ) + ;; + cert) + args+=( + '(-a --add)'{-a,--add=}'[add a trusted certificate.]:certificate' \ + '(-l --list)'{-l,--list=}'[list trusted certificates where the subject contains specified filter]:filter' + '(-r --remove)'{-r,--remove=}'[remove trusted certificates where the subject contains specified filter]:filter' + '(-b --build)'{-b,--build=}'[build private key and self-signed certificate for specified email address]:email address:_email_addresses -c' + '(-C --certificate)'{-C,--certificate=}'[specify signing certificate for --sign]:certificate' + '(-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' + ) + ;; + check) + args+=( + "--no-alien[don't report \"unmanaged\" or rogue files in the gem repository]" + '--doctor[clean up uninstalled gems and broken specifications]' + "--dry-run[don't remove files, only report what would be removed]" + "--no-gems[don't check installed gems for problems]" + ) + ;; + cleanup) + args+=( '(-n -d --dryrun)'{-n,-d,--dryrun}"[don't uninstall gems]" ) + ;; + contents) + args+=( + '(-s --spec-dir)'{-s,--spec-dir=}'[search for gems in specific paths]:path:_sequence _directories' + '(-l --lib-only)'{-l,--lib-only}"[only return files in the Gem's lib_dirs]" + '--no-prefix[include installed path prefix]' + '--show-install-dir[show only the gem install dir]' + ) + ;; + dependency) + def[local]='!' + args+=( ${(e)lropts} + '(-R --reverse-dependencies)'{-R,--reverse-dependencies}'[include reverse dependencies in the output]' + '--pipe[pipe format]' + ) + ;; + environment) + args+=( '1:information:(packageversion gemdir gempath version remotesources platform)' ) + ;; + fetch) + def=( both \! local \! remote \! ) + args+=( ${(e)lropts} ) + ;; + generate_index) + args+=( + '(-d --directory)'{-d,--directory=}'[specify repository base dir containing gems]:directory:_directories' + '--update[update modern indexes with gems added since the last update]' + ) + ;; + lock) + args+=( '(-s --strict)'{-s,--strict}'[fail if unable to satisfy a dependency]' ) + ;; + open) + args+=( '(-e --editor)'{-e,--editor=}'[open gem sources in specified editor]:editor:_command_names -e' ) + ;; + outdated) + args+=( ${(e)lropts} ) + ;; + owner) + args+=( + '(-a --add)'{-a,--add=}'[add an owner]:email:_email_addresses -c' + '(-r --remove)'{-r,--remove=}'[remove an owner]:email:_email_addresses -c' + ) + ;; + pristine) + args+=( + '(*)*--skip=[with --all, skip specified gem]:installed gem:->gems-local' + "--no-extensions[don't restore gems with extensions in addition to regular gems]" + '--only-executables[only restore executables]' + ) + ;; + push) + args+=( '*:gem:_files -g "*.gem(-.)"' ) + ;; + query) + args+=( + '(-n --name-matches)'{-n,--name-matches=}'[specify regex to match against gem names]:gem name (regex):->gems-local' + ) + ;; + rdoc) + args+=( + '--rdoc[generate RDoc HTML]' + '--no-ri[generate RI data]' + '--overwrite[overwrite installed documents]' + ) + ;; + server) + args+=( + '(-p --port)'{-p,--port=}'[specify port to listen on]:port [8808]:_ports' + '(-d --dir)'{-d,--dir=}'[specify directories from which to serve gems]:directory:_directories' + '--daemon[run as a daemon]' + '(-b --bind)'{-b,--bind=}'[specify addresses to bind]:host:_sequence _hosts' + '(-l --launch)'{-l,--launch=}'[launch a browser window]:command:_command_names -e' + ) + ;; + sources) + args+=( $proxy + '(-a --add)'{-a,--add=}'[add source]:source URI:_urls' + '(-l --list)'{-l,--list}'[list sources]' + '(-r --remove)'{-r,--remove=}'[remove source]:source URI:_urls' + '(-c --clear-all)'{-c,--clear-all}'[remove all sources (clear the cache)]' + '(-u --update)'{-u,--update}'[update source cache]' + ) + ;; + specification) + def[local]='!' + args+=( ${(e)lropts} + '--all[output specifications for all versions of the gem]' + '!(--ruby --marshal)--yaml' '(--ruby --json)--marshal' '(--marshal --json 2)--ruby' + '1:gem:->gems-local' + '2:gemspec field:(name description version platform authors autorequire bindir cert_chain date dependencies email executable executables extensions extra_rdoc_files files homepage licenses metadata post_install_message rdoc_options require_paths required_ruby_version requirements rubyforge_project rubygems_version signing_key specification_version summary test_files)' + ) + ;; + uninstall) + args+=( + '(-a --all)'{-a,--all}'[uninstall all matching versions]' + '(-x --executables)'{-x,--executables}'[uninstall applicable executables without confirmation]' + "--no-user-install[uninstall from user's home directory]" + "--format-executable[assume executable names match Ruby's prefix and suffix]" + '--force[uninstall all versions of the named gems ignoring dependencies]' + '--abort-on-dependent[prevent uninstalling gems that are depended on by other gems]' + '--vendor[uninstall gem from the vendor directory]' + ) + ;; + unpack) + args+=( + '--spec[unpack the gem specification]' + '--target=[specify target directory for unpacking]:directory:_directories' + ) + ;; + update) + args+=( '--system[update the RubyGems system software]::version' ) + ;; + which) + args+=( + '(-a --all)'{-a,--all}'[show all matching files]' + '(-g --gems-first)'{-g,--gems-first}'[search gems before non-gems]' + '*:file:_files' + ) + ;; + esac + _arguments -C ${args:-'*: :_default'} \ + '(-)'{-h,--help}'[display usage information]' \ + '(-V --verbose --no-verbose)'{-V,--verbose,--no-verbose}'[set verbose level of output]' \ + '(-q --quiet -V --verbose --no-verbose)'{-q,--quiet}'[silence commands progress meter]' \ + '--silent[silence rubygems output]' \ + '--config-file=[use specified config file]:file:_files' \ + '--backtrace[show stack backtrace on errors]' \ + '--debug[turn on ruby debugging]' \ + '--norc[avoid loading any .gemrc file]' && ret=0 + + if [[ $state == gems* ]]; then + filter=( ${${opt_args[(I)-([lbr]|-local|-remote|-both)]}:-${${(M)state:#*-*}/gems-/--}} ) + _description gems expl gem + compadd "$expl[@]" ${${(f)"$(_call_program gems gem list $filter -q --no-versions)"}%% *} && ret=0 + fi +fi + +return ret diff --git a/Completion/Unix/Command/_getfacl b/Completion/Unix/Command/_getfacl index b6f1d0932..15be06a1c 100644 --- a/Completion/Unix/Command/_getfacl +++ b/Completion/Unix/Command/_getfacl @@ -11,19 +11,19 @@ _arguments -s -S \ '*: :_files' else _arguments -s -S \ - '--access[display the file access control list only]' \ + '(-a --access)'{-a,--access}'[display the file access control list only]' \ '(-d --default)'{-d,--default}'[display the default access control list only]' \ - '--omit-header[do not display the comment header]' \ - '--all-effective[print all effective rights]' \ - '--no-effective[print no effective rights]' \ - '--skip-base[skip files that only have the base entries]' \ + '(-c --omit-header)'{-c,--omit-header}"[don't display the comment header]" \ + '(-e --all-effective)'{-e,--all-effective}'[print all effective rights]' \ + '(-E --no-effective)'{-E,--no-effective}'[print no effective rights]' \ + '(-s --skip-base)'{-s,--skip-base}'[skip files that only have the base entries]' \ '(-R --recursive)'{-R,--recursive}'[recurse into subdirectories]' \ '(-L --logical)'{-L,--logical}'[logical walk, follow symbolic links]' \ - '(-P --physical)'{-P,--physical}'[physical walk, do not follow symbolic links]' \ - '--tabular[use tabular output format]' \ - '--numeric[print numeric user/group identifiers]' \ - '--absolute-names[don'"'"'t strip leading '"'"'/'"'"' in pathnames]' \ - '--version[print version and exit]' \ - '--help[this help text]' \ + '(-P --physical)'{-P,--physical}"[physical walk, don't follow symbolic links]" \ + '(-t --tabular)'{-t,--tabular}'[use tabular output format]' \ + '(-n --numeric)'{-n,--numeric}'[print numeric user/group identifiers]' \ + '(-p --absolute-names)'{-p,--absolute-names}"[don't strip leading '/' in pathnames]" \ + '(- *)'{-v,--version}'[display version information]' \ + '(- *)'{-h,--help}'[display help information]' \ '*: :_files' fi diff --git a/Completion/Unix/Command/_getopt b/Completion/Unix/Command/_getopt new file mode 100644 index 000000000..3359818b5 --- /dev/null +++ b/Completion/Unix/Command/_getopt @@ -0,0 +1,28 @@ +#compdef getopt ggetopt + +local -a args aopts + +# Note: BusyBox getopt is borrowed straight from util-linux, so they're +# basically identical +if _pick_variant busybox=BusyBox util-linux='getopt*enhanced' unix --version; then + args=( + '(-a --alternative)'{-a,--alternative}'[allow long options with single -]' + '(: -)'{-h,--help}'[display help information]' + '*'{-l+,--longoptions=}'[specify long options]:long options' + '(-n --name)'{-n+,--name=}'[specify program name]:program name' + '(1 -o --options)'{-o+,--options=}'[specify short options]:short options' + '(-q --quiet)'{-q,--quiet}'[suppress getopt(3) error messages]' + '(-Q --quiet-output)'{-Q,--quiet-output}'[suppress normal output]' + '(-s --shell)'{-s+,--shell=}'[specify shell quoting conventions]:shell:(bash csh tcsh sh)' + '(: -)'{-T,--test}'[test for enhanced getopt]' + '(-u --unquoted)'{-u,--unquoted}'[do not quote output]' + '(: -)'{-V,--version}'[display version information]' + '(-o --options)1: :_guard "^-*" "short options"' + '*:argument' + ) + [[ -n $POSIXLY_CORRECT ]] && aopts+=( -A '-*' ) +else + args=( '1:short options' '*:argument' ) +fi + +_arguments -s -S $aopts : $args diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 26554de05..0eb16987d 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -60,9 +60,10 @@ _git-add () { '(-i --interactive : -)'{-i,--interactive}'[add contents interactively to index]' \ '(-p --patch)'{-p,--patch}'[like -i but go directly into patch mode for specified files]' \ '(-e --edit)'{-e,--edit}'[open diff against index in editor]' \ - '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal)'{-A,--all,--no-ignore-removal}'[add, modify, and remove index entries to match the working tree]' \ - '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal)'{--no-all,--ignore-removal}'[like "--all" but ignore removals]' \ + '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal --renormalize)'{-A,--all,--no-ignore-removal}'[add, modify, and remove index entries to match the working tree]' \ + '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal --renormalize)'{--no-all,--ignore-removal}'[like "--all" but ignore removals]' \ '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal)'{-u,--update}'[update the index just where it already has an entry matching <pathspec>]' \ + '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal)--renormalize[renormalize EOL of tracked files (implies -u)]' \ '(-N --intent-to-add)'{-N,--intent-to-add}'[record only that path will be added later]' \ '--refresh[do not add files, but refresh their stat() info in index]' \ '--ignore-errors[continue adding if an error occurs]' \ @@ -293,9 +294,8 @@ _git-branch () { l='--color --no-color -r --remotes -a -v --verbose --abbrev --no-abbrev --list --points-at --sort' c='-l --create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --no-contains --merged --no-merged' - m='-m --move -M' + m='-c --copy -C -m --move -M --edit-description' d='-d --delete -D' - e='--edit-description' declare -a dependent_creation_args if (( words[(I)(-r|--remotes)] == 0 )); then @@ -325,37 +325,39 @@ _git-branch () { fi _arguments -S -s \ - "($c $m $d $e --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \ - "($c $m $d $e : --color)--no-color[turn off branch coloring]" \ - "($c $m $d $e --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 $e --column)"'--no-column[do not display in columns]' \ - "($c $m $d $e )*--list[list only branches matching glob]:pattern" \ - "($c $m $e -a)"{-r,--remotes}'[list or delete only remote-tracking branches]' \ - "($c $m $d $e: -r --remotes)-a[list both remote-tracking branches and local branches]" \ - "($c $m $d $e : -v -vv --verbose)"{-v,-vv,--verbose}'[show SHA1 and commit subject line for each head]' \ - "($c $m $d $e :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \ - "($c $m $d $e :)--no-abbrev[do not abbreviate sha1s]" \ - "($l $m $d $e)"{-l,--create-reflog}"[create the branch's reflog]" \ - "($l $m $d $e -f --force)"{-f,--force}"[force the creation of a new branch]" \ - "($l $m $d $e -t --track)"{-t,--track}"[set up configuration so that pull merges from the start point]" \ - "($l $m $d $e)--no-track[override the branch.autosetupmerge configuration variable]" \ - "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}"[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names" \ - "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \ - "($l $m $d $e)*--contains=[only list branches that contain the specified commit]: :__git_committishs" \ - "($l $m $d $e)*--no-contains=[only list branches that don't contain the specified commit]: :__git_committishs" \ - "($l $m $d $e)--merged=[only list branches that are fully contained by HEAD]: :__git_committishs" \ - "($l $m $d $e)--no-merged=[don't list branches that are fully contained by HEAD]: :__git_committishs" \ + "($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 --column)--no-column[don't display in columns]" \ + "($c $m $d )*--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]" \ + "($l $m $d)"{-l,--create-reflog}"[create the branch's reflog]" \ + "($l $m $d -f --force)"{-f,--force}'[force the creation of a new branch]' \ + "($l $m $d -t --track)"{-t,--track}'[setup configuration so that pull merges from the start point]' \ + "($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \ + "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}'[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names' \ + "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \ + "($l $m $d)*--contains=[only list branches that contain the specified commit]: :__git_committishs" \ + "($l $m $d)*--no-contains=[only list branches that don't contain the specified commit]: :__git_committishs" \ + "($l $m $d)--merged=[only list branches that are fully contained by HEAD]: :__git_committishs" \ + "($l $m $d)--no-merged=[don't list branches that are fully contained by HEAD]: :__git_committishs" \ "($c $l $m $d)--edit-description[edit branch description]" \ $dependent_creation_args \ - "($l $c $d $m $e)"{-m,--move}"[rename a branch and the corresponding reflog]" \ - "($l $c $d $m $e)-M[rename a branch even if the new branch-name already exists]" \ + "($l $c $d $m)"{-m,--move}"[rename a branch and the corresponding reflog]" \ + "($l $c $d $m)-M[rename a branch even if the new branch-name already exists]" \ + "($l $c $d $m)"{-c,--copy}"[copy a branch and the corresponding reflog]" \ + "($l $c $d $m)-C[copy a branch even if the new branch-name already exists]" \ $dependent_modification_args \ - "($l $c $m $d $e)"{-d,--delete}"[delete a fully merged branch]" \ - "($l $c $m $d $e)-D[delete a branch]" \ + "($l $c $m $d)"{-d,--delete}"[delete a fully merged branch]" \ + "($l $c $m $d)-D[delete a branch]" \ {-q,--quiet}"[be more quiet]" \ '*--sort=[specify field to sort on]: :__git_ref_sort_keys' \ '--points-at=[only list tags of the given object]: :__git_commits' \ - "($c $m $d $e -i --ignore-case)"{-i,--ignore-case}'[sorting and filtering are case-insensitive]' \ + "($c $m $d -i --ignore-case)"{-i,--ignore-case}'[sorting and filtering are case-insensitive]' \ $dependent_deletion_args } @@ -519,11 +521,11 @@ _git-cherry-pick () { '--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]' \ - '(-e --edit --ff)'{-e,--edit}'[edit commit before committing the revert]' \ + '(-e --edit --ff)'{-e,--edit}'[edit commit before committing the cherry-pick]' \ '(--ff)-x[append information about what commit was cherry-picked]' \ '(-m --mainline)'{-m+,--mainline=}'[specify mainline when cherry-picking a merge commit]:parent number' \ '--rerere-autoupdate[update index with reused conflict resolution if possible]' \ - '(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actually commit]' \ + '(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actual commit]' \ '(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ '(-S --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]" \ @@ -929,6 +931,7 @@ _git-format-patch () { '--no-binary[do not output contents of changes in binary files, only note that they differ]' \ '--root[treat the revision argument as a range]' \ '--zero-commit[output all-zero hash in From header]' \ + '--progress[show progress while generating patches]' \ ': :->commit-or-commit-range' && ret=0 case $state in @@ -1126,6 +1129,22 @@ _git-init () { ':: :_directories' } +(( $+functions[_git-interpret-trailers] )) || +_git-interpret-trailers() { + _arguments \ + '--in-place[edit files in place]' \ + '--trim-empty[trim empty trailers]' \ + '--where[specify where to place the new trailer]' \ + '--if-exists[specify action if trailer already exists]' \ + '--if-missing[specify action if trailer is missing]' \ + '--only-trailers[output only the trailers]' \ + "--only-input[don't apply config rules]" \ + '--unfold[join whitespace-continued values]' \ + '--parse[set parsing options]' \ + '--trailer[specify trailer(s) to add]' \ + '*:file:_files' +} + (( $+functions[_git-log] )) || _git-log () { local curcontext=$curcontext state line ret=1 @@ -1189,6 +1208,7 @@ _git-merge () { '--abort[restore the original branch and abort the merge operation]' \ '--continue[continue the current in-progress merge]' \ '--progress[force progress reporting]' \ + '--verify[verify commit-msg hook]' \ '*: : __git_commits -O expl:git_commit_opts' } @@ -1495,7 +1515,7 @@ _git-revert () { '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ - ': :__git_commits' + ': :__git_recent_commits' } (( $+functions[_git-rm] )) || @@ -1535,7 +1555,7 @@ _git-shortlog () { '(: -)'{-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]' \ - '(-e --email)'{-e,--email}'[show email addres of each author]' \ + '(-e --email)'{-e,--email}'[show email address of each author]' \ '-w-[linewrap the output]:: :->wrap' \ $revision_options \ '(-)--[start file arguments]' \ @@ -1545,7 +1565,7 @@ _git-shortlog () { (wrap) if [[ -prefix [[:digit:]]#,[[:digit:]]#,[[:digit:]]# ]]; then compset -P '[[:digit:]]#,[[:digit:]]#,' - __git_guard_number 'indent of second and subsquent wrapped lines' + __git_guard_number 'indent of second and subsequent wrapped lines' elif [[ -prefix [[:digit:]]#,[[:digit:]]# ]]; then compset -P '[[:digit:]]#,' compset -S ',[[:digit:]]#' @@ -1731,7 +1751,7 @@ _git-status () { normal\:"show untracked files and directories" \ all\:"also show untracked files in untracked directories (default)"))' \ '--ignore-submodules[ignore changes to submodules]:: :__git_ignore_submodules_whens' \ - '--ignored[show ignored files as well]' \ + '--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"))' \ '(--column)--no-column[do not display in columns]' \ @@ -1988,10 +2008,10 @@ _git-tag () { "*--no-contains=[only list tags that don't contain the specified commit]: :__git_commits" \ '--merged=-[print only tags that are merged]:: :__git_commits' \ '--no-merged=-[print only tags that are not merged]:: :__git_commits' \ - '--sort=[specify how the tags should be sorted]:mode:((refname\:"lexicographic order" - version\\\:refname\:"tag names are treated as version numbers"))' \ + '--sort=[specify how the tags should be sorted]:field:__git_ref_sort_keys' \ '--points-at=[only list tags of the given object]: :__git_commits' \ - '--format=[specify format to use for the output]:format' \ + '--format=[specify format to use for the output]:format:__git_format_ref' \ + '--color=-[respect any colors specified in the format]::when:(always never auto)' \ '(-i --ignore-case)'{-i,--ignore-case}'[sorting and filtering are case-insensitive]' \ ':: :_guard "^-*" pattern' \ - verification \ @@ -2106,10 +2126,11 @@ _git-config () { '(--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' \ - '( --int --bool-or-int --path)--bool[setting is a boolean]' \ - '(--bool --bool-or-int --path)--int[setting is an integer]' \ - '(--bool --int --path)--bool-or-int[setting is an integer]' \ - '(--bool --int --bool-or-int )--path[setting is a path]' \ + '( --int --bool-or-int --path --expiry-date)--bool[setting is a boolean]' \ + '(--bool --bool-or-int --path --expiry-date)--int[setting is an integer]' \ + '(--bool --int --path --expiry-date)--bool-or-int[setting is an integer]' \ + '(--bool --int --bool-or-int --expiry-date)--path[setting is a path]' \ + '(--bool --int --bool-or-int --path )--expiry-date[setting is an expiry date]' \ '(-z --null)'{-z,--null}'[end values with NUL and newline between key and value]' \ '(--get --get-all --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--name-only[show variable names only]' \ '(--includes)'--no-includes"[don't respect \"include.*\" directives]" \ @@ -2186,6 +2207,7 @@ __git_config_option-or-value () { 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.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' blame.blankboundary:'show blank SHA-1 for boundary commits::->bool:false' blame.showroot:'show root commits as normal commits::->bool:false' blame.date:'date format to use in output::__git_date_formats:iso' @@ -3045,7 +3067,7 @@ __git_config_option-or-value () { 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 "akways")' \ + row:'fill rows before columns (implies "always")' \ plain:'show in one column (implies "always")' && ret=0 ;; (commit.cleanup) @@ -3388,6 +3410,7 @@ _git-filter-branch () { '--original[namespace where original commits will be stored]:namespace:_directories' \ '-d[temporary directory used for rewriting]: :_directories' \ '(-f --force)'{-f,--force}'[force operation]' \ + '--state-branch[load mapping from old to new objects from specified branch]:branch:__git_branch_names' \ '*: :__git_commit_ranges' } @@ -3504,16 +3527,6 @@ _git-reflog () { fi } -(( $+functions[_git-relink] )) || -_git-relink () { - _arguments \ - '--safe[stop if two objects with the same hash exist but have different sizes]' \ - '(-)'{-h,--help}'[display usage information]' \ - ': :_directories' \ - ': :_directories' \ - '*: :_directories' -} - (( $+functions[_git-remote] )) || _git-remote () { local curcontext=$curcontext state line ret=1 @@ -3990,7 +4003,7 @@ _git-verify-tag () { _arguments -S -s \ '(-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' \ + '--format=[specify format to use for the output]:format:__git_format_ref' \ '*: :__git_tags' } @@ -4657,6 +4670,8 @@ _git-pack-objects () { '--keep-true-parents[pack parents hidden by grafts]' \ '--use-bitmap-index[use a bitmap index if available to speed up counting objects]' \ '--write-bitmap-index[write a bitmap index together with the pack index]' \ + '--filter=[omit certain objects from pack file]:filter:_git_rev-list_filters' \ + '--missing=[specify how missing objects are handled]:action:(error allow-any print)' \ ':base-name:_files' } @@ -4769,6 +4784,10 @@ _git-update-index () { '--untracked-cache[enable/disable untracked cache]' \ '--test-untracked-cache[test if the filesystem supports untracked cache]' \ '--force-untracked-cache[enable untracked cache without testing the filesystem]' \ + '--force-write-index[write out the index even if is not flagged as changed]' \ + '--fsmonitor[enable or disable file system monitor]' \ + '--fsmonitor-valid[mark files as fsmonitor valid]' \ + '--no-fsmonitor-valid[clear fsmonitor valid bit]' \ $z_opt \ '*:: :_files' } @@ -4915,7 +4934,8 @@ _git-for-each-ref () { _arguments -S -s \ '--count=[maximum number of refs to iterate over]: :__git_guard_number "maximum number of refs"' \ '*--sort=[key to sort refs by]: :__git_ref_sort_keys' \ - '--format=-[output format of ref information]:format' \ + '--format=-[output format of ref information]:format:__git_format_ref' \ + '--color=-[respect any colors specified in the format]::when:(always never auto)' \ '*--points-at=[print only refs which point at the given object]:object:__git_commits' \ '*--merged=[print only refs that are merged]:object:__git_commits' \ '*--no-merged=[print only refs that are not merged]:object:__git_commits' \ @@ -4959,7 +4979,8 @@ _git-ls-files () { '--exclude-standard[skip files in standard Git exclusion lists]' \ '--error-unmatch[if any file does not appear in index, treat this as an error]' \ '(-s --stage -u --unmerged)--with-tree=[treat paths removed since given tree-ish as still present]: :__git_tree_ishs' \ - '-v[identify each files status (hmrck?)]' \ + '(-f)-v[indicate status of each file using lowercase for assume changed files]' \ + '(-v)-f[indicate status of each file using lowercase for fsmonitor clean files]' \ '--full-name[force paths to be output relative to the project top directory]' \ '--recurse-submodules[recurse through submodules]' \ '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ @@ -5056,7 +5077,14 @@ _git-rev-list () { _arguments -C -S \ $revision_options \ - '(--pretty)--header[display contents of commit in raw-format]' \ + '--no-filter[turn off any previous --filter argument]' \ + '--filter-print-omitted[print a list of objects omitted by --filter]' \ + '--filter=[omit certain objects from pack file]:filter:_git_rev-list_filters' \ + '--missing=[specify how missing objects are handled]:action:(error allow-any print)' \ + '(--count --pretty --header --left-right --abbrev-commit --abbrev --parent --children)--quiet[print nothing; exit status indicates if objects are fully connected]' \ + '--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]' \ '--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]' \ @@ -5079,6 +5107,15 @@ _git-rev-list () { return ret } +(( $+functions[_git_rev-list_filters] )) || +_git_rev-list_filters() { + _values 'filter' \ + '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' +} + (( $+functions[_git-show-index] )) || _git-show-index () { _message 'no arguments allowed; accepts index file on standard input' @@ -5559,12 +5596,7 @@ __git_describe_commit () { # . (( $+functions[__git_ignore_line] )) || __git_ignore_line () { - declare -a ignored - ignored=() - ((CURRENT > 1)) && - ignored+=(${(bQ)line[1,CURRENT-1]}) - ((CURRENT < $#line)) && - ignored+=(${(bQ)line[CURRENT+1,-1]}) + local -a ignored=(${line:#${words[CURRENT]}}) $* -F ignored } @@ -5640,7 +5672,6 @@ _git_commands () { pack-refs:'pack heads and tags for efficient repository access' prune:'prune all unreachable objects from the object database' reflog:'manage reflog information' - relink:'hardlink common objects in local repositories' remote:'manage set of tracked repositories' repack:'pack unpacked objects in a repository' replace:'create, list, delete refs to replace objects') @@ -5654,6 +5685,7 @@ _git_commands () { 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' @@ -5799,16 +5831,24 @@ __git_extract_aliases () { __git_date_formats () { declare -a date_formats + if compset -P 'format:'; then + _strftime + return + fi + date_formats=( relative:'show dates relative to the current time' local:'show timestamps in local timezone' - iso:'show timestamps in ISO 8601 format' - rfc:'show timestamps in RFC 2822 format' + iso{,8601}:'show timestamps in ISO 8601 format' + iso-strict:'show timestamps in strict ISO 8601 format' + rfc{,2822}:'show timestamps in RFC 2822 format' short:'show only date but not time' raw:'show date in internal raw git format (%s %z)' - default:'show timestamp in the original timezone') + unix:'show date as a Unix epoch timestamp' + default:'show timestamp in the original timezone' + ) - _describe -t date-formats 'date format' date_formats $* + _describe -t date-formats 'date format' date_formats -- '( format\:custom\ format )' -S : } (( $+functions[__git_gpg_secret_keys] )) || @@ -6026,17 +6066,80 @@ __git_reflog_entries () { __git_ref_sort_keys () { compset -P '-' - local -a sort_keys + __git_ref_fields "$@" +} + +(( $+functions[__git_ref_fields] )) || +__git_ref_fields () { + # pass -a to complete all fields, otherwise only fields relevant to sorting + local match mbegin mend + local -a cfields fields append opts all + + zparseopts -D -E -a opts x: X: J: V: a=all + + if compset -P 1 '(#b)(*):'; then + case $match[1] in + push|upstream) + append=( + 'trackshort[show terse version: > (ahead) < (behind) = (in sync)]' + 'track[print gone whenever unknown upstream ref is encountered]' + 'track,nobracket[tracking information without brackets]' + ) + ;& + refname|upstream|symref) + append+=( + {strip,lstrip}'[strip elements from the left]:elements to strip / -remain' + 'rstrip[strip elements from the right]:elements to strip / -remain' + 'short[strip to non-ambiguous short name]' + ) + ;; + objectname) + append=( + 'short[strip to non-ambiguous short name]:length' + ) + ;; + color) + _alternative \ + 'colors::__git_colors' \ + 'attributes::__git_color_attributes' + return + ;; + align) + append=( + 'width[specify width]:width' + 'position[specify alignment]:alignment:(left right middle)' + ) + ;; + if) append=( {,not}'equals:string' ) ;; + contents) append=( subject body signature lines:lines ) ;; + tailers) append=( only unfold ) ;; + v|version) + append=( + 'refname[sort by versions]' + ) + ;; + esac + (( $#append )) || return 1 + _values 'interpolation modifier' $append + return + fi - # TODO: numparent is undocumented. - sort_keys=( - 'refname:the name of the ref' + cfields=( + 'refname:name of the ref' + 'objectname:object name (SHA-1)' + 'upstream:name of a local ref which can be considered “upstream” from the displayed ref' + 'push:name of a local ref which represents the @{push} location for the displayed ref' + 'symref:the ref which the given symbolic ref refers to' + 'contents:complete message' + 'trailers:structured information in commit messages' + ) + fields=( 'objecttype:the type of the object' 'objectsize:the size of the object' - 'objectname:the object name (SHA-1)' + 'HEAD:* if HEAD matches ref or space otherwise' 'tree:the tree header-field' 'parent:the parent header-field' - 'numparent:undocumented' + 'numparent:number of parent objects' 'object:the object header-field' 'type:the type header-field' 'tag:the tag header-field' @@ -6044,19 +6147,45 @@ __git_ref_sort_keys () { 'authorname:the name component of the author header-field' 'authoremail:the email component of the author header-field' 'authordate:the date component of the author header-field' + 'committer:the committer header-field' 'committername:the name component of the committer header-field' 'committeremail:the email component of the committer header-field' 'committerdate:the date component of the committer header-field' + 'tagger:the tagger header-field' 'taggername:the name component of the tagger header-field' 'taggeremail:the email component of the tagger header-field' 'taggerdate:the date component of the tagger header-field' - 'creatorname:the name component of the creator header-field' + 'creator:the creator header-field' 'creatordate:the date component of the creator header-field' 'subject:the subject of the message' 'body:the body of the message' - 'body:the contents of the message (subject and body)') + 'version\:refname:sort by versions' + ) + if (( $#all )); then + cfields+=( + 'color:change output color' + 'align:set alignment' + 'if:conditional' + ) + fields+=( + 'then:true branch' + 'else:false branch' + 'end:end if or align block' + ) + fi + + _describe -t fields 'field' cfields -S : -r ':\\) \t\n\-' -- fields "$@" +} - _describe -t sort-keys 'sort key' sort_keys $* +(( $+functions[__git_format_ref] )) || +__git_format_ref() { + local expl + compset -P '(%\\\([^)]#\\\)|[^%]|%%|%[[:xdigit:]][[:xdigit:]])#' + if compset -P '%\\\((\*|)'; then + __git_ref_fields -S '\)' -a + else + _wanted -x formats expl format compadd -S '' '%(' + fi } (( $+functions[__git_signoff_file] )) || @@ -6337,7 +6466,7 @@ __git_recent_commits () { else label="[HEAD~$distance_from_head]" fi - ## Disabled because _describe renders the output unhelpfuly when this function + ## Disabled because _describe renders the output unhelpfully when this function ## is called twice during a single completion operation, and list-grouped is ## in its default setting (enabled). #descr+=("@~${distance_from_head}":"${label} $k") # CROSSREF: use the same label as below @@ -6625,7 +6754,7 @@ __git_files () { local pref=$gitcdup$gitprefix$PREFIX # First allow ls-files to pattern-match in case of remote repository - files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\\\*}} 2>/dev/null)"}) + files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\\\*}:-.} 2>/dev/null)"}) __git_command_successful $pipestatus || return # If ls-files succeeded but returned nothing, try again with no pattern @@ -6763,10 +6892,6 @@ __git_tree_files () { (( $+functions[__git_remote_repositories] )) || __git_remote_repositories () { - local service - - service= _ssh - if compset -P '*:'; then _remote_files -/ -- ssh else @@ -6881,6 +7006,8 @@ __git_setup_log_options () { # TODO: Need to implement -<n> for limiting the number of commits to show. log_options=( '(- *)-h[display help]' + '--decorate-refs=[only decorate refs that match pattern]:pattern' + "--decorate-refs-exclude=[don't decorate refs that match pattern]:pattern" '( --no-decorate)--decorate=-[print out ref names of any commits that are shown]: :__git_log_decorate_formats' '(--decorate )--no-decorate[do not print out ref names of any commits that are shown]' '( --no-follow)--follow[follow renames]' @@ -6892,14 +7019,15 @@ __git_setup_log_options () { (( $+functions[__git_setup_diff_options] )) || __git_setup_diff_options () { - local diff_types='(-p -u --patch -U --unified --raw --patch-with-raw --stat --numstat --shortstat --dirstat --dirstat-by-file --summary --patch-with-stat --name-only --name-status --cumulative -s --no-patch)' + # According to Git: "fatal: --name-only, --name-status, --check and -s are mutually exclusive" + local exclusive_diff_options='(--name-only --name-status --check -s --no-patch)' diff_options=( - $diff_types{-p,-u,--patch}'[generate diff in patch format]' - $diff_types{-U,--unified=}'[generate diff with given lines of context]: :__git_guard_number lines' - $diff_types'--raw[generate default raw diff output]' - $diff_types'--patch-with-raw[generate patch but also keep the default raw diff output]' - $diff_types{-s,--no-patch}'[suppress diff output]' + {-p,-u,--patch}'[generate diff in patch format]' + {-U,--unified=}'[generate diff with given lines of context]: :__git_guard_number lines' + '--raw[generate default raw diff output]' + '--patch-with-raw[generate patch but also keep the default raw diff output]' + $exclusive_diff_options{-s,--no-patch}'[suppress diff output]' '(--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]' @@ -6908,16 +7036,16 @@ __git_setup_diff_options () { minimal\:"spend extra time to make sure the smallest possible diff is produced" patience\:"generate diffs with patience algorithm" histogram\:"generate diffs with histogram algorithm"))' - $diff_types'--stat=-[generate diffstat instead of patch]:: :__git_guard_diff-stat-width' - $diff_types'--numstat[generate more machine-friendly diffstat]' - $diff_types'--shortstat[generate summary diffstat]' - $diff_types'--dirstat=-[generate dirstat by amount of changes]:: :__git_guard_number limit' - $diff_types'--dirstat-by-file=-[generate dirstat by number of files]:: :__git_guard_number limit' - $diff_types'--summary[generate condensed summary of extended header information]' - $diff_types'--patch-with-stat[generate patch and prepend its diffstat]' + '--stat=-[generate diffstat instead of patch]:: :__git_guard_diff-stat-width' + '--numstat[generate more machine-friendly diffstat]' + '--shortstat[generate summary diffstat]' + '--dirstat=-[generate dirstat by amount of changes]:: :__git_guard_number limit' + '--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]' '-z[use NUL termination on output]' - $diff_types'--name-only[show only names of changed files]' - $diff_types'--name-status[show only names and status of changed files]' + $exclusive_diff_options'--name-only[show only names of changed files]' + $exclusive_diff_options'--name-status[show only names and status of changed files]' '--submodule=-[select output format for submodule differences]::format:((short\:"show pairs of commit names" log\:"list commits like git submodule does" diff\:"show differences"))' @@ -6930,7 +7058,7 @@ __git_setup_diff_options () { '--word-diff-regex=-[specify what constitutes a word]:word regex' '(--color --no-color )--color-words=-[show colored-word diff]::word regex' '--no-renames[turn off rename detection]' - '--check[warn if changes introduce trailing whitespace or space/tab indents]' + $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]' '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' @@ -6984,7 +7112,14 @@ __git_setup_diff_stage_options () { __git_format_placeholders() { local sep local -a disp names placeholders expl - if compset -P 'format:'; then + _describe -t formats format '( oneline:"commit-ids and subject of messages" + short:"few headers and only subject of messages" + medium:"most parts of messages" + full:"all parts of commit messages" + fuller:"like full and includes dates" + email:"use email headers like From and Subject" + raw:"the raw commits" )' -- '( format:"specify own format" )' -S ':' && return + compset -P 'format:' compset -P '(%[^acgCG]|%?[^%]|[^%])#' if compset -P '%C'; then _wanted colors expl color compadd reset red green blue @@ -7003,6 +7138,8 @@ __git_format_placeholders() { gD:'reflog selector' gd:'short reflog selector' gn:'reflog identity' + ge:'reflog identity email' + gE:'reflog identity email (use .mailmap)' gs:'reflog subject' ) disp=( -l ) @@ -7026,8 +7163,8 @@ __git_format_placeholders() { h:'abbreviated commit hash' T:'tree hash' t:'abbreviated tree hash' - P:'parent hash' - p:'abbreviated parent hash' + P:'parent hashes' + p:'abbreviated parent hashes' a:'author details' c:'committer details' d:'ref name in brackets' @@ -7058,15 +7195,6 @@ __git_format_placeholders() { fi _wanted placeholders expl placeholder \ compadd -p % -S '' "$disp[@]" "$@" - "$names[@]" - else - _describe -t formats format '( oneline:"commit-ids and subject of messages" - short:"few headers and only subject of messages" - medium:"most parts of messages" - full:"all parts of commit messages" - fuller:"like full and includes dates" - email:"use email headers like From and Subject" - raw:"the raw commits" )' -- '( format:"specify own format" )' -S ':' - fi } (( $+functions[__git_setup_revision_options] )) || @@ -7102,16 +7230,19 @@ __git_setup_revision_options () { '*--author=[limit commits to those by given author]:author' '*--committer=[limit commits to those by given committer]:committer' '*--grep=[limit commits to those with log messages matching the given pattern]:pattern' - '--all-match[limit commits to ones matching all --grep, --author, and --committer]' + '--all-match[limit commits to those matching all --grep, --author, and --committer]' + '--invert-grep[limit commits to those not matching --grep, --author and --committer]' '(-i --regexp-ignore-case)'{-i,--regexp-ignore-case}'[match regexps ignoring case]' - '(-E --extended-regexp)'{-E,--extended-regexp}'[use POSIX extended regexps]' - '(-F --fixed-strings)'{-F,--fixed-strings}'[do not interpret patterns as regexps]' + '!(-E --extended-regexp -F --fixed-strings -P --perl-regexp)--basic-regexp' + '(-E --extended-regexp -F --fixed-strings -P --perl-regexp)'{-E,--extended-regexp}'[use POSIX extended regexps]' + '(-E --extended-regexp -F --fixed-strings -P --perl-regexp)'{-F,--fixed-strings}"[don't interpret patterns as regexps]" + '(-E --extended-regexp -F --fixed-strings -P --perl-regexp)'{-P,--perl-regexp}'[use perl regular expression]' '--remove-empty[stop when given path disappears from tree]' - '--merges[display only merge commits]' - '--no-merges[do not display commits with more than one parent]' - '(--min-parents --no-min-parents)--min-parents=-[show only commits having at least <n> commits]: :__git_guard_number "minimum number of parents"' - '(--min-parents --no-min-parents)--no-min-parents[reset limit]' - '(--max-parents --no-max-parents)--max-parents=-[show only commits having at most <n> commits]: :__git_guard_number "maximum number of parents"' + '(--no-merges --min-parents)--merges[display only merge commits]' + "(--merges --max-parents)--no-merges[don't display commits with more than one parent]" + '(--min-parents --no-min-parents --merges)--min-parents=-[show only commits with at least specified number of commits]: :__git_guard_number "number of parents"' + '(--min-parents --no-min-parents --merges)--no-min-parents[reset limit]' + '(--max-parents --no-max-parents --no-merges)--max-parents=-[show only commits with at most specified number of commits]: :__git_guard_number "number of parents"' '(--max-parents --no-max-parents)--no-max-parents[reset limit]' '--first-parent[follow only first parent from merge commits]' '*--not[reverses meaning of ^ prefix for revisions that follow]' @@ -7140,18 +7271,20 @@ __git_setup_revision_options () { '(-g --walk-reflogs)--reverse[display commits in reverse order]' '( --objects-edge)--objects[display object ids of objects referenced by listed commits]' '(--objects )--objects-edge[display object ids of objects referenced by listed and excluded commits]' - '( --do-walk)--no-walk[only display given revs, do not traverse their ancestors]' + "( --do-walk)--no-walk=-[only display given revs, don't traverse their ancestors]::order:(sorted unsorted)" '(--no-walk )--do-walk[only display given revs, traversing their ancestors]' '( --cherry-pick)--cherry-mark[like --cherry-pick but mark equivalent commits instead of omitting them]' '(--cherry-pick )--cherry-pick[omit any commit that introduces the same change as another commit on "the other side" of a symmetric range]' '( --right-only)--left-only[list only commits on the left side of a symmetric range]' '(--left-only )--right-only[list only commits on the right side of a symmetric range]' - '(--left-only --right-only --cherry-pick --cherry-mark)--cherry[synonym for --right-only --cherry-mark --no-merges]' + '(--left-only --right-only --cherry-pick --cherry-mark --no-merges --merges --max-parents)--cherry[synonym for --right-only --cherry-mark --no-merges]' '(-c --cc )--full-diff[show full commit diffs when using log -p, not only those affecting the given path]' '--log-size[print log message size in bytes before the message]' '--use-mailmap[use mailmap file to map author and committer names and email]' '--reflog[show all commits from reflogs]' + '--single-worktree[examine the current working tree only]' + '--stdin[additionally read commits from standard input]' '--default[use argument as default revision]:default revision:__git_revisions' # TODO: --early-output is undocumented. '--early-output=-[undocumented]::undocumented' @@ -7176,6 +7309,7 @@ __git_setup_merge_options () { '(-n --no-stat)--stat[show a diffstat at the end of the merge]' '(--stat -n --no-stat)'{-n,--no-stat}'[do not show diffstat at the end of the merge]' '( --no-squash)--squash[merge, but do not commit]' + '--signoff[add Signed-off-by:]' '(--squash )--no-squash[merge and commit]' '--ff-only[refuse to merge unless HEAD is up to date or merge can be resolved as a fast-forward]' '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' @@ -7618,7 +7752,7 @@ _git() { declare -gUa _git_third_party_commands _git_third_party_commands=() -local file +local file input for file in ${^fpath}/_git-*~(*~|*.zwc)(-.N); do local name=${${file:t}#_git-} if (( $+_git_third_party_commands[$name] )); then diff --git a/Completion/Unix/Command/_gnutls b/Completion/Unix/Command/_gnutls index 169e38b38..2cd559843 100644 --- a/Completion/Unix/Command/_gnutls +++ b/Completion/Unix/Command/_gnutls @@ -1,126 +1,206 @@ -#compdef gnutls-cli gnutls-cli-debug certtool srptool +#compdef gnutls-cli gnutls-cli-debug gnutls-serv certtool srptool -local _gnutls_supported _gnutls_supported_certtypes -local _gnutls_supported_protocols _gnutls_supported_macs -local _gnutls_supported_kx _gnutls_supported_comp -local _gnutls_cli_common_args +local -a args -_gnutls_cli_common_args=( - '(-d --debug)'{-d,--debug}':debug level' - '(-p --port)'{-p,--port}':port' - '(-h --help)'{-h,--help}'[help]' +args=( + '(- :)'{-h,--help}'[display help information]' + '(- :)--version=[display version information]:information:((v\:simple c\:copyright n\:full))' + '(- :)-v[display version information]' + '(- :)'{-\!,--more-help}'[display help information through a pager]' + '(-d --debug)'{-d,--debug}'[enable debugging]:debug level' + \*{-V,--verbose}'[more verbose output]' ) case "$service" in - (gnutls-cli) - -_gnutls_supported="$(gnutls-cli --list)" -_gnutls_supported_certtypes=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Certificate types:*}#Certificate types: }}) -_gnutls_supported_protocols=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Protocols:*}#Protocols: }}) -_gnutls_supported_ciphers=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Ciphers:*}#Ciphers: }}) -_gnutls_supported_macs=(${(s:, :)${${(M)${(f)_gnutls_supported}:#MACs:*}#MACs: }}) -_gnutls_supported_kx=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Key exchange algorithms:*}#Key exchange algorithms: }}) -_gnutls_supported_comp=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Compression methods:*}#Compression methods: }}) - -_arguments \ - "$_gnutls_cli_common_args[@]" \ - '(-r --resume)'{-r,--resume}'[resume session]' \ - '(-s --starttls)'{-s,--starttls}'[start TLS on EOF or SIGALRM]' \ - '--crlf[send CR LF instead of LF]' \ - '--x509fmtder[use DER format for certificates to read from]' \ - '(-f --fingerprint)'{-f,--fingerprint}'[send the openpgp fingerprint instead of the key]' \ - '--disable-extensions[disable all the TLS extensions]' \ - '--xml[print the certificate information in XML format]' \ - '--print-cert[print the certificate in PEM format]' \ - '--recordsize:maximum record size to advertise:' \ - '(-V --verbose)'{-V,--verbose}'[more verbose output]' \ - '--ciphers:ciphers to enable:('"$_gnutls_supported_ciphers"')' \ - '--protocols:protocols to enable:('"$_gnutls_supported_protocols"')' \ - '--comp:compression methods to enable:('"$_gnutls_supported_comp"')' \ - '--macs:MACs to enable:('"$_gnutls_supported_macs"')' \ - '--kx:key exchange methods to enable:('"$_gnutls_supported_kx"')' \ - '--ctypes:certificate types to enable:('"$_gnutls_supported_certtypes"')' \ - '--x509cafile:certificate file to use:_files' \ - '--x509crlfile:CRL file to use:_files' \ - '--pgpkeyfile:PGP key file to use:_files' \ - '--pgpkeyring:PGP key ring file to use:_files' \ - '--pgptrustdb:PGP trustdb file to use:_files' \ - '--pgpcertfile:PGP public key (certificate) file to use:_files' \ - '--x509keyfile:X.509 key file to use:_files' \ - '--x509certfile:X.509 certificate file to use:_files' \ - '--srpusername:SRP username to use' \ - '--srppasswd:SRP password to use' \ - '--insecure[do not require server cert validation]' \ - '(-l --list)'{-l,--list}'[print list of the supported algorithms/modes]' \ - '(-v --version)'{-v,--version}'[print version number]' \ - '--copyright[print license]' \ + gnutls-*) + args+=( + '(-p --port)'{-p,--port}'[specify port or service to connect to]:port:_ports' + ) + ;| + gnutls-cli*) + args+=( + '(--app-proto --starttls-proto)'{--app-proto,--starttls-proto}"=[specify application protocol to use to obtain the server's certificate]:protocol:(https ftp smtp imap ldap xmpp lmtp pop3 nntp sieve postgres)" ':hostname:_hosts' + ) + ;| + gnutls-cli|gnutls-serv) + args+=( + "--sni-hostname=[specify server's hostname for server name indication extension]:hostname" + "--noticket[don't accept session tickets]" + '(-u --udp)'{-u,--udp}'[use DTLS (datagram TLS) over UDP]' + '--mtu=[set MTU for datagram TLS]:mtu' + '--srtp-profiles=[offer SRTP profiles]:string' + '(-b --heartbeat)'{-b,--heartbeat}'[activate heartbeat support]' + '--x509fmtder[use DER format for certificates to read from]' + '--priority=[specify TLS algorithms and protocols to enable]:(NORMAL PFS SECURE128 SECURE192 SUITEB128 SUITEB192 LEGACY PERFORMANCE NONE)' + '--x509cafile=[specify certificate file to use]:file:_files' + '--x509crlfile=[specify CRL file to use]:file:_files' + '*--x509keyfile=[specify X.509 key file to use]:file:_files' + '*--x509certfile=[specify X.509 certificate file to use]:file:_files' + '(-l --list -p --port)'{-l,--list}'[print list of the supported algorithms/modes]' + ) + ;| + gnutls-cli|gnutls-serv|certtool) + args+=( + '--provider=[specify PKCS #11 provider library]:provider:_files' + ) + ;| + gnutls-cli|certtool) + args+=( + '--verify-allow-broken[allow broken algorithms, such as MD5 for certificate verification]' + ) + ;| - ;; - (gnutls-cli-debug) - -_arguments \ - "$_gnutls_cli_common_args[@]" \ - '(-v --verbose)'{-v,--verbose}'[more verbose output]' \ - ':hostname:_hosts' + gnutls-cli) + args+=( + '--tofu[enable trust on first use authentication]' '!--no-tofu' + '--strict-tofu[fail to connect if a known certificate has changed]' '!--no-strict-tofu' + '--dane[enable DANE certificate verification (DNSSEC)]' '!--no-dane' + '--local-dns[use the local DNS server for DNSSEC resolving]' '!--no-local-dna' + '--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]' + '(-e --rehandshake)'{-e,--rehandshake}'[connect, establish a session and rehandshake immediately]' + '(-s --starttls)'{-s,--starttls}'[start TLS on EOF or SIGALRM]' + '--crlf[send CR LF instead of LF]' + '--fastopen[enable TCP Fast Open]' + "--print-cert[print peer's certificate in PEM format]" + "--save-cert=[save peer's certificate chain in the specified file in PEM format]:file:_files" + "--save-ocsp=[save peer's OCSP status response in the provided file]:file:_files" + '--save-server-trace=[save the server-side TLS message trace in the provided file]:file:_files' + '--save-client-trace=[save the client-side TLS message trace in the provided file]:file:_files' + '--dh-bits=[specify minimum number of bits allowed for DH]:bits' + '--srpusername[specify SRP username to use]:username' + '--srppasswd[specify SRP password to use]:password' + '--pskusername[specify PSK username to use]:username' + '--pskkey[specify PSK key to use]:key' + "--insecure[don't require server cert validation]" + '--ranges[use length-hiding padding to prevent traffic analysis]' + '--benchmark-ciphers[benchmark individual ciphers]' + '--benchmark-soft-ciphers[benchmark individual software ciphers]' + '--benchmark-tls-kx[benchmark TLS key exchange methods]' + '--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' + "--disable-sni[don't send a Server Name]" + '--disable-extensions[disable all the TLS extensions]' + '--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]' + ) + ;; - ;; + gnutls-serv) + args+=( + '--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]' + '(-g --generate)'{-g,--generate}'[generate Diffie-Hellman parameters]' + '(-q --quiet)'{-q,--quiet}'[suppress some messages]' + "--nodb[don't use a resumption database]" + '--http[act as an HTTP server]' + '--echo[act as an Echo server]' + '(-a --disable-client-cert)'{-a,--disable-client-cert}"[don't request a client certificate]" + '(-r --require-client-cert)'{-r,--require-client-cert}'[require a client certificate]' + '--verify-client-cert[if a client certificate is sent then verify it]' + '--dhparams=[specify DH params file to use]:file:_files' + '--srppasswd=[specify SRP password file to use]:file:_files' + '--srppasswdconf=[specify SRP password configuration file to use]:file:_files' + '--pskpasswd=[specify PSK password file to use]:file:_files' + '--pskhint=[specify PSK identity hint to use]:string' + '--ocsp-response=[specify OCSP response to send to client]:file:_files' + ) + ;; - (certtool) -_arguments \ - '(-s --generate-self-signed)'{-s,--generate-self-signed}'[generate a self-signed certificate]' \ - '(-c --generate-certificate)'{-c,--generate-certificate}'[generate a signed certificate]' \ - '--generate-crl[generate a CRL]' \ - '(-u --update-certificate)'{-u,--update-certificate}'[update a signed certificate]' \ - '(-p --generate-privkey)'{-p,--generate-privkey}'[generate a private key]' \ - '(-q --generate-request)'{-q,--generate-request}'[generate a PKCS #10 certificate request]' \ - '(-e --verify-chain)'{-e,--verify-chain}'[verify a PEM encoded certificate chain]' \ - '--verify-crl[verify a CRL]' \ - '--generate-dh-params[generate PKCS #3 encoded Diffie Hellman parameters]' \ - '--get-dh-params[get the included PKCS #3 encoded Diffie Hellman parameters]' \ - '--load-privkey:private key file:_files' \ - '--load-request:certificate request file:_files' \ - '--load-certificate:certificate file:_files' \ - '--load-ca-privkey:certificate authority private key file:_files' \ - '--load-ca-certificate:certificate authority certificate file:_files' \ - '--password:password' \ - '(-i --certificate-info)'{-i,--certificate-info}'[print information on a certificate]' \ - '(-l --crl-info)'{-l,--crl-info}'[print information on a CRL]' \ - '--p12-info[print information on a PKCS #12 structure]' \ - '--p7-info[print information on a PKCS #7 structure]' \ - '--smime-to-p7[convert S/MIME to PKCS #7 structure]' \ - '(-k --key-info)'{-k,--key-info}'[print information on a private key]' \ - '--fix-key[regenerate the parameters in a private key]' \ - '--to-p12[generate a PKCS #12 structure]' \ - '(-8 --pkcs8)'{-8,--pkcs8}'[use PKCS #8 format for private keys]' \ - '--dsa[use DSA keys]' \ - '--hash:hash algorithm for signing:(MD5 SHA1 RMD160)' \ - '--export-ciphers[use weak encryption algorithms]' \ - '--inder[use DER format for input certificates and private keys]' \ - '--xml[use XML format for output certificates]' \ - '--outder[use DER format for output certificates and private keys]' \ - '--bits:number of bits for key generation' \ - '--outfile:output file:_files ' \ - '--infile:input file:_files ' \ - '--template:template file to use for non-interactive operation:_files' \ - '(-d --debug)'{-d,--debug}':debug level' \ - '(-h --help)'{-h,--help}'[show help]' \ - '(-v --version)'{-v,--version}'[show version]' \ - '--copyright[shows license]' + certtool) + args+=( + '(-q --generate-request)--infile:input file:_files ' + '--outfile:output file:_files ' + '(-s --generate-self-signed)'{-s,--generate-self-signed}'[generate a self-signed certificate]' + '(-c --generate-certificate)'{-c,--generate-certificate}'[generate a signed certificate]' + '--generate-proxy[generate a proxy certificate]' + '--generate-crl[generate a CRL]' + '(-u --update-certificate)'{-u,--update-certificate}'[update a signed certificate]' + '--fingerprint[print the fingerprint of the given certificate]' + '--key-id[print the key ID of the given certificate]' + '--v1[generate an X.509 version 1 certificate (with no extensions)]' + '--sign-params=[sign a certificate with a specific signature algorithm]:algorithm:(RSA-PSS)' + '(-p --generate-privkey)'{-p,--generate-privkey}'[generate a private key]' + '(-q --generate-request --infile)'{-q,--generate-request}'[generate a PKCS #10 certificate request]' + '(-e --verify-chain)'{-e,--verify-chain}'[verify a PEM encoded certificate chain]' + '--verify[verify a PEM encoded certificate chain using a trusted list]' + '--verify-crl[verify a CRL]' + '(--verify-email)--verify-hostname=[specify hostname to be used for certificate chain verification]:hostname:_hosts' + '(--verify-hostname)--verify-email=[specify email to be used for certificate chain verification]:email:_email_addresses' + '--verify-purpose=[specify a purpose OID to be used for certificate chain verification]' + '--p7-sign[sign using a PKCS #7 structure]' + '--p7-detached-sign[sign using a detached PKCS #7 structure]' + "--no-p7-include-cert[don't include signer's certificate will in the cert list]" + '--p7-time[include a timestamp in the PKCS #7 structure]' + '--p7-show-data[show embedded data in the PKCS #7 structure]' + '--p7-verify[verify the provided PKCS #7 structure]' + '--generate-dh-params[generate PKCS #3 encoded Diffie Hellman parameters]' + '--get-dh-params[get the included PKCS #3 encoded Diffie Hellman parameters]' + '--dh-info[print information PKCS #3 encoded Diffie-Hellman parameters]' + '--load-privkey:private key file:_files' + '--load-pubkey:public key file:_files' + '--load-request:certificate request file:_files' + '--load-certificate:certificate file:_files' + '--load-ca-privkey:certificate authority private key file:_files' + '--load-ca-certificate:certificate authority certificate file:_files' + '--load-crl=[load the provided CRL]:CRL' + '--load-data=[load auxiliary data]:data' + '--password=[specify password to use]:password' + '--hex-numbers[big number in an easier format to parse]' + '--cprint[prints certain information is C-friendly format]' + '--null-password[enforce a NULL password]' + '--empty-password[enforce an empty password]' + '--key-type=[specify the key type to use on key generation]:key type' + '(-i --certificate-info)'{-i,--certificate-info}'[print information on a certificate]' + '--certificate-pubkey[print certificate public key]' + '(-l --crl-info)'{-l,--crl-info}'[print information on a CRL]' + '--crq-info[print information on a certificate request]' + "--no-crq-extensions[don't use extensions in certificate requests]" + '--p12-info[print information on a PKCS #12 structure]' + '--p12-name=[specify PKCS #12 friendly name to use]:name' + '--p7-info[print information on a PKCS #7 structure]' + '--smime-to-p7[convert S/MIME to PKCS #7 structure]' + '(-k --key-info)'{-k,--key-info}'[print information on a private key]' + '--p8-info[print information on a PKCS #8 structure]' + '--to-rsa[convert an RSA-PSS key to raw RSA format]' + '--bits=[specify number of bits for key generation]:bits' + '--curve=[specify the curve used for EC key generation]:curve' + '--sec-param=[specify the security level]:security level:(low legacy medium high ultra)' + '--to-p8[convert a given key to a PKCS #8 structure]' + '--provable[generate a private key or parameters from a seed using a provable method]' + '--verify-provable-privkey[verify a private key generated from a seed using a provable method]' + '--seed=[when generating a private key use the given seed]:seed (hex-encoded)' + '--pubkey-info[print information on a public key]' + '--to-p12[generate a PKCS #12 structure]' + '(-8 --pkcs8)'{-8,--pkcs8}'[use PKCS #8 format for private keys]' + '--hash=[specify hash algorithm for signing]:algorithm:(MD5 SHA1 RMD160)' + '--salt-size=[specify the RSA-PSS key default salt size]:size' + {--inder,--inraw}'[use DER format for input certificates and private keys]' + {--outder,--outraw}'[use DER format for output certificates and private keys]' + '--template=[specify template file to use for non-interactive operation]:file:_files' + '--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)' + ) + ;; - ;; - (srptool) - -_arguments \ - '(-u --username)'{-u,--username}':username:_users' \ - '(-p --passwd)'{-p,--passwd}':password file:_files' \ - '(-i --index)'{-i,--index}':index of params in tpasswd.conf' \ - '(-s --salt)'{-s,--salt}':salt size for crypt algorithm' \ - '--verify[just verify password]' \ - '(-c --passwd-conf)'{-c,--passwd-conf}':password conf file:_files' \ - '--create-conf:generate a tpasswd.conf file:_files' \ - '(-v --version)'{-v,--version}'[show version]' \ - '(-h --help)'{-h,--help}'[show help]' - - ;; + srptool) + args+=( + '(-i --index)'{-i+,--index=}':index of params in tpasswd.conf' + '(-u --username)'{-u+,--username=}':username:_users' + '(-p --passwd)'{-p+,--passwd=}':password file:_files' + '(-s --salt)'{-s+,--salt=}'[specify salt size]:salt size for crypt algorithm' + '--verify[just verify password]' + '(-v --passwd-conf)'{-v+,--passwd-conf=}'[generate a password configuration file]:password conf file:_files' + '--create-conf=[generate a tpasswd.conf file]:file:_files' + ) + ;; esac + +_arguments -s -S $args diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg index d7a8ece4c..48a36eff2 100644 --- a/Completion/Unix/Command/_gpg +++ b/Completion/Unix/Command/_gpg @@ -1,7 +1,7 @@ #compdef gpg gpgv gpg-zip gpg2=gpg local curcontext="$curcontext" state line expl ret=1 -local -a args allopts dups +local -a args allopts dups extra typeset -A opt_args if [[ $service = gpg-zip ]]; then @@ -38,17 +38,17 @@ fi [[ $service = gpg ]] && args+=( '--decrypt-files[decrypt multiple files]' '(-b --detach-sign)'{-b,--detach-sign}'[make a detached signature]' - '--clearsign[make a clear text signature]' + --clear{,-}sign'[make a clear text signature]' '--store[store only]' '--verify[verify a signature]' '--verify-files[verify a list of files]' '(-f --encrypt-files)'{-f,--encrypt-files}'[encrypt files]' - '--list-keys[list all keys]' + '(-k --list-keys)'{-k,--list-keys}'[list all keys]' '--list-public-keys[list all public keys]' - '--list-secret-keys[list all secret keys]' - '--list-sigs[lists keys and signatures]:key attachment:->public-keys' - '--list-options[modify what the various --list-* commands show]' - '--check-sigs[list key, signatures and check them]:key attachment:->public-keys' + '(-K --list-secret-keys)'{-K,--list-secret-keys}'[list all secret keys]' + --list-sig{,nature}s'[lists keys and signatures]:key attachment:->public-keys' + '--list-options[modify what the various --list-* commands show]: :->option-list' + --check-sig{,nature}s'[list key, signatures and check them]:key attachment:->public-keys' '--fingerprint[list all keys with their fingerprints]:key attachment:->public-keys' '--list-packets[list only the sequence of packets]' '--gen-key[generate a new pair key]' @@ -60,6 +60,7 @@ fi '--delete-secret-and-public-keys:key attachment:->secret-keys' '--gen-revoke[generate a revocation certificate]' '--desig-revoke[generate a designated revocation certificate]' + '--passwd[change a passphrase]' '--export[export all keys from all keyrings]' '--send-keys[send keys to a keyserver]:key attachment:->public-keyids' '--export-secret-keys:key attachment:->secret-keys' @@ -67,7 +68,7 @@ fi '--import[import a gpg key from a file]:attachment (file):_files' '--fast-import[import a file without adding to trustdb]:attachment (file):_files' '--fetch-keys[fetch key at URIs]:uri:' - '--recv-keys[receive a list of keys from a keyserver]:key attachment:->public-keyids' + --rec{eive,v}-keys'[receive a list of keys from a keyserver]:key attachment:->public-keyids' '--refresh-keys[update all keys from a keyserver]' '--search-keys[search for keys on a key server]' '--update-trustdb[update the trust database]' @@ -79,7 +80,11 @@ fi '--enarmor[en-Armor a file or stdin]' '--print-md[print message digests]:algorithm:->ciphers::file:_files' '--print-mds[print message digests]::file:_files' - '--gen-random:count' '--gen-prime' + '--tofu-policy:policy:(good unknown bad ask auto):*:keys:->public-keys' + '--tofu-default-policy:policy:(good unknown bad ask auto)' + '--quick-generate-key:user-id: :algorithm:(default future-default rsa dsa elg ed25519 cv25519): : _values -s , usage - default sign auth encr::expiration' + '--quick-add-key:fingerprint: :algorithm:(default future-default rsa dsa elg ed25519 cv25519): : _values -s , usage - default sign auth encr::expiration' + '--gen-random:quality level:(0 1 2):count (bytes)' '--gen-prime' '--warranty[print warranty info]' '(-a --armor)'{-a,--armor}'[create ASCII armored output]' '--default-key[specify default user ID for signatures]:key:->secret-keys' @@ -126,11 +131,11 @@ fi '--s2k-mode:value' '--compress-algo:compression algorithm:((0\:disable\ compression 1\:zlib 2\:rfc1950))' '--personal-'{cipher,digest,compress}'-preferences:string' - '--card-edit[present smartcard menu]' '--card-status[show smartcard content]' + --{card-edit,edit-card}'[present smartcard menu]' '--card-status[show smartcard content]' '--change-pin[present menu to change smartcard pin]' '--list-config[display internal configuration parameters]' '--hidden-recipient[hidden recipient]:recipient:->public-keys' - '--dump-options[show all options]' '--default-preference-list:string' + '--default-preference-list:string' '--fetch-keys:URIs' '--hidden-encrypt-to:recipient:->public-keys' '--compress-level:integer' @@ -139,17 +144,14 @@ fi '--max-output[maximum output generated when processing file]:bytes:' '--gpg-agent-info[override GPG_AGENT_INFO]:' '--primary-keyring:file:_files' - '--verify-options:parameters:_multi_parts -q -S, "," - "(show-photos show-policy-urls show-notations show-std-notations - show-user-notations show-keyserver-urls show-uid-validity show-unusable-uids - show-primary-uid-only pka-lookups pka-trust-increase)"' + '--verify-options: :->verify-options' '--debug:flags:' '--status-file:file:_files' '--attribute-file:file:_files' '--load-extension:file:_files' '--s2k-count:integer' '--sig-notation:name=value:' '--cert-notation:name=value:' '--passphrase-file:file:_files' '--passphrase-repeat:integer:' '--command-file:file:_files' '--trustdb-name:file:_files' - '--trust-model:trust model:((pgp classic direct always auto))' + '--trust-model:trust model:(pgp classic tofu tofu+pgp direct always auto)' '--sig-policy-url:string:' '--cert-policy-url:string:' '--sig-keyserver-url:string:' '--comment[comment]:comment:' '--no-comments[disable comments]' @@ -163,8 +165,8 @@ fi '--multifile[process multiple files]' '--keyid-format[key id format]:key format:((short 0xshort long 0xlong))' '--exit-on-status-write-error[exit immediately on error write]' - '--limit-card-insert-tries:integer:' - '--reader-port[card reader port]:port:' + '--limit-card-insert-tries:integer' + '--reader-port[card reader port]:port' '--ctapi-driver[file to use to access smartcard reader]:file:_files' '--pcsc-driver[file to use to access smartcard reader]:file:_files' '--auto-key-locate:parameters' @@ -176,7 +178,7 @@ extra=( ${allopts:|extra} ) _arguments -C -s -S -A "-*" $args $extra '*:args:->args' && ret=0 if [[ $state = args ]]; then - if (( ${+opt_args[--export]} || ${+opt_args[--list-keys]} || ${+opt_args[--list-public-keys]} )); then + if (( ${+opt_args[--export]} || ${+opt_args[-k]} || ${+opt_args[--list-keys]} || ${+opt_args[--list-public-keys]} )); then state=public-keys elif (( ${+opt_args[--list-secret-keys]} )); then state=secret-keys @@ -205,19 +207,27 @@ fi case "$state" in public-keys) _wanted public-keys expl 'public key' \ - compadd ${${(Mo)$(_call_program public-keys gpg $needed --list-public-keys --list-options no-show-photos 2>/dev/null):%<*>}//(<|>)/} && return + compadd ${${(Mo)$(_call_program public-keys $words[1] $needed --list-public-keys --list-options no-show-photos):%<*>}//(<|>)/} && return ;; secret-keys) _wanted secret-keys expl 'secret key' compadd \ - ${${(Mo)$(_call_program secret-keys gpg $needed --list-secret-keys --list-options no-show-photos 2>/dev/null):%<*>}//(<|>)/} && return + ${${(Mo)$(_call_program secret-keys $words[1] $needed --list-secret-keys --list-options no-show-photos):%<*>}//(<|>)/} && return ;; ciphers) _wanted ciphers expl cipher compadd \ - ${${(s.,.)${(M)${(f)"$(_call_program ciphers gpg $needed --version)"}:#Cipher*}#*:}# } && return + ${${(s.,.)${(M)${(f)${"$(_call_program ciphers $words[1] $needed --version)"}//,$'\n' #/, }:#Cipher*}#*:}# } && return ;; (public-keyids) _wanted public-keys expl 'public keyid' \ - compadd ${${${(M)${(f)"$(_call_program public-keyids gpg $needed --list-public-keys --list-options no-show-photos 2>/dev/null)"}:%pub*}#pub */}%% *} && return + compadd ${(M)${${(f)"$(_call_program public-keyids $words[1] $needed --list-public-keys --list-options no-show-photos)"}## #}:#[0-9A-F](#c40)} && return + ;; + (option-list) + _sequence _wanted options expl option \ + compadd - {no-,}show-{photos,usage,policy-urls,{std,user}-notations,keyserver-urls,uid-validity,unusable-{uids,subkeys},keyring,sig-{expire,subpackets}} && return + ;; + (verify-options) + _sequence _wanted options expl option \ + compadd - {no-,}show-{photos,policy-urls,{std,user}-notations,keyserver-urls,uid-validity,unusable-uids,primary-uid-only} {no-,}pka-{lookups,trust-increase} && return ;; esac diff --git a/Completion/Unix/Command/_gsettings b/Completion/Unix/Command/_gsettings index 890b56403..2724be0ea 100644 --- a/Completion/Unix/Command/_gsettings +++ b/Completion/Unix/Command/_gsettings @@ -3,7 +3,7 @@ local curcontext="$curcontext" state line expl ret=1 local subcmds -_arguments \ +_arguments -A "-*" \ '(- 1 *)--version[show version information]' \ '--schemadir[specify location of schemata]:directory:_directories' \ ':command:->subcmds' \ @@ -20,6 +20,9 @@ if [[ $state = subargs ]]; then _arguments ':schema:->schemata' ':key:->keys' ':value' ;; (list|reset)-(keys|recursively|children)) state=schemata ;; + list-schemas) + _arguments '--print-paths' + ;; *) _default && ret=0 ;; esac fi diff --git a/Completion/Unix/Command/_gzip b/Completion/Unix/Command/_gzip index f9fd17819..42d4ae705 100644 --- a/Completion/Unix/Command/_gzip +++ b/Completion/Unix/Command/_gzip @@ -13,7 +13,9 @@ unpigz|pigz) '(-b --blocksize)'{-b+,--blocksize}'[set compression block size]:size (KiB)' '(-p --processes)'{-p,--processes}'[specify number of processes to use]' '(-z --zlib)'{-z,--zlib}'[compress to zlib (.zz) format]' - '(-T --no-time)'{-T,--no-time}"[don't store/restore modification time in/from header]" + '(-m --no-time)'{-m,--no-time}"[don't store/restore modification time in/from header]" + '(-M --time)'{-M,--time}"[store/restore modification time in/from header]" + '(--synchronous)-Y[force output file write to permanent storage]' ) ;| pigz) @@ -23,7 +25,7 @@ pigz) '(--rsyncable)-R[make rsync-friendly archive]' "($excl)"{-F,--first}'[do iterations first, before block split]' "($excl)"{-I+,--iterations}'[specify number of iterations for optimization]:iterations [15]' - "($excl)"{-M+,--maxsplits}'[specify maximum number of split blocks]:split blocks [15]' + "($excl)"{-J+,--maxsplits}'[specify maximum number of split blocks]:split blocks [15]' "($excl)"{-O,--oneblock}"[don't split into smaller blocks]" ) ;| @@ -62,6 +64,7 @@ gzip|pigz) '(-R)--rsyncable[make rsync-friendly archive]' \ '(--suffix)-S+[specify suffix for compressed files]:suffix:' \ '(-S)--suffix=[specify suffix for compressed files]:suffix:' \ + '(-Y)--synchronous[force output file write to permanent storage]' \ '(--test)-t[test compressed file integrity]' \ '(-t)--test[test compressed file integrity]' \ '(--verbose)-v[verbose mode]' \ diff --git a/Completion/Unix/Command/_head b/Completion/Unix/Command/_head index 75fc1f0a1..1e968cc11 100644 --- a/Completion/Unix/Command/_head +++ b/Completion/Unix/Command/_head @@ -1,4 +1,4 @@ -#compdef head +#compdef head ghead local curcontext=$curcontext state state_descr line expl opts args ret=1 typeset -A opt_args diff --git a/Completion/Unix/Command/_hexdump b/Completion/Unix/Command/_hexdump new file mode 100644 index 000000000..f700ca683 --- /dev/null +++ b/Completion/Unix/Command/_hexdump @@ -0,0 +1,35 @@ +#compdef hexdump hd + +local -a args fmts optpar +fmts=( + {--one-byte-octal,-b}'[one-byte octal display]' + {--one-byte-char,-c}'[one-byte character display]' + {--two-bytes-decimal,-d}'[two-byte decimal display]' + {--two-bytes-octal,-o}'[two-byte octal display]' + {--two-bytes-hex,-x}'[two-byte hexadecimal display]' + {--format=,-e+}'[specify format string to be used for displaying data]:format' + {--format-file=,-f+}'[specify file that contains format strings]:file:_files' +) +args=( + '(H -n --length)'{--length=,-n+}'[interpret only specified amount of input]:length (bytes)' + '(H -s --skip)'{--skip=,-s+}'[skip specified bytes at the beginning]:offset (bytes)' + '(H -v --no-squeezing)'{--no-squeezing,-v}'[output identical lines]' +) + +[[ $service = hexdump ]] && fmts+=( {--canonical,-C}'[canonical hex+ASCII display]' ) + +if [[ $OSTYPE = linux* ]]; then + args+=( + '(-L --color)'{-L+,--color=}'[interpret color formatting specifiers colors are enabled by default]:mode' + + H + '(- *)'{-h,--help}'[display usage information]' + '(- *)'{-V,--version}'[display version information]' + ) +else + # strip long options by taking every second element + print -v fmts -f '%2$s' -- "$fmts[@]" + print -v args -f '%2$s' -- "$args[@]" + optpar=( -A "-*" ) +fi + +_arguments -s -S $optpar '*:file:_files' $args + '(formats)' '(H)'$^fmts diff --git a/Completion/Unix/Command/_id b/Completion/Unix/Command/_id index 74fe6d9e1..a0a03faad 100644 --- a/Completion/Unix/Command/_id +++ b/Completion/Unix/Command/_id @@ -16,7 +16,7 @@ if _pick_variant gnu=GNU $OSTYPE --version; then '(- :)--version[display version]' \ ':user:_users' else - choices="-A -a -c -G -g -M -p -P -u" + choices="-A -a -c -G -g -M -p -P -R -u" args=( "($choices)-g[print only EGID]" "($choices -r)-G[print all GIDs]" @@ -31,6 +31,13 @@ else '(-g -G -u -n -r)-p[show project membership]' ) ;; + openbsd*) + args+=( + '(-)-c[display the login class]' + '(-)-p[make the output human readable]' + '(-)-R[display the routing table of the current process]' + ) + ;; darwin*|dragonfly*|freebsd*) args+=( '(-)-P[print id in the form of a password file entry]' ) ;| diff --git a/Completion/Unix/Command/_install b/Completion/Unix/Command/_install new file mode 100644 index 000000000..f5056b5d0 --- /dev/null +++ b/Completion/Unix/Command/_install @@ -0,0 +1,111 @@ +#compdef install ginstall + +local curcontext="$curcontext" lx ret=1 +local -a line state state_descr common_args args tmp +local -A opt_args val_args + +# These are *almost* common — non-GNU variants need to remove the long options +common_args=( + '(--backup)-b[create backups of destination files]' + '(-C -c --compare)'{-C,--compare}'[copy files; do nothing if identical destination file exists]' + '(-C -c --compare)-c[copy files (default)]' + '(-d --directory)'{-d,--directory}'[create directories]' + '(-g --group)'{-g+,--group=}'[specify destination file group]: :_groups' + '(-m --mode)'{-m+,--mode=}'[specify destination file mode]: :_modes' + '(-o --owner)'{-o+,--owner=}'[specify destination file owner]: :_users' + '(-p --preserve-timestamps)'{-p,--preserve-timestamps}'[preserve modification times]' + '(-s --strip)'{-s,--strip}'[strip binaries]' + '(-v --verbose)'{-v,--verbose}'[output verbosely]' + '*: :_files' +) + +if _pick_variant gnu='Free Soft' unix --version; then + # Hide Linux-specific options on non-Linux platforms + [[ $OSTYPE == linux* ]] || lx='!' + 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" + '-D[create all leading destination path components]' + '(: -)--help[display help information]' + "${lx}--preserve-context[preserve SELinux security context]" + '--strip-program=[specify program used to strip binaries]:strip program:_files' + '(-S --suffix)'{-S+,--suffix=}'[specify backup suffix]:backup suffix' + '(-t --target-directory)'{-t+,--target-directory=}'[copy source to specified directory]: :_directories' + '(-T --no-target-directory)'{-T,--no-target-directory}'[treat destination as regular file]' + '(: -)--version[display version information]' + "${lx}-Z[set SELinux security context on destination files to default type]" + ) + +else + args+=( + ${common_args##((#s)|*\))(\*|)--*} + '-B+[specify backup suffix for -b]:backup suffix' + '-f+[specify destination file flags]: :_flags' + ) + [[ $OSTYPE == dragonfly* ]] && args+=( + '!-D+[no effect (compatibility with NetBSD)]: :_directories' + '-L+[use user/group database files from specified directory]: :_directories' + '-l[fall back to system files if user/group not found in -L directory]' + ) + [[ $OSTYPE == netbsd* ]] && args+=( + '-a+[specify shell command to run on files after install]:shell command' + '-r[use temporary files to perform safe copy]' + '-S+[specify arguments to pass to strip program]:arguments to strip program' + ) + [[ $OSTYPE == (net|open)bsd* ]] && { + # (Net|Open)BSD has no -v for some reason + args=( ${args##((#s)|*\))(\*|)-v*} ) + } + [[ $OSTYPE == openbsd* ]] && args+=( + '-D[create all leading destination path components]' + '-F[flush installed file contents to disk]' + ) + [[ $OSTYPE == (darwin|dragonfly)* ]] && args+=( + '-M[disable use of mmap(2)]' + ) + [[ $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]' + ) +fi + +_arguments -C -s -S : $args && ret=0 + +case $state in + controls) + tmp=( + {none,off}':never make backups' + {numbered,t}':make numbered backups' + {existing,nil}':make numbered backups if they already exist' + # 'never' actually means 'always'... + {simple,never}':make simple backups' + ) + _describe -t controls 'version control method' tmp && ret=0 + ;; + digests) + tmp=( none md5 rmd160 sha1 sha256 sha512 ) + [[ $OSTYPE == netbsd* ]] && tmp+=( sha384 ) + _values 'digest method' $tmp && ret=0 + ;; + linkflags) + tmp=( + 'h[hard links]' + 's[symlinks]' + 'm[mixed (hard links for files on same file system)]' + 'a[symlinks use absolute path]' + 'r[symlinks use relative path]' + ) + _values -S '' 'link flags' $tmp && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_iostat b/Completion/Unix/Command/_iostat index 88fc6a103..e95d62f80 100644 --- a/Completion/Unix/Command/_iostat +++ b/Completion/Unix/Command/_iostat @@ -1,6 +1,7 @@ #compdef iostat -local -a args +local -a args parser +parser=( -s -S -A '-*' ) case $OSTYPE:l in *bsd*) @@ -109,23 +110,32 @@ case $OSTYPE:l in ) ;; *linux*) + parser=( -s ) args=( '-c[display CPU utilization report]' '-d[display device utilization report]' - '-T[only display global statistics for group_name]' - '-g[display statistics for a group of devices]:group name' - '-h[human readable device utilization report]' - '-j[display persistent device name]' + '*-g[display statistics for a group of devices]:group name' + '-H[only display global statistics for group]' + '(--human)-h[human readable device utilization report]' + '--human[print sizes in human readable format]' + '-j[display persistent device name]:name type:(ID LABEL PATH UUID)' '(-m)-k[display statistics in kB/s]' '(-k)-m[display statistics in MB/s]' '-N[display registered device mapper names]' + '-o[display statistics in JSON]:format:(JSON)' + '-p[display statistics for block devices]' + '-t[display the time for each report]' + '(- *)-V[display version information]' + '-x[display extended statistics]' + '-y[omit first statistics report following system boot]' + '-z[omit output for devices lacking activity]' '*::device:_files -W /dev -g "*(-%)"' ) ;; esac if (( $#args )); then - _arguments -s -w -A '-*' : $args + _arguments $parser : $args return fi diff --git a/Completion/Unix/Command/_jq b/Completion/Unix/Command/_jq new file mode 100644 index 000000000..55bb93c04 --- /dev/null +++ b/Completion/Unix/Command/_jq @@ -0,0 +1,34 @@ +#compdef jq + +# last updated for jq-1.5-1-a5b5cbe (debian package 1.5+dfsg-1.3) + +# Note: +# Arguments to options must be in separate words. Thus, +# {-f,--from-file}'[foo]' +# is correct like that, without the usual {-f+,--from-file=} suffixes. +# +_arguments -S -s : \ + "--version[output jq's version number]" \ + "--seq[use application/json-seq ASCII RS/LF scheme in input and output]" \ + "--stream[parse input streamily (changes output)]" \ + '(-s --slurp)'{-s,--slurp}'[join input JSON objects to array before filtering]' \ + '(-R --raw-input)'{-R,--raw-input}'[consider each input line as a JSON strings]' \ + '(-n --null-input)'{-n,--null-input}'[input is ignored]' \ + '(-c --compact-output)'{-c,--compact-output}"[don't pretty-print]" \ + '(--indent)--tab[indent output using TAB characters]' \ + '(--tab)--indent[indent output using given number of spaces]:number of spaces (integer):(2 4 8)' \ + '(-C --color-output -M --monochrome-output)'{-C,--color-output}'[output in color]' \ + '(-C --color-output -M --monochrome-output)'{-M,--monochrome-output}'[output without color]' \ + '(-a --ascii-output)'{-a,--ascii-output}'[restrict output to ASCII]' \ + '--unbuffered[flush output after each JSON object]' \ + '(-S --sort-keys)'{-S,--sort-keys}'[output object keys in sorted order]' \ + '(-r --raw-output -j --join-output)'{-r,--raw-output}"[don't JSON-quote output if it's a string]" \ + '(-r --raw-output -j --join-output)'{-j,--join-output}"[like -r, without newlines between outputs]" \ + '(-f --from-file)'{-f,--from-file}'[read filter from file]:_files' \ + '-L+[prepend a directory to the module search path]:_directories' \ + '(-e --exit-status)'{-e,--exit-status}'[report "false" and "null" results via exit code]' \ + '*--arg[pre-set a variable to a string]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (string): ' \ + '*--argjson[pre-set a variable to an object]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (JSON): ' \ + '*--slurpfile[pre-set a variable to contents of a file]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (filename of file containing JSON):_files' \ + "1: :_guard '|[^-]' filter" \ + "*:_files" diff --git a/Completion/Unix/Command/_last b/Completion/Unix/Command/_last index f198e0fff..2013cc1c2 100644 --- a/Completion/Unix/Command/_last +++ b/Completion/Unix/Command/_last @@ -4,19 +4,20 @@ local pattern arg args ttys ttys=( /dev/tty*(N) /dev/pts/*(N) reboot ) ttys=( ${ttys#/dev/} ) +[[ $OSTYPE = linux-gnu ]] || args=( -A "-*" ) for pattern arg in \ - '(solaris*|linux-gnu)' '-a[display hostname in last column]' \ - '((free|net|open)bsd*|darwin*|dragonfly*|linux-gnu)' '-h[limit sessions by hostname]:host:_hosts' \ - '((free|open)bsd*|linux-gnu)' '-s[report duration in seconds]' \ - '(freebsd*|openbsd*)' '-d[limit sessions to those active at snapshot time]:time ([[CC]YY][MMDD]hhmm[.SS])' \ - '((net|free|open)bsd*|darwin*|dragonfly*)' '-t[limit sessions by tty]:tty:_ttys -D' \ + '(solaris*|linux-gnu)' '(--hostlast)-a[display hostname in last column]' \ + '((free|net|open)bsd*|darwin*|dragonfly*)' '-h+[limit sessions by hostname]:host:_hosts' \ + '((free|open)bsd*)' '-s[report duration in seconds]' \ + '(freebsd*|openbsd*)' '-d+[limit sessions to those active at snapshot time]:time ([[CC]YY][MMDD]hhmm[.SS])' \ + '((net|free|open)bsd*|darwin*|dragonfly*)' '-t+[limit sessions by tty]:tty:_ttys -D' \ 'openbsd*' '-c[calculate total time]' \ - '^darwin*' '-f[specify account file]:file:_files' \ - '(solaris*|linux-gnu|freebsd*|openbsd*)' '-n[specify number of lines to show]:number' \ + '^darwin*' '(--file)-f+[specify account file]:file:_files' \ + '(solaris*|linux-gnu|freebsd*|openbsd*)' '(--limit)-n+[specify number of lines to show]:number' \ '((open|net)bsd*|dragonfly*)' '-T[show more detailed time information including year and seconds]' \ 'netbsd*' '-x[assume file is in wtmpx(5) format]' \ 'netbsd*' '-n[show IP of remote hosts]' \ - 'freebsd*' '-w[show seconds in durarion field]' \ + 'freebsd*' '-w[show seconds in duration field]' \ 'freebsd*' '-y[show year in session start time]' do [[ $OSTYPE = $~pattern ]] && args+=( $arg ) @@ -32,14 +33,21 @@ case $OSTYPE in ;; linux-gnu) args+=( - '-R[suppress display of hostname field]' - '-d[translate IP to hostname]' - '-F[show full login and logout times and dates]' - '-i[show IP of remote hosts]' - '-o[read old-format wtmp]' - '-t[limit sessions to those active at snapshot time]:time (YYYYMMDDhhmmss)' - '-w[show full user and domain names]' - '-x[display shutdown/runlevel entries]' + '(-a)--hostlast[display hostname in last column]' + '(-d --dns -i --ip)'{-d,--dns}'[translate IP to hostname]' + '(-f)--file=[specify account file]:file:_files' + '(-F --fulltimes)'{-F,--fulltimes}'[show full login and logout times and dates]' + '(-i --ip -d --dns)'{-i,--ip}'[show IP of remote hosts]' + '(-n)--limit=[specify number of lines to show]:number' + '(-R --nohostname)'{-R,--nohostname}'[suppress display of hostname field]' + '(-s --since)'{-s+,--since=}'[display lines since the specified time]:time (YYYYMMDDhhmmss)' + '(-t --until)'{-t+,--until=}'[display lines until the specified time]:time (YYYYMMDDhhmmss)' + '(-p --present)'{-p+,--present=}'[display who were present at the specified time]:time (YYYYMMDDhhmmss)' + '(-w --fullnames)'{-w,--fullnames}'[show full user and domain names]' + '(-x --system)'{-x,--system}'[display shutdown/runlevel entries]' + '--time-format=[show timestamps in the specified format]:format:(notime short full iso)' + '(- *)'{-h,--help}'[display usage information]' + '(- *)'{-V,--version}'[display version information]' ) ;; esac @@ -50,4 +58,4 @@ else args+=( '*:user:_users' ) fi -_arguments -s $args +_arguments -s -S $args diff --git a/Completion/Unix/Command/_ldconfig b/Completion/Unix/Command/_ldconfig new file mode 100644 index 000000000..3c3fca538 --- /dev/null +++ b/Completion/Unix/Command/_ldconfig @@ -0,0 +1,81 @@ +#compdef ldconfig ldconfig.real + +local ret=1 +local -a args context line state state_descr +local -A opt_args + +case $OSTYPE in + linux*) + args=( + '(x -v --verbose)'{-v,--verbose}'[output verbosely]' \ + + x \ + '(: -)'{-\?,--help}'[display help information]' + '(: -)'{-p,--print-cache}'[display libraries in current cache]' + '(: -)--usage[display brief usage information]' + '(: -)'{-V,--version}'[display version information]' + + l + '(x o)-l[manually link individual libraries (library mode)]' + + o + '(x l -c --format)'{-c+,--format=}'[specify cache format]:cache format:(old new compat)' + '(x l)-C+[specify cache file to use instead of /etc/ld.so.cache]:cache file:_files' + '(x l)-f+[specify configuration file to use instead of /etc/ld.so.conf]:configuration file:_files' + '(x l -i --ignore-aux-cache)'{-i,--ignore-aux-cache}'[ignore auxiliary cache file]' + '(x l -N)-n[process only directories specified on command line (implies -N)]' + '(x l)-N[do not rebuild cache]' + '(x l)-r+[specify root directory]:root directory:_directories' + '(x l)-X[do not update symbolic links]' + ) + ;; + *bsd*|dragonfly*) + args=( + '(-U)-m[merge into the existing hints file]' + '(: -)-r[list the current contents of the hints file]' + );| + dragonfly*|freebsd*|openbsd*) + args+=( + '(-U)-R[rescan previously configured directories]' + );| + dragonfly*|freebsd*) + args+=( + '(-aout)-elf[generate hints for elf format shared libraries]' + '-f+[specify hints file]:hints file:_files' + '-i[run in insecure mode]' + );| + freebsd*|netbsd*|openbsd*) + args+=( + '-v[switch on verbose mode]' + );| + freebsd*|openbsd*) + args+=( + '-s[do not scan /usr/lib for shared libraries]' + );| + freebsd*) + args+=( + '-32[generate hints for 32-bit ABI shared libraries]' + '(-elf)-aout[generate hints for a.out format shared libraries]' + );| + netbsd*) + args+=( + '(-s)-c[do not scan directories in /etc/ls.so.conf]' + '(-s)-S[do not scan /usr/lib for shared libraries]' + '-s[do not scan /usr/lib or directories in /etc/ld.so.conf for shared libraries]' + );| + openbsd*) + args+=( + '(-m)-U[unconfigure specified directories or inaccessable directories if none specified]' + );| +esac + +_arguments -s -S : \ + '(x)*: :->files' \ + $args \ +&& ret=0 + +[[ $state == files ]] && +if [[ -n ${opt_args[(I)l--l]} ]]; then + _object_files && ret=0 +else + _directories && ret=0 +fi + +return ret diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less index 9092010f2..7f01952d2 100644 --- a/Completion/Unix/Command/_less +++ b/Completion/Unix/Command/_less @@ -91,7 +91,7 @@ _arguments -S -s -A "[-+]*" \ if [[ -n "$state" ]]; then case $state in prompts) - if compset -P \?; then + if compset -p 1; then _message -e prompt else _describe 'prompt' '( diff --git a/Completion/Unix/Command/_ln b/Completion/Unix/Command/_ln index efb982aba..764dc8f99 100644 --- a/Completion/Unix/Command/_ln +++ b/Completion/Unix/Command/_ln @@ -3,19 +3,11 @@ local curcontext="$curcontext" state line ret=1 local -A opt_args -local -a args bsd +local -a args opts args=( - '-f[remove existing destination files]' + '(-i)-f[remove existing destination files]' '-s[create symbolic links instead of hard links]' ) -bsd=( - '-F[remove existing destination directories]' - {-h,-n}'[do not dereference destination]' - '-i[prompt before removing destination files]' - '-v[print name of each linked file]' -) - -local -a opts local variant _pick_variant -r variant gnu=gnu unix --help @@ -50,18 +42,40 @@ elif (( ${+builtins[ln]} )); then args+=( '-d[attempt to hard link directories]' {-h,-n}'[do not dereference destination]' - '-i[prompt before removing destination files]') -elif [[ $OSTYPE == darwin* ]]; then - args+=( $bsd ) -elif [[ $OSTYPE == freebsd* ]]; then - args+=( $bsd - '(-L)-P[create hard links directly to symbolic links]' - '(-P)-L[create hard links to symbolic link references]' - "-w[warn if source of a symbolic link doesn't currently exist]" - ) + '(-f)-i[prompt before removing destination files]') +else + case $OSTYPE in + darwin*|dragonfly*|freebsd*|netbsd*|openbsd*) + args+=( + {-h,-n}'[do not dereference destination]' + ) + ;| + darwin*|dragonfly*|freebsd*|netbsd*) + args+=( + '(-f)-i[prompt before removing destination files]' + '-v[print name of each linked file]' + ) + ;| + darwin*|dragonfly*|freebsd*) + args+=( + '-F[remove existing destination directories]' + ) + ;| + dragonfly*|freebsd*|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]" + ) + ;; + esac fi -_arguments -C -s $opts \ +_arguments -C -s $opts : \ $args \ ':link target:_files' \ '*:: :->files' && ret=0 diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls index 955b0894d..ea96de6ff 100644 --- a/Completion/Unix/Command/_ls +++ b/Completion/Unix/Command/_ls @@ -168,6 +168,7 @@ else '--color=-[control use of color]:color:(never always auto)' "*--hide=[like -I, but overridden by -a or -A]:pattern: " + '--hyperlink=[output terminal codes to link files using file::// URI]::when:(none auto always)' '(--classify -F --indicator-style -p --file-type)'{--classify,-F}'[append file type indicators]' '(--file-type -p --indicator-style -F --classify)--file-type[append file type indicators except *]' '(--file-type -p --indicator-style -F --classify)-p[append / to directories]' @@ -176,7 +177,7 @@ else '(-f)--full-time[list both full date and full time]' '(--block-size --human-readable -h --si --kilobytes -k)'{--kilobytes,-k}'[use block size of 1k]' - '(--human-readable -h --si --kilobytes -k)--block-size=[specify block size]:block size (bytes):(1024)' + '(--human-readable -h --si --kilobytes -k)--block-size=[specify block size]:block size (bytes):(K M G T P E Z Y KB MB TB PB EB ZB YB)' '(--numeric-uid-gid -n)'{--numeric-uid-gid,-n}'[numeric uid, gid]' '(--tabsize -T)'{--tabsize=,-T+}'[specify tab size]:tab size' diff --git a/Completion/Unix/Command/_lsof b/Completion/Unix/Command/_lsof index bbb6eab59..86115a4ef 100644 --- a/Completion/Unix/Command/_lsof +++ b/Completion/Unix/Command/_lsof @@ -1,6 +1,6 @@ #compdef lsof -local curcontext="$curcontext" state line expl fields args +local curcontext="$curcontext" state line expl fields args alts suf hsuf pref ret=1 case $OSTYPE in linux*) args=( '-X[skip reporting of info on network connections]' ) ;; @@ -28,8 +28,8 @@ _arguments -C -s -S $args \ '+f[enable listing of kernel file structure info]::info type:(c f g G n)' \ '-F[select output fields]:fields:->fields' \ '-g[select by process group id]::process group id' \ - '*-i[select internet files]:address' \ - '-K[select listing of tasks of processes]' \ + '(*)*-i[select internet files]::address:->addresses' \ + '-K+[select listing of tasks of processes]::value:((i\:ignore\ tasks))' \ '-k[specify kernel name list file]:kernel file:_files' \ '-l[inhibit conversion of UIDs to user names]' \ '-L[list no link counts]' \ @@ -46,7 +46,7 @@ _arguments -C -s -S $args \ '-r[repeat listing endlessly]::delay (seconds)' \ '+r[repeat listing until no files listed]::delay (seconds)' \ '-R[list parent PID]' \ - '(-o)-s[list file size]' \ + '(-o)-s+[list file size or exclude TCP/UDP files by state]::state:->states' \ '-S[specify timeout for kernel functions that might deadlock]:timeout (seconds)' \ '-T[select reporting of TCP/TPI info]::info type:((q\:queue\ length\ reporting s\:state\ reporting w\:window\ size\ reporting))' \ '(+w -w)-t[terse output]' \ @@ -57,18 +57,52 @@ _arguments -C -s -S $args \ '(-t)+w[suppress warnings]' \ '(-t)-w[enable warnings]' \ '-x[cross filesystems/traverse symlinks with +d/+D]::type:((f\:filesystems s\:symlinks))' \ - '*:file:_files' && return + '*:file:_files' && ret=0 case $state in + addresses) + if compset -P 1 '*:'; then + _ports && ret=0 + else + if compset -P 1 '*@'; then + pref=() + else + pref=( -P @ ) + suf=( -qS @ ) + [[ $PREFIX = (#i)(4|6|tcp|udp)* ]] || alts=( 'ip-versions:IP version:(4 6)' ) + compset -P '[46]' + alts+=( 'protocols:protocol:compadd $suf -M 'm:{a-z}={A-Z}' TCP UDP' ) + fi + if compset -S '@*'; then + suf=() + else + hsuf=( -qS : ) + compset -S ':*' && hsuf=() + alts+=( "hosts:host:_hosts $pref $hsuf" ) + fi + + _alternative $alts && ret=0 + fi + ;; fields) fields=( ${${${${(f)"$($words[1] -F \? 2>&1)"}[2,-1]#??}// ##/:}:#(#s)[${PREFIX:-:}]:*} ) compset -P '*' - _describe -t fields "field" fields -S '' && return + _describe -t fields "field" fields -S '' && ret=0 ;; filedes) _sequence -s , _wanted -x file-descriptors expl "file descriptor" compadd - \ - cwd err jld ltz mem mmap pd rtd tr txt v86 && return + cwd err jld ltz mem mmap pd rtd tr txt v86 && ret=0 + ;; + states) + if compset -P 1 '*:'; then + _sequence _wanted states expl state compadd - -M 'm:{a-z}={A-Z}' \ + CLOSED IDLE BOUND LISTEN ESTABLISHED SYN_SENT SYN_RCDV ESTABLISHED \ + CLOSE_WAIT FIN_WAIT1 CLOSING LAST_ACK FIN_WAIT_2 TIME_WAIT && ret=0 + else + compset -S ':*' || suf=( -qS : ) + _wanted protocols expl protocol compadd $suf -M 'm:{a-z}={A-Z}' TCP UDP && ret=0 + fi ;; esac -return 1 +return ret diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make index a2ee9ecac..1761bba71 100644 --- a/Completion/Unix/Command/_make +++ b/Completion/Unix/Command/_make @@ -69,7 +69,7 @@ _make-expandVars() { } _make-parseMakefile () { - local input var val target dep TAB=$'\t' dir=$1 tmp IFS= + local input var val target dep TAB=$'\t' tmp IFS= while read input do @@ -108,14 +108,10 @@ _make-parseMakefile () { f=${f%[\">]} fi f=$(_make-expandVars $f) - case $f in - (/*) ;; - (*) f=$dir/$f ;; - esac if [[ -r $f ]] then - _make-parseMakefile ${f%%/[^/]##} < $f + _make-parseMakefile < $f fi ;; esac @@ -150,7 +146,7 @@ _make-findBasedir () { _make() { - local prev="$words[CURRENT-1]" file expl tmp is_gnu dir incl match + local prev="$words[CURRENT-1]" file expl tmp is_gnu incl match local context state state_descr line local -a option_specs local -A VARIABLES VAR_ARGS opt_args @@ -266,16 +262,16 @@ _make() { if [[ $is_gnu == gnu ]] then if zstyle -t ":completion:${curcontext}:targets" call-command; then - _make-parseMakefile $PWD < <(_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" .PHONY 2> /dev/null) else - _make-parseMakefile $PWD < $file + _make-parseMakefile < $file fi else if [[ $OSTYPE == (freebsd|dragonfly|netbsd)* || /$words[1] == */bmake* ]]; then TARGETS+=(${=${(f)"$(_call_program targets "$words[1]" -s -f "$file" -V.ALLTARGETS 2> /dev/null)"}}) - _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsdg1Fstdout -f "$file" .PHONY 2> /dev/null) + _make-parseMakefile < <(_call_program targets "$words[1]" -nsdg1Fstdout -f "$file" .PHONY 2> /dev/null) else - _make-parseMakefile $PWD < $file + _make-parseMakefile < $file fi fi fi @@ -287,14 +283,10 @@ _make() { compset -P 1 '*=' _value "$@" && ret=0 else - _tags targets variables - while _tags - do - _requested targets expl 'make targets' \ - compadd -Q -- $TARGETS && ret=0 - _requested variables expl 'make variables' \ - compadd -S '=' -F keys -- ${(k)VARIABLES} && ret=0 - done + _alternative \ + 'targets:make target:compadd -Q -a TARGETS' \ + 'variables:make variable:compadd -S = -F keys -k VARIABLES' \ + '*:file:_files' && ret=0 fi esac diff --git a/Completion/Unix/Command/_metaflac b/Completion/Unix/Command/_metaflac deleted file mode 100644 index 65b9eb292..000000000 --- a/Completion/Unix/Command/_metaflac +++ /dev/null @@ -1,54 +0,0 @@ -#compdef metaflac - -local _metaflac_opts _metaflac_shorts _metaflac_opers - -_metaflac_opts=( - '--preserve-modtime' - '--with-filename[prefix output with filename]' - '--no-filename' - '--no-utf8-convert' - '--dont-use-padding[always rewrite the file]' -) -_metaflac_shorts=( - '--show-md5sum' - '--show-min-blocksize' - '--show-max-blocksize' - '--show-min-framesize' - '--show-max-framesize' - '--show-sample-rate' - '--show-channels' - '--show-bps' - '--show-total-samples' - '--show-vendor-tag' - '--show-tag=:FLAC tags' - '--remove-tag=:FLAC tags: ' - '--remove-first-tag=:FLAC tags: ' - '--remove-all-tags' - '--set-tag=:FLAC tag and value: ' - '--import-tags-from=:flat file:_files' - '--export-tags-to=:new file: ' - '--import-cuesheet-from=:file:_files' - '--export-cuesheet-to=:new file: ' - '--add-replay-gain' - '--add-seekpoint=:: ' - '--add-padding=length' - -) -_metaflac_opers=( - '--block-number=:: ' - '--block-type=:: ' - '--except-block-type=:: ' - '--application-data-format=:: ' - '--list' - '--remove' - '--remove-all' - '--merge-padding' - '--sort-padding' -) - -_arguments "$_metaflac_opts[@]" \ - "*:FLAC file:_files -g \*.flac\(-.\)" \ - - "shortcuts" \ - "$_metaflac_shorts[@]" \ - - "(operations)" \ - "$_metaflac_opers[@]" diff --git a/Completion/Unix/Command/_mkdir b/Completion/Unix/Command/_mkdir index f2299f7c7..53536b01d 100644 --- a/Completion/Unix/Command/_mkdir +++ b/Completion/Unix/Command/_mkdir @@ -4,35 +4,26 @@ local curcontext="$curcontext" state line expl args variant ret=1 typeset -A opt_args args=( - '(-m --mode)'{-m,--mode=}'[set permission mode]:numeric mode' + '(-m --mode)'{-m,--mode=}'[set permission mode]: :_file_modes' '(-p --parents)'{-p,--parents}'[make parent directories as needed]' '(-)*: :->directories' ) -case "$OSTYPE" in - linux*) - args+=( - '(-Z --context)'{-Z,--context=}'[set SELinux context]:SELinux context' - ) - ;; -esac - -_pick_variant -r variant gnu=gnu zsh='\(eval\)' $OSTYPE --help # 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. - -# I currently don't know of any way to find out what precommands are present on -# the line. The variant should be modified like this once a way is found out: - -# if [[ $variant == zsh ]]; then -# if [[ $precommand = *command* ]]; then -# _mkdir_command () { command mkdir "$@" } -# _pick_variant -c _mkdir_command -r variant gnu=gnu unix --help -# fi -# elif [[ $precommand = *builtin* ]]; then -# variant=zsh -# fi +# +# $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. case $variant in gnu|freebsd*|dragonfly*) @@ -41,13 +32,17 @@ case $variant in ) ;| gnu) + if [[ $OSTYPE == linux* ]]; then + args+=( + '(-Z --context)'{-Z,--context=}'[set SELinux context]:SELinux context' + ) + fi args+=( '(- :)--help[display help information]' '(- :)--version[display version information]' ) ;; zsh) # remove all options - args=( '*: :->directories' ) ;; *) # non-GNU: remove long options args=( ${${${args:#(|*\))--*}//--[^ )]#/}/\( #\)/} ) diff --git a/Completion/Unix/Command/_mktemp b/Completion/Unix/Command/_mktemp new file mode 100644 index 000000000..4b5bf99f7 --- /dev/null +++ b/Completion/Unix/Command/_mktemp @@ -0,0 +1,43 @@ +#compdef mktemp gmktemp + +local variant +local args + +_pick_variant -r variant busybox=BusyBox gnu='Free Soft' unix --version + +args=( + '(-d --directory)'{-d,--directory}'[make directory instead of file]' + '(: -)--help[display help information]' + '(-p --tmpdir)'{-p+,--tmpdir=}'[make relative to specified directory]: :_directories' + '(-q --quiet)'{-q,--quiet}'[suppress error messages]' + '--suffix=[append specified suffix to template]:template suffix' + '-t[interpret template as single path component relative to temp dir]' + '(-u --dry-run)'{-u,--dry-run}'[print file name only]' + '(: -)'{-V,--version}'[display version information]' + '1: :_guard "^-*" "template name"' +) + +# Non-GNU variants don't support long options (except BusyBox's --help) +if [[ $variant == *busybox* ]]; then # See also: _busybox + args=( ${args:#((#s)|*\))(\*|)--^help*} ) +elif [[ $variant != gnu ]]; then + args=( ${args:#((#s)|*\))(\*|)--*} ) +fi + +[[ $variant == gnu ]] || { + # BusyBox, OpenBSD, and Solaris have -p, but -t doesn't take an argument + if [[ $variant == *busybox* ]] || [[ $OSTYPE == (openbsd|solaris)* ]]; then + args=( ${args:#((#s)|*\))(\*|)-t*} ) + args+=( '-t[generate template relative to temp dir]' ) + # Dragonfly, FreeBSD, and Darwin take an argument to -t and support any number + # of template files + else + args=( ${args:#((#s)|*\))(1:*|(\*|)-t*)} ) + args+=( + '-t[generate template relative to temp dir using specified prefix]:template prefix' + '*: :_guard "^-*" "template name"' + ) + fi +} + +_arguments -s -S : $args diff --git a/Completion/Unix/Command/_mosh b/Completion/Unix/Command/_mosh index 431fdbf9e..7d1250320 100644 --- a/Completion/Unix/Command/_mosh +++ b/Completion/Unix/Command/_mosh @@ -1,6 +1,6 @@ #compdef mosh -local curcontext="$curcontext" state line +local curcontext="$curcontext" state line expl ret=1 local -a _comp_priv_prefix _arguments -C \ @@ -12,15 +12,30 @@ _arguments -C \ '(-a -n)--predict=[control speculative local echo]:mode:(adaptive always never)' \ '(--predict -n)-a[synonym for --predict=always]' \ '(--predict -a)-n[synonym for --predict=never]' \ + '(--family -6)-4[use IPv4 only]' \ + '(--family -4)-6[use IPv6 only]' \ + '(-4 -6)--family=[specify address family]:family [prefer-inet]:(inet inet6 auto all prefer-inet prefer-inet6)' \ + '--bind-server=[ask the server to reply from an IP address]:{ssh|any|IP}' \ '--server[specify command to run server helper]:remote file:_files' \ '--client[specify command to run client helper]:_command_names -e' \ + "--no-ssh-pty[don't allocate a pseudo tty on ssh connection]" \ + '--local[run mosh-server locally without using ssh]' \ + '--experimental-remote-ip=[select method for discovering remote IP address to use for mosh]:method:(local remote proxy)' \ '1:remote host name:->userhost' \ - '*:::args:_normal' && return + '*:::args:_normal' && ret=0 case $state in userhost) - _hosts || _user_at_host && return + if compset -P '*@'; then + _wanted hosts expl 'remote host name' _ssh_hosts && ret=0 + elif compset -S '@*'; then + _wanted users expl 'login name' _combination -s '[:@]' my-accounts users-hosts users -S '' && ret=0 + else + _alternative \ + 'hosts:remote host name:_ssh_hosts' \ + 'users:login name:_combination -s "[:@]" my-accounts users-hosts users -qS@' && ret=0 + fi ;; esac -return 1 +return ret diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc index fee5e06f4..45d93550d 100644 --- a/Completion/Unix/Command/_mpc +++ b/Completion/Unix/Command/_mpc @@ -53,6 +53,7 @@ _mpc_command() { play:"start playing" playlist:"print the current playlist" prev:"play the previous song in the current playlist" + prio:"change song priorities in the queue" random:"toggle random mode, or specify state" repeat:"toggle repeat mode, or specify state" single:"toggle single mode, or specify state" diff --git a/Completion/Unix/Command/_mtr b/Completion/Unix/Command/_mtr index 5eda9bc1a..806e344d1 100644 --- a/Completion/Unix/Command/_mtr +++ b/Completion/Unix/Command/_mtr @@ -1,22 +1,60 @@ #compdef mtr -_arguments -C \ - '(-h --help)'{-h,--help}'[help]' \ - '(-v --version)'{-v,--version}'[version]' \ - '(-r --report)'{-r,--report}'[report mode]' \ - '(-w --report-wide)'{-w,--report-wide}'[wide report mode\: do not truncate hostnames]' \ - '(-c --report-cycles)'{-c,--report-cycles}'[report cycles]:number of pings' \ - '(-s --psize)'{-s,--psize}'[packet size]:number of bytes' \ - '(-t --curses)'{-t,--curses}'[curses UI]' \ - '(-e --mpls)'{-e,--mpls}'[display ICMP MPLS information]' \ - '(-o --order)'{-o,--order}'[order output fields]:fields order' \ - '(-n --no-dns)'{-n,--no-dns}'[no DNS lookups]' \ - '(-g --gtk)'{-g,--gtk}'[GTK+ UI]' \ - '(-p --split)'{-p,--split}'[output for a split-user interface]' \ - '(-l --raw)'{-l,--raw}'[raw output format]' \ - '(-a --address)'{-a,--address}'[source address]:source IP:_hosts' \ - '(-i --interval)'{-i,--interval}'[ping interval]:number of seconds' \ - '-u[use UDP instead of ICMP echo]' \ - '-4[use IPv4 only]' \ - '-6[use IPv6 only]' \ - ':destination host:_hosts' +_arguments -s -S \ + '(H -F --filename)'{-F,--filename}'[read hostnames from a file]' \ + '(H -6)-4[use IPv4 only]' \ + '(H -4)-6[use IPv6 only]' \ + '(H -a --address)'{-a+,--address=}'[bind outgoing packets to specific interface]:source IP:_hosts' \ + '(H -f --first-ttl)'{-f+,--first-ttl=}'[specify TTL to start]:TTL [1]' \ + '(H -m --max-ttl)'{-m+,--max-ttl=}'[specify maximum number of hops to probe]:hops [30]' \ + '(H -U --max-unknown)'{-U+,--max-unknown=}'[specify maximum unknown hosts]:maximum [5]' \ + '(H -P --port)'{-P+,--port=}'[specify target port for TCP, SCTP or UDP]:port' \ + '(H -L --localport -T --tcp -S --sctp)'{-L+,--localport=}'[specify source port number for UDP]' \ + '(H -s --psize 2)'{-s+,--psize=}'[packet size]:packet size (bytes)' \ + '(H -B --bitpattern)'{-B+,--bitpattern=}'[specify bit pattern to use in payload]:number (0-255)' \ + '(H -i --interval)'{-i+,--interval=}'[specify ping interval]:interval (seconds)' \ + '(H -G --gracetime)'{-G+,--gracetime=}'[specify time to wait for responses]:wait time (seconds)' \ + '(H -Q --tos)'{-Q+,--tos=}'[specify type of service for IP header]:tos (0-255)' \ + '(H -e --mpls)'{-e,--mpls}'[display ICMP MPLS information]' \ + '(H -Z --timeout)'{-Z+,--timeout=}'[specify how long to keep probe sockets open before giving up on the connection]:timeout (seconds)' \ + '(H -M --mark)'{-M+,--mark=}'[mark each sent packet]:mark' \ + '(H -r --report)'{-r,--report}'[report mode]' \ + '(H -w --report-wide)'{-w,--report-wide}"[wide report mode\: don't truncate hostnames]" \ + '(H -c --report-cycles)'{-c+,--report-cycles=}'[report cycles]:number of pings' \ + '(H)--displaymode=[select initial display mode]:display mode:((0\:statistics 1\:stripchart\ with\ latency 2\:stripchart\ without\ latency))' \ + '(H -n --no-dns)'{-n,--no-dns}'[no DNS lookups]' \ + '(H -b --show-ips)'{-b,--show-ips}'[show both IP numbers and host names]' \ + '(H -o --order)'{-o+,--order=}'[specify order of output fields]: :_values -S "" "field order" + "L[loss ratio]" + "D[dropped packets]" + "R[received packets]" + "S[sent packets]" + "N[newest RTT]" + "B[min/best RTT]" + "A[average RTT]" + "W[max/worst RTT]" + "V[standard deviation]" + "G[geometric mean]" + "J[current jitter]" + "M[jitter mean/average]" + "X[worst jitter]" + "I[interarrival jitter]"' \ + '(H -z --aslookup -y --ipinfo)'{-y+,--ipinfo=}'[select IP information in output]:information:((0\:display\ AS\ number 1\:display\ IP\ prefix 2\:display\ country\ code 3\:display\ RIR 4\:display\ allocation\ date))' \ + '(H -y --ipinfo -z --aslookup)'{-z,--aslookup}'[display AS number]' \ + '(H)1:destination host:_hosts' \ + '(H)2:packet size (bytes)' \ + + '(H)' \ + '(- 1 2)'{-h,--help}'[display help information]' \ + '(- 1 2)'{-v,--version}'[display version information]' \ + + '(proto)' \ + '(H)'{-u,--udp}'[use UDP instead of ICMP echo]' \ + '(H -s --psize)'{-T,--tcp}'[use TCP instead of ICMP echo]' \ + '(H)'{-S,--sctp}'[use SCTP instead of ICMP echo]' \ + + '(output)' \ + '(H)'{-t,--curses}'[curses UI]' \ + '(H)'{-g,--gtk}'[GTK+ UI]' \ + '(H)'{-p,--split}'[output for a split-user interface]' \ + '(H)'{-l,--raw}'[output raw format]' \ + '(H)'{-C,--csv}'[output comma separated values]' \ + '(H)'{-j,--json}'[output JSON]' \ + '(H)'{-x,--xml}'[output XML]' diff --git a/Completion/Unix/Command/_mv b/Completion/Unix/Command/_mv new file mode 100644 index 000000000..3592efee6 --- /dev/null +++ b/Completion/Unix/Command/_mv @@ -0,0 +1,42 @@ +#compdef mv gmv + +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 + +_arguments -s -S $args \ + '*:file:_files' diff --git a/Completion/Unix/Command/_netcat b/Completion/Unix/Command/_netcat index 4e4006b30..250d4c85d 100644 --- a/Completion/Unix/Command/_netcat +++ b/Completion/Unix/Command/_netcat @@ -6,11 +6,12 @@ if [[ $service = nc ]] && ! _pick_variant netcat=connect nedit -h; then return fi -if (( ! $+_nc_args )); then +if (( ! $#_cache_nc_args )); then + typeset -ga _cache_nc_args local help="$(_call_program options $words[1] -h < /dev/null 2>&1)" local -A optionmap optionmap=( - '*-e prog*' '-e+[program to exec after connect]:prog:_command_names -e' + '*-e prog*' '-e+[program to exec after connect]:program:_command_names -e' '*-g gateway*' '-g+[source-routing hop point]:gateway:_hosts' '*-G num*' '-G[source-routing pointer: 4, 8, 12]' '*-i secs*' '-i+[delay interval for lines sent or ports scanned]:delay (secs)' @@ -28,10 +29,10 @@ if (( ! $+_nc_args )); then '*-x*' '-x' '*-b*' '-b[allow broadcasts]' ) - _nc_args=($optionmap[(K)"$help"]) + _cache_nc_args=( $optionmap[(K)"$help"] ) fi _arguments -s \ - "$_nc_args[@]" \ + "$_cache_nc_args[@]" \ ':host:_hosts' \ ':port:_ports' diff --git a/Completion/Unix/Command/_notmuch b/Completion/Unix/Command/_notmuch index d6cc58deb..6174d2c00 100644 --- a/Completion/Unix/Command/_notmuch +++ b/Completion/Unix/Command/_notmuch @@ -6,12 +6,16 @@ _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' @@ -30,7 +34,9 @@ _notmuch_help_topics() { local -a notmuch_help_topics notmuch_help_topics=( - 'search-terms:show common search-terms syntax' + '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 } diff --git a/Completion/Unix/Command/_numfmt b/Completion/Unix/Command/_numfmt new file mode 100644 index 000000000..999c412a1 --- /dev/null +++ b/Completion/Unix/Command/_numfmt @@ -0,0 +1,24 @@ +#compdef numfmt gnumfmt + +local units="((auto\:1K\ =\ 1000,\ 1Ki\ =\ 1024 si\:1K\ =\ 1000 iec\:1K\ =\ 1024 iec-i\:1Ki\ =\ 1024))" + +_arguments -S \ + '(H)--debug[print warnings about invalid input]' \ + '(H -z --zero-terminated -d --delimiter)'{-d+,--delimiter=}'[use specified field delimiter instead of whitespace]:delimiter' \ + '(H)--field=[replace numbers in specified input fields]:fields [1]' \ + '(H)--format=[use printf style floating-point format]:format' \ + "(H)--from=[auto-scale input numbers to specified units]:unit [none]:$units" \ + '(H)--from-unit=[specify the input unit size]:unit size [1]' \ + '(H)--grouping[use locale-defined digit grouping e.g. 1,000,000]' \ + '(H)--header=-[print (without converting) initial header lines]::header lines [1]' \ + '(H)--invalid=[specify failure mode for invalid numbers]:mode [abort]:(abort fail warn ignore)' \ + '(H)--padding=[pad the output to specified width]:width; positive - right-align; negative - left-align' \ + '(H)--round=[use specified method for rounding when scaling]:method [from-zero]:(up down from-zero towards-zero nearest)' \ + '(H)--suffix=[add suffix to output numbers and accept optional suffix in input numbers]:suffix' \ + "(H)--to=[auto-scale output numbers to specified unit]:unit:$units" \ + '(H)--to-unit=[specify output unit size]:unit size [1]' \ + '(H -z --zero-terminated -d --delimiter)'{-z,--zero-terminated}'[line delimiter is NUL, not newline]' \ + '(H)*: :_guard "^-*" number' \ + + 'H' \ + '(- *)--help[display usage information]' \ + '(- *)--version[display version information]' diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump index cc213d911..ee2f3ea6f 100644 --- a/Completion/Unix/Command/_objdump +++ b/Completion/Unix/Command/_objdump @@ -1,3 +1,175 @@ -#compdef objdump +#compdef objdump eu-objdump llvm-objdump -_arguments -- '*:object file:_object_files' +local opts args files variant curcontext=$context state state_descr line ret=1 +typeset -A opt_args + +files='*:object file:_object_files' + +_pick_variant -r variant binutils=GNU elfutils=elfutils llvm=LLVM unix --version + +opts=( -s -S ) # options for _arguments +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)" +) + +case $variant in + binutils) + 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]" + + "*-W-[Display DWARF info in the file]::dwarf section:->short_dwarf_names" + "*--dwarf=-[Display DWARF info in the file]::dwarf section:->dwarf_names" + + "(-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> + + "(- *)"{-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" + + "(-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\"))" + + "--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]" + + "--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]" + ) + ;; + elfutils) + args+=( + "--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]' + '-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]" + '(-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' + '-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]' + '-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]' + '-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]' + '(-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-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]' + '-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]' + '-private-header[display only the first format specific file header]' + '(-private-headers -p)'{-private-headers,-p}'[display format specific file headers]' + '-r[display the relocation entries in the file]' + '-raw-clang-ast[dump raw binary contents of clang AST section]' + '-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-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]' + '-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]' + '-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]' + ) + ;; +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 + ;; + 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 + ;; + bfdname) + _values "object format" "${(z)${(@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 + ;; + 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:}/ -*}}" + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_od b/Completion/Unix/Command/_od index db75b3f96..aba400660 100644 --- a/Completion/Unix/Command/_od +++ b/Completion/Unix/Command/_od @@ -27,7 +27,7 @@ if _pick_variant gnu=GNU unix --version; then args+=( '--traditional' '--endian=[swap input bytes]:endianess:(big little)' - {-S+,--strings=-}'[output strings of at least specfied bytes long]:length' + {-S+,--strings=-}'[output strings of at least specified bytes long]:length' {-w-,--width=-}'[output specified bytes per line]:bytes' '(- : *)--help[display help and exit]' '(- : *)--version[output version information and exit]' diff --git a/Completion/Unix/Command/_paste b/Completion/Unix/Command/_paste index 6efe8eacb..d9598bfef 100644 --- a/Completion/Unix/Command/_paste +++ b/Completion/Unix/Command/_paste @@ -1,4 +1,4 @@ -#compdef paste +#compdef paste gpaste local -a args local dopt='[specify delimiter list]:delimiter list [tab]' diff --git a/Completion/Unix/Command/_ping b/Completion/Unix/Command/_ping index a1a50e11f..2efe545c6 100644 --- a/Completion/Unix/Command/_ping +++ b/Completion/Unix/Command/_ping @@ -1,69 +1,208 @@ -#compdef ping +#compdef ping ping6 -if _pick_variant iputils=iputils unix -V; then - - _arguments \ - '-a[audible]' \ - '-A[adaptive]' \ - '-b[allow pinging a broadcast address]' \ - '-B[do not allow ping to change source address]' \ - '-c:count' \ - '-d[set SO_DEBUG on the socket]' \ - '-f[flood ping]' \ - '-i:interval in seconds' \ - '-I:iface:_net_interfaces' \ - '-l:preload number' \ - '-L[suppress loopback of multicast packets]' \ - '-n[numeric output only]' \ - '-p:padding pattern' \ - '-Q:QoS TOS bits' \ - '-q[quiet]' \ - '-r[bypass normal routing tables]' \ - '-R[record route]' \ - '-s:packet size in bytes' \ - '-S:sndbuf' \ - '-t:timeout in seconds' \ - '-T:timestamp option:(tsonly tsandaddr tsprespec)' \ - '-M:Path MTU Discovery strategy:((do\:prohibit\ fragmentation want\:fragment\ locally dont\:do\ not\ set\ DF\ flag))' \ - '-U[print full user-to-user latency]' \ - '-v[verbose]' \ - '-w:deadline in seconds' \ - '-W:seconds to wait for a response' \ - ':host:_hosts' - -else +local variant +local -a args - _arguments \ - '-A[audible for no packet]' \ - '-a[audible for each packet]' \ - '-c:count' \ - "-D[set the don't fragment bit]" \ - '-d[set SO_DEBUG on the socket]' \ - '-f[flood ping]' \ - '-G[specify maximum size for ICMP payload for sweeping pings]:size' \ - '-g[specify minimum size for ICMP payload for sweeping pings]:size [0]' \ - '-h[specify size increment for ICMP payload for sweeping pings]:size [1]' \ - '-i:wait seconds' \ - '-I[source interface for multicast packets]:iface:_net_interfaces' \ - '-L[suppress loopback of multicast packets]' \ - '-l:preload number' \ - '-M:icmp:(mask time)' \ - '-m:ttl' \ - '-n[numeric output only]' \ - '-o[exit after receiving one packet]' \ - '-P:IPsec policy' \ - '-p:padding pattern' \ - '-Q[somewhat quiet]' \ - '-q[quiet]' \ - '-R[record route]' \ - '-r[bypass normal routing tables]' \ - '-S:source address' \ - '-s:packet size in bytes' \ - '-T:ttl for multicasted packets' \ - '-t:timeout in seconds' \ - '-v[verbose]' \ - '-W:wait time (ms)' \ - '-z:type of service' \ - ':host:_hosts' +_pick_variant -r variant iputils=iputils $OSTYPE -V + +case ${variant}:${${service#ping}:-4} in + iputils*) args=( -A "-*" ) ;| + *) + args+=( + '-d[set SO_DEBUG on the socket]' + '-n[show network addresses as numbers]' + '-v[verbose output]' + ) + ;| + iputils*|aix*|*bsd*|darwin*|dragonfly*) + args+=( + '-c+[specify number of packets to send]:count' + '-f[flood ping]' + '-i+[specify delay between packets]:interval (seconds) [1]' + '-l+[send specified number of initial packets as fast as possible]:number of packets' + '-p+[specify pad bytes to fill sent packet with]:padding pattern' + '-q[quiet]' + '-s+[specify packet size]:size (bytes) [56]' + ) + ;| + iputils:*|solaris:*|(*bsd|darwin|dragonfly)*:4) + args+=( + '-L[disable loopback of multicast packets]' + '-R[record route]' + ) + ;| + iputils:*|solaris:*|((free|net)bsd|darwin|dragonfly)*:4) + args+=( '-r[bypass normal routing tables]' ) + ;| + iputils:*|((free|net)bsd|darwin|dragonfly)*:4) + args+=( '-a[audible bell for each packet]' ) + ;| + iputils:*|(net|open)bsd*:4) + args+=( '-w+[specify timeout after which ping exits]:deadline (seconds)' ) + ;| + iputils:*|openbsd*:4|solaris*) + args+=( + '-t+[set IP Time to Live for outgoing packets]:ttl' + ) + ;| + (*bsd|darwin|dragonfly)*) + args+=( '-I+[specify source interface for multicast packets]:interface:_net_interfaces' ) + ;| + freebsd*|darwin*|dragonfly*|netbsd*:6) + args+=( '-S+[specify source address]:source address' ) + ;| + freebsd*|darwin*|dragonfly*:4|netbsd*:4) + args+=( '-o[exit after receiving one packet]' ) + ;| + (*bsd|darwin|dragonfly)*:4) + args+=( "-D[set the don't fragment bit]" ) + ;| + ((free|net)bsd|darwin|dragonfly)*:4) + args+=( + '-Q[somewhat quiet]' + '-T+[set IP Time to Live for outgoing packets]:ttl' + ) + ;| + freebsd*:6|darwin*:6|solaris*|netbsd*) + args+=( + '*-g+[specify gateway to use as the next hop to the destination]:gateway:_hosts' + ) + ;| + (*bsd|darwin|dragonfly)*:6) + args+=( '-h+[set the IPv6 hoplimit]:hop limit' ) + ;| + ((free|net)bsd|darwin|dragonfly)*:6) + args+=( + '-a+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)' + '-b+[set socket buffer size]:buffer size' + '-H[try reverse-lookups of IPv6 addresses]' + '-N[probe node information multicast group address]' + '(-s)-t[generate ICMPv6 Node Information supported query types query]' + '(-s)-w[generate ICMPv6 Node Information DNS Name query]' '!(-s)-W' + ) + ;| + (*bsd|darwin)*:6) + args+=( '*-m[suppress fragmenting of packets into the minimum IPv6 MTU]' ) + ;| + freebsd*|darwin*|dragonfly*|netbsd*:6) + args+=( '-P+[specify IPsec policy to be used for the probe]:policy' ) + ;| + solaris2.<11->) + args+=( + '-b[bypass global IPsec policy and send and receive packets in the clear]' + '-N+[specify a next-hop router that the probe packet should go through]:router:_hosts' + ) + ;| + (freebsd|darwin|dragonfly)*:4) + args+=( + '-A[audible bell for no packet]' + '-G+[specify maximum size for ICMP payload for sweeping pings]:size' + '-g+[specify minimum size for ICMP payload for sweeping pings]:size [0]' + '-h+[specify size increment for ICMP payload for sweeping pings]:size [1]' + '-M+[use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO]:ICMP:(mask time)' + '-m+[set IP Time to Live for outgoing packets]:ttl' + '-t+[specify timeout after which ping exits]:deadline (seconds)' + '-W+[specify time to wait for a response]:wait time (ms)' + '-z+[specify type of service]:type of service' + ) + ;; + (freebsd|darwin)*:6) + args+=( + '-R[audible bell for no packet]' + '-r[audible bell for each packet]' + ) + ;; + freebsd*:6) + args+=( + '-x+[specify time to wait for a response]:wait time (ms)' + '-X+[specify timeout after which ping exits]:deadline (seconds)' + ) + ;; + netbsd*:4) + args+=( + '-C[send timestamps in compat format]' + '-E+[specify IPsec policy to be used for the probe]:policy' + '-h+[specify target host]:host:_hosts' + '-P+[use a pseudo-random sequence for the data]' + '-t+[specify type of service]:type of service' + ) + ;; + (dragonfly|netbsd)*:6) + args+=( '-R[inject reachability confirmation hint for target host/first hop]' ) + ;| + darwin*:4) + args+=( '-b+[bind the socket to specified interface for sending]:interface:_net_interfaces' ) + ;| + darwin*:6) + args+=( + '-B+[bind the socket to specified interface for sending]:interface:_net_interfaces' + '-C[prohibit socket from using cellular network interface]' + ) + ;| + darwin*) + args+=( + '-k+[specify traffic class to use for sending ICMP packets]:traffic class [CTL]:(BK_SYS BK BE RD OAM AV RV VI VO CTL)' + ) + ;; + 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]' + '-V+[specify routing table to be used]:routing table' + ) + ;; + iputils:4) + args+=( + '(-F -N)-4[use IPv4 only]' + '-6[use IPv6 only]' + ) + ;| + iputils:*) + args+=( + '-A[adaptive]' + '-b[allow pinging a broadcast address]' + "-B[don't allow ping to change source address]" + '-D[print timestamp before each line]' + '(-4)-F+[allocate and set 20-bit flow label]:flow label (hex)' + '(-)-h[show usage information]' + '-I+[specify source interface]:interface:_net_interfaces' + '-m+[specify mark to tag outgoing packets]:mark' + "-M+[specify path MTU discovery strategy]:strategy:(( + do\:prohibit\ fragmentation,\ even\ local\ one + want\:do\ PMTU\ discovery + dont\:don\'t\ set\ DF\ flag))" + '(-4)-N+[send ICMPv6 node information queries instead of echo request]:sub option' + '-O[report outstanding ICMP ECHO reply before sending next packet]' + '-Q+[set Quality of Service-related bits in ICMP datagrams]:QoS TOS bits' + '-S+[set socket sndbuf]:sndbuf' + '-T+[set special IP timestamp options]:timestamp option:(tsonly tsandaddr tsprespec)' + '-U[print full user-to-user latency]' + '(-)-V[display version information]' + '-W+[specify time to wait for a response]:wait time (seconds)' + ) + ;; + solaris*) + args+=( + '-A+[specify address family]:address family:(inet inet6)' + '-F+[specify the flow label of probe packets]:number' + '-I+[specify delay between packets]:interval (seconds) [1]' + '-P+[specify type of service]:type of service (0-255) [0]' + '-U[send UDP packets instead of ICMP]' + '-a[ping all addresses, both IPv4 and IPv6 of multihomed destination]' + '-c+[specify the traffic class of probe packets]:traffic class (0-255)' + '-i+[specify source interface]:interface:_net_interfaces' + '-l[send the probe using loose source routing]' + '-p+[set base UDP port]:port [33434]' + '-s[send one datagram per second and collect statistics]' + ) + ;; +esac -fi +_arguments -s -S $args \ + '*:host:_hosts' diff --git a/Completion/Unix/Command/_printenv b/Completion/Unix/Command/_printenv index ad5b49815..8bff27c90 100644 --- a/Completion/Unix/Command/_printenv +++ b/Completion/Unix/Command/_printenv @@ -1,4 +1,4 @@ -#compdef printenv +#compdef printenv gprintenv local expl diff --git a/Completion/Unix/Command/_prove b/Completion/Unix/Command/_prove index 17b48a54d..27a73fba2 100644 --- a/Completion/Unix/Command/_prove +++ b/Completion/Unix/Command/_prove @@ -46,6 +46,7 @@ _arguments \ {-a,--archive}'[store output in archive file]:file:_files' \ {-j,--jobs}'[run N jobs in parallel]:jobs:' \ '*--state=[control persistent state]: :_values -s , state last failed passed all hot todo slow fast new old fresh save' \ + '--statefile=[specify file to use instead of .prove]:state file:_files' \ '--rc=[custom rcfile]:file:_files' \ '*--rules=[limit tests run (or not) in parallel]:rules' \ '*:file or directory:_files' diff --git a/Completion/Unix/Command/_ps b/Completion/Unix/Command/_ps index 6f67f7933..a8208a365 100644 --- a/Completion/Unix/Command/_ps +++ b/Completion/Unix/Command/_ps @@ -11,7 +11,7 @@ _ps_props() { case $OSTYPE in linux-gnu) opts=( ${${(f)"$(_call_program properties $words[1] L)"}%% *} ) ;; - freebsd*) opts=( $(_call_program properties $words[1] L) ) ;; + *bsd*|dragonfly*|darwin*) opts=( $(_call_program properties $words[1] L) ) ;; solaris*) opts=( ${=${(f)"$(_call_program properties $words[1] - 2>&1)"}[-3,-1]} ) ;; esac @@ -19,8 +19,8 @@ _ps_props() { } local curcontext="$curcontext" state line expl ret=1 -local short long -local -a args bsd bsdarg pids +local short long pids +local -a args bsd bsdarg local -A equivs args=( @@ -46,26 +46,20 @@ args=( bsd=( 'a[include processes belonging to other users]' - 'e[show environment after command]' '(j s u v X)l[output in long format]' '(l s u v X)j[output in job control format]' 'x[include processes with no controlling terminal]' - '(j l s v X)u[output in resource usage format]' '(j l s u X)v[output in virtual memory format]' '*w[wide output]' - 'H[show threads as if they were processes]' 'L[display all format specifiers]' 'S[include child process data with the parent]' 'T[select processes attached to current terminal]' - 'Z[show security data]' ) bsdarg=( '*p[select processes by ID]' '*t[select processes by attached terminal]' - '*U[select processes by effective user]' 'O[specify additional output fields]' 'o[specify output format]' - 'N[set namelist file for WCHAN display]' ) case $OSTYPE in @@ -82,26 +76,73 @@ case $OSTYPE in '-Z[show zone with which process is associated]' ) ;; + linux-gnu|dragonfly*|freebsd*|netbsd*|openbsd*) + bsd+=( + 'e[show environment after command]' + '(j l s v X)u[output in resource usage format]' + ) + bsdarg+=( + 'N[set namelist file for WCHAN display]' + '*U[select processes by effective user]' + ) + ;| + linux-gnu|dragonfly*|freebsd*|openbsd*) + bsd+=( 'H[show threads as if they were processes]' ) + ;| darwin*|dragonfly*|freebsd*|netbsd*|openbsd*) bsd+=( 'A[select every process]' - 'C[ignore resident time for CPU percentage]' 'c[show just executable name for command]' 'h[repeat header lines, one per page of output]' '(r)m[sort by memory usage]' '(m)r[sort by CPU usage]' ) - bsdarg+=( - 'M[extract values from specified core]' - ) + ;| + darwin*|dragonfly*|freebsd*|netbsd*) + bsd+=( 'C[ignore resident time for CPU percentage]' ) + ;| + dragonfly*|freebsd*|netbsd*|openbsd*) + bsdarg+=( 'M[extract values from specified core]' ) ;| linux-gnu|netbsd*) bsdarg+=( 'k[specify sort order]' ) ;| - darwin*|freebsd*) bsdarg+=( 'G[select processes by real group]' ) ;| + darwin*|freebsd*) + bsd+=( 'X[skip processes with no controlling terminal]' ) + bsdarg+=( '*G[select processes by real group]' ) + ;| + freebsd*|dragonfly*) + bsd+=( 'f[show command and environment for swapped out processes]' ) ;| + netbsd*|openbsd*) + bsdarg+=( 'W[extract swap information from specified file]' ) + ;| + darwin*) + bsd+=( + 'd[select all processes except session leaders]' + 'E[show environment after command]' + 'f[full listing]' + 'M[show threads corresponding to each process]' + ) + bsdarg+=( + '*g[select processes by process group leader]' + '*U[select processes by real user]' + ) + if [[ $words[CURRENT] = -* ]]; then + bsd+=( 'e[select every process]' ) + bsdarg+=( 'u[select processes by user id]' ) + else + bsd+=( + 'e[show environment after command]' + '(j l v)u[output in resource usage format]' + ) + fi + ;; + dragonfly*) + bsd+=( 'R[subsort by parent/child chain]' ) + ;; freebsd*) bsd+=( 'd[show process hierarchy]' - 'f[show command and environment for swapped out processes]' '*J[select processes by jail ID]' + 'Z[show mac label]' ) ;; netbsd*) bsd+=( '(j l u v)s[output in thread format]' ) ;; @@ -109,7 +150,6 @@ case $OSTYPE in bsd+=( 'k[display information about kernel threads]' ) - bsdarg+=( 'W[extract swap information from the specified file]' ) ;; linux-gnu) args+=( @@ -127,7 +167,8 @@ case $OSTYPE in '--cumulative[include child process data with the parent]' '-n[set namelist file for WCHAN display]:file:_files' '(--no-headers --no-heading)'{--no-headers,--no-heading}'[suppress headers]' - '--sort=[specify sort order]:order:_ps_props -s' + '(-q --quick-pid -a -A -d -e -N --deselect -C -p --pid --ppid -G --Group -g --group -s --sid -t --tty -u --user -U --User --forest -H --sort)'{-q+,--quick-pid=}'[select processes by ID (quick mode)]:process ID:_sequence -s , _pids' + '--sort=[specify sort order]:order:_sequence -s , _ps_props -s' '-w[wide output]' '-m[show threads after processes]' '-T[show threads, with SPID column]' @@ -150,23 +191,33 @@ case $OSTYPE in '(j l u v X)s[output in signal format]' 'V[display version information]' '(j l s u v)X[output in register format]' + 'Z[show security data]' ) + bsdarg+=( 'q[select processes by ID (quick mode)]' ) ;; esac -if (( CURRENT > 1 )) && [[ $OSTYPE != solaris* || ( $OSTYPE = linux-gnu && $words[CURRENT-1] != -* ) ]]; then +if (( CURRENT > 1 )) && [[ $OSTYPE != (solaris*|linux-gnu) || + ( $OSTYPE = linux-gnu && $words[CURRENT-1] != -* ) ]]; then case $words[CURRENT-1] in *k) - _wanted -C option-k-1 properties expl 'property' _sequence -s , _ps_props -s - && return - ;; + local sopt + [[ $OSTYPE = linux-gnu ]] && sopt='-s' + _wanted -C option-k-1 properties expl 'property' \ + _sequence -s , _ps_props $sopt - && return ;; + *g) [[ $OSTYPE = darwin* ]] && _wanted -C option-g-1 processes \ + expl 'process ID' _sequence -s , _pids && return ;; *G) _sequence -s , _groups && return ;; *J) _sequence _jails -0 && return ;; *[MNW]) _files && return ;; *t) _wanted -C option-t-1 ttys expl tty _sequence -s , _ttys -D && return ;; - *p) _wanted -C option-p-1 processes expl 'process ID' _sequence -s , _pids && return;; + *[pq]) _wanted -C "option-${words[CURRENT-1][-1]}-1" processes \ + expl 'process ID' _sequence -s , _pids && return ;; *U) _wanted -C option-U-1 users expl user _sequence -s , _users && return ;; + *u) [[ $OSTYPE = darwin* && $words[CURRENT-1] = -* ]] && \ + _wanted -C option-u-1 users expl user _sequence -s , _users && return ;; *[oO]) _wanted -C "option-${words[CURRENT-1][-1]}-1" properties \ expl 'property' _sequence -s , _ps_props - && return ;; esac @@ -175,13 +226,14 @@ fi if [[ $OSTYPE = (*bsd*|darwin*|dragonfly*) ]]; then compset -P - && pids=1 else - _arguments -C -s $args '*:: :->rest' && ret=0 - [[ -z "$state" || $OSTYPE = solaris* ]] && return ret + [[ $OSTYPE = solaris* ]] || args+=( '*:: :->rest' ) + _arguments -C -s $args && ret=0 + [[ -z "$state" ]] && return ret fi _values -s '' -S ' ' 'options' $bsd && ret=0 _values -S ' ' 'options' $bsdarg && ret=0 if [[ -z $pids ]]; then - _pids && compstate[insert]= + _pids && ret=0 fi return ret diff --git a/Completion/Unix/Command/_pwgen b/Completion/Unix/Command/_pwgen new file mode 100644 index 000000000..f8ab1cb92 --- /dev/null +++ b/Completion/Unix/Command/_pwgen @@ -0,0 +1,19 @@ +#compdef pwgen + +_arguments -s -S \ + '(-h --help -c --capitalize -A --no-capitalize)'{-c,--capitalize}'[include at least one capital letter in the password]' \ + '(-h --help -c --capitalize -A --no-capitalize)'{-A,--no-capitalize}"[don't include capital letters in the password]" \ + '(-h --help -n --numerals -0 --no-numerals)'{-n,--numerals}'[include at least one number in the password]' \ + '(-h --help -n --numerals -0 --no-numerals)'{-0,--no-numerals}"[don't include numbers in the password]" \ + '(-h --help -y --symbols)'{-y,--symbols}'[include at least one special symbol in the password]' \ + '(-h --help -r --remove-chars)'{-r+,--remove-chars=}'[remove characters from the set of characters to generate passwords]:characters' \ + '(-h --help -s --secure)'{-s,--secure}'[generate completely random passwords]' \ + '(-h --help -B --ambiguous)'{-B,--ambiguous}"[don't include ambiguous characters in the password]" \ + '(- 1 2)'{-h,--help}'[print a help message]' \ + '(-h --help -H --sha1)'{-H+,--sha1=}'[use sha1 hash of given file as a (not so) random generator]:file:_files -S \# -qr "/ \t\n\-"' \ + '(-h --help -1)-C[print the generated passwords in columns]' \ + "(-h --help -C)-1[don't print the generated passwords in columns]" \ + '(-h --help -v --no-vowels)'{-v,--no-vowels}"[don't use any vowels so as to avoid accidental nasty words]" \ + '(-N --num-passwords 2)'{-N,--num-passwords}'[specify number of passwords to generate]' \ + '!-a' '!--alt-phonics' \ + '1: :_guard "^-*" "length"' '(-N --num-passwords)2: :_guard "^-*" "number of passwords"' diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf index 46da00cc4..282431462 100644 --- a/Completion/Unix/Command/_readelf +++ b/Completion/Unix/Command/_readelf @@ -19,8 +19,8 @@ args=( '(-c --archive-index)'{-c,--archive-index}'[show symbol/file index in an archive]' \*{-x,--hex-dump=}"[dump contents of specified section as bytes]:section:($sections)" \*{-p,--string-dump=}"[dump contents of specified section as strings]:section:($sections)" - '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o R t)' - '--debug-dump=[show the contents of DWARF2 debug sections]::section:(rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges)' + '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o R t U u T g A c k K)' + '--debug-dump=[show the contents of DWARF2 debug sections]::section:(rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges addr cu_index links follow-links)' '(-I --histogram)'{-I,--histogram}'[show histogram of bucket list lengths]' '(-W --wide)'{-W,--wide}'[allow output width to exceed 80 characters]' '(- *)'{-H,--help}'[display help information]' diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm index 6d728b157..912b5eadf 100644 --- a/Completion/Unix/Command/_rm +++ b/Completion/Unix/Command/_rm @@ -24,16 +24,20 @@ if _pick_variant gnu=gnu unix --help; then else args=(${args:#*)--*\[*}) case $OSTYPE in - dragonfly*|freebsd*|netbsd*|openbsd*) + darwin*|dragonfly*|freebsd*|netbsd*|openbsd*) args+=( '-d[remove directories as well]' '-P[overwrite files before deleting them]' + '-v[explain what is being done]' ) ;| - dragonfly*|freebsd*|netbsd*) + darwin*|dragonfly*|freebsd*|netbsd*) args+=( - '-v[explain what is being done]' '-W[attempt to undelete named files]' + ) + ;| + dragonfly*|freebsd*|netbsd*) + args+=( "-x[don't cross file systems when removing a hierarchy]" ) ;| diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync index f79ec1dfe..c1404c908 100644 --- a/Completion/Unix/Command/_rsync +++ b/Completion/Unix/Command/_rsync @@ -149,6 +149,7 @@ _rsync() { '(--devices --specials)-D[same as --devices --specials]' \ '(-D)--devices[preserve devices]' \ '--no-devices[turn off --devices]' \ + '--copy-devices[copy device contents as regular file]' \ '(-D)--specials[preserve special files]' \ '--no-specials[turn off --specials]' \ '--no-D[turn off --devices and --specials]' \ @@ -161,7 +162,8 @@ _rsync() { '(-n --dry-run)'{-n,--dry-run}'[show what would have been transferred]' \ '(-W --whole-file)'{-W,--whole-file}'[copy files whole (without delta-transfer algorithm)]' \ {--no-W,--no-whole-file}'[turn off --whole-file]' \ - '(-x --one-file-system)'{-x,--one-file-system}'[do not cross filesystem boundaries]' \ + '--checksum-choice=[choose the checksum algorithms]:algorithm:_sequence -n 2 compadd - auto md4 md5 none' \ + '(-x --one-file-system)'{-x,--one-file-system}"[don't cross filesystem boundaries]" \ '(-B --block-size)'{-B,--block-size=}'[force a fixed checksum block-size]:block size' \ '(-e --rsh)'{-e+,--rsh=}'[specify the remote shell to use]:remote-shell command:(rsh ssh)' \ '--rsync-path=[specify path to rsync on the remote machine]:remote command' \ @@ -190,9 +192,9 @@ _rsync() { '--numeric-ids[do not map uid/gid values by user/group name]' \ '--timeout=[set I/O timeout in seconds for lulls in a transfer]:seconds' \ '--contimeout=[set connect timeout in seconds for daemon connections]:seconds' \ - '(-I --ignore-times)'{-I,--ignore-times}'[do not skip files that match in size and mod-time]' \ + '(-I --ignore-times)'{-I,--ignore-times}"[don't skip files that match in size and mod-time]" \ '--size-only[skip files that match in size]' \ - '--modify-window=[compare mod-times with reduced accuracy]:seconds' \ + '(-@ --modify-window)'{-@+,--modify-window=}'[compare mod-times with reduced accuracy]:seconds' \ '(-y --fuzzy)'{-y,--fuzzy}'[find similar file for basis if no destination file]' \ '(--copy-dest --link-dest)*--compare-dest=[also compare destination files relative to specified directory]:directory:_directories' \ '(--compare-dest --link-dest)*--copy-dest=[like --compare-dest, but also includes copies of unchanged files]:directory:_directories' \ @@ -240,6 +242,7 @@ _rsync() { '--preallocate[preallocate the full length of new files]' \ '--iconv=[request charset conversion of filenames]:number' \ '--checksum-seed=:number' \ + "--noatime[don't alter atime when opening source files]" \ '--read-batch=[read a batched update from the specified file]:file:_files' } diff --git a/Completion/Unix/Command/_ruby b/Completion/Unix/Command/_ruby index bb0558fde..d69c378fc 100644 --- a/Completion/Unix/Command/_ruby +++ b/Completion/Unix/Command/_ruby @@ -1,8 +1,8 @@ -#compdef ruby irb erb -P (ruby|[ei]rb)[0-9.]# -value-,RUBY(LIB|OPT|PATH),-default- +#compdef ruby irb erb ruby-mri -P (ruby|[ei]rb)[0-9.]# -value-,RUBY(LIB|OPT|PATH),-default- local curcontext="$curcontext" state line expl desc RUBY ret=1 typeset -A opt_args -local -a opts irb all common charsets suf +local -a opts irb erb all common charsets suf all=( '*-r+[require the library before executing your script]:library name:->library' @@ -41,6 +41,7 @@ opts=( '(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-{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)' diff --git a/Completion/Unix/Command/_screen b/Completion/Unix/Command/_screen index ebc8ba155..6d47d2638 100644 --- a/Completion/Unix/Command/_screen +++ b/Completion/Unix/Command/_screen @@ -56,6 +56,8 @@ scr_cmds=( ) _arguments -C \ + '(-6)-4[resolve hostnames only to IPv4 addresses]' \ + '(-4)-4[resolve hostnames only to IPv6 addresses]' \ "-a[force all capabilities into each window's termcap]" \ '-A[adapt all windows to the new display width & height]' \ "-c[read configuration file instead of '.screenrc']:config file:_files" \ @@ -66,14 +68,16 @@ _arguments -C \ '-f-[set flow control]:flow control:((n\:flow\ control\ off a\:flow\ control\ auto \:flow\ control\ on))' \ '-h[set the size of the scrollback history buffer]:buffer size' \ '-i[interrupt output sooner when flow control is on]' \ - '(-l)-ln[login mode off (do not update utmp database)]' \ + "(-l)-ln[login mode off (don't update utmp database)]" \ '(-ln)-l[login mode on (update utmp database)]' \ - '(-)'{-ls,-list}'[list sessions/socket directory]' \ + '(- *)'{-ls,-list}'[list sessions/socket directory]: :->any-sessions' \ "-L[terminal's last character can be safely updated]" \ + '-Logfile[set logfile name]:log file:_files' \ '-m[ignore $STY variable, do create a new screen session]' \ '-O[choose optimal output rather than exact vt100 emulation]' \ '-p[preselect the named window]:window number or name:((\=\:windowlist -\:blank\ window \:window\ number))' \ '-q[quiet startup, exit with non-zero return code if unsuccessful]' \ + '-Q[send response to stdout of command query process]:screen command:(echo info lastmsg number select time title windows)' \ '-r[reattach to a detached screen process]: :->detached-sessions' \ '-Dr: :->any-sessions' \ '-dr: :->any-sessions' \ @@ -85,12 +89,12 @@ _arguments -C \ "-t[set title (window's name)]:title" \ '-T[use term as $TERM for windows, rather than "screen"]:terminal type:_terminals' \ '-U[tell screen to use UTF-8 encoding]' \ - '(-)-v[print screen version]' \ - '(-)-wipe[do nothing, clean up SockDir]' \ + '(- *)-v[print screen version]' \ + '(- *)-wipe[do nothing, clean up SockDir]: :->any-sessions' \ '-x[attach to a not detached screen (multi display mode)]: :->attached-sessions' \ '-Dx: :->any-sessions' \ '-dx: :->any-sessions' \ - '-X[execute command as a screen command in the specified session]:screencmd:(${scr_cmds[@]})' \ + '-X[execute command as a screen command in the specified session]:screen command:(${scr_cmds[@]})' \ '*:: :->normal' && ret=0 if [[ -n $state ]]; then diff --git a/Completion/Unix/Command/_seq b/Completion/Unix/Command/_seq new file mode 100644 index 000000000..5b825675f --- /dev/null +++ b/Completion/Unix/Command/_seq @@ -0,0 +1,28 @@ +#compdef seq gseq + +local variant args + +_pick_variant -r variant gnu=GNU $OSTYPE --version + +args=( ':: :_guard "^-[^0-9]*" '{first,step,last} ) +case $variant in + gnu) + args+=( + '(--help --version)'{-f+,--format=}'[use printf style floating-point format]:format' + '(--help --version -s --separator)'{-s+,--separator=}'[use specified separator for numbers]:separator [\n]' + '(--help --version -w --equal-width)'{-w,--equal-width}'[equalize width by padding with leading zeroes]' + '(- 1 2 3)--help[display usage information]' + '(- 1 2 3)--version[display version information]' + ) + ;; + *) + args+=( + '-f+[use printf style floating-point format]:format' + '-s+[use specified separator for numbers]:separator [\n]' + '-t+[use specified string to terminate numbers]:string [\n]' + '-w[equalize width by padding with leading zeroes]' + ) + ;; +esac + +_arguments -s -A '-[^1-9]*' $args diff --git a/Completion/Unix/Command/_setfacl b/Completion/Unix/Command/_setfacl index af6c4d4e5..5c573a581 100644 --- a/Completion/Unix/Command/_setfacl +++ b/Completion/Unix/Command/_setfacl @@ -29,7 +29,7 @@ _arguments -s -S \ '(-P --physical)'{-P,--physical}'[physical walk, do not follow symbolic links]' \ '--restore=[restore ACLs]:file:_files' \ '--test[test mode (ACLs are not modified)]' \ - '--version[print version and exit]' \ - '--help[this help text]' \ + '(- *)'{-v,--version}'[display version information]' \ + '(- *)'{-h,--help}'[display help information]' \ '*: :_files' fi diff --git a/Completion/Unix/Command/_shutdown b/Completion/Unix/Command/_shutdown new file mode 100644 index 000000000..1ac6e61ba --- /dev/null +++ b/Completion/Unix/Command/_shutdown @@ -0,0 +1,61 @@ +#compdef shutdown + +local -a args + +if [[ -d /etc/systemd ]]; then + _arguments \ + '--help[display usage information]' \ + '(-H --halt)'{-H,--halt}'[halt the machine]' \ + '(-P --poweroff -h)'{-P,--poweroff,-h}'[power-off the machine (default)]' \ + '(-r --reboot)'{-r,--reboot}'[reboot the machine]' \ + "(--no-wall)-k[don't shutdown, just write wall message]" \ + "(-k)--no-wall[don't send a wall message]" \ + '-c[cancel pending shutdown]' \ + '1: :_guard "^-*" "time (now/hh\:mm/+mins)"' \ + '*:warning message' + return +fi + +case $OSTYPE in + *bsd*|dragonfly*|linux*) + args=( + '-h[halt the system after shutdown]' + '-p[turn off power after shutdown]' + '-r[reboot the system]' + '-k[kick everybody off]' + '-n[prevent file system cache from being flushed]' + '1: :_guard "^-*" "time (now/hh\:mm/+mins)"' + '*:warning message' + ) + ;| + (net|open)bsd*) + args+=( + '-d[cause system to perform a dump]' + '-f[create /fastboot so that file systems will not be checked during the next boot]' + ) + ;| + freebsd*|dragonfly*) + args+=( + '-o[execute halt or reboot instead of sending a signal to init]' + ) + ;; + netbsd*) + args+=( + '-b[specify boot string to pass to reboot]:boot string' + '-v[enable verbose console messages]' + '-x[enable debug console messages]' + '-z[silence some console messages]' + '-D[prevent shutdown from detaching from the tty]' + ) + ;; + solaris2.<11->) args=( '(-i)-r[reboot]' ) ;& + solaris*) + args+=( + '(-r)-i+[specify init-state]:init state:((0\:stop 1\:administrative s\:single\ user 5 6\:reboot))' + '-y[pre-answer yes to confirmation question]' + '-g+[specify grace period]:grace period (seconds) [60]' + ) + ;; +esac + +_arguments $args diff --git a/Completion/Unix/Command/_smartmontools b/Completion/Unix/Command/_smartmontools new file mode 100644 index 000000000..c60322ee0 --- /dev/null +++ b/Completion/Unix/Command/_smartmontools @@ -0,0 +1,61 @@ +#compdef smartctl + +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" + "(n v)b[print all bits]" + "w[print all words]" + "(b v)n[suppress printing bits]" + "(b n)v[print all bits from valid words]"' \ + '(H)*'{-g+,--get=}'[get device setting]:setting:(all aam apm lookahead security wcache rcache wcreorder)' \ + '(H -a --all -x --xall -H --health -i --info -c --capabilities -A --attributes --scan --scan-open)'{-a,--all}'[show all SMART information for device]' \ + '(H -x --xall -a --all -H --health -i --info -c --capabilities -A --attributes --scan --scan-open)'{-x,--xall}'[show all information for device]' \ + '(H 1 --scan-open --identify -x --xall -a --all -H --health -i --info -c --capabilities -A --attributes)--scan[scan for devices]' \ + '(H 1 --scan --identify -x --xall -a --all -H --health -i --info -c --capabilities -A --attributes)--scan-open[scan for devices and try to open each device]' \ + '(H -q --quietmode)'{-q+,--quietmode=}'[set smartctl quiet mode]:quiet mode:(errorsonly silent noserial)' \ + '(H -d --device)'{-d+,--device=}'[specify device type]:device type:(ata scsi nvme sat usbcypress usbjmicron usbprolific usbsunplus marvell areca 3ware hpt megaraid cciss auto test)' \ + '(H)*'{-T+,--tolerance=}'[specify how tolerant smartctl should be of ATA SMART command failures]:tolerance:(normal conservative permissive verypermissive)' \ + '(H -b --badsum)'{-b+,--badsum=}'[set action if checksum error is detected]:action:(warn exit ignore)' \ + '(H)*'{-r+,--report=}'[report transactions]:transaction type:(ioctl ataioctl scsiioctl nvmeioctl)' \ + '(H -n --nocheck)'{-n+,--nocheck=}'[exit if the device is in a low-power mode]:power mode causing exit:(never sleep standby idle)' \ + '(H -s --smart)--smart=[enable/disable SMART on device]:enable:(on off)' \ + '(H -o --offlineauto)'{-o+,--offlineauto=}'[enable/disable automatic offline test on device]:enable:(on off)' \ + '(H -S --saveauto)'{-S+,--saveauto=}'[enable/disable attribute autosave on device]:enable:(on off)' \ + '(H -s --set)'{-s+,--set=}'[enable/disable/change device setting]:setting:->settings' \ + '(H -H --health)'{-H,--health}'[show device SMART health status]' \ + '(H -c --capabilities)'{-c,--capabilities}'[show device SMART capabilities]' \ + '(H -A --attributes)'{-A,--attributes}'[show device SMART vendor-specific attributes and values]' \ + '(H)*'{-f+,--format=}'[set output format for attributes]:format:(old brief hex,id hex,val hex)' \ + '(H)*'{-l+,--log=}'[show device log]:log:(error selftest selective directory xerror xselftest background sasphy sataphy scttemp scttempsts scttemphist scttempint scterc devstat ssd gplog smartlog nvmelog)' \ + '(H)*'{-v+,--vendorattribute=}'[set display option for vendor attribute]:vendor attribute:->vendorattrs' \ + '(H -F --firmwarebug)'{-F+,--firmwarebug=}'[use firmware bug workaround]:bug:(none nologdir samsung samsung2 samsung3 xerrorlba swapid)' \ + '(H -P --presets)'{-P+,--presets=}'[specify whether to use drive-specific presets]:preset usage:(use ignore show showall)' \ + '(H -B --drivedb)'{-B+,--drivedb=}'[read drive database from file]:file:->plusfiles' \ + '(H -t --test)'{-t+,--test=}'[run specified self-test]:self-test:(offline short long conveyance force vendor select pending afterselect,on afterselect,off scttempint)' \ + '(H -C --captive)'{-C,--captive}'[run self-test in captive mode]' \ + '(H -X --abort)'{-X,--abort}'[abort any non-captive self-test]' \ + '(H --scan --scan-open)1:disk device:_files -g "*(-%)" -P / -W /' \ + + 'H' \ + '(- 1)'{-h,--help,--usage}'[display help information]' \ + '(- 1)'{-V,--version,--copyright,--license}'[display version, licence and build information]' && return + +case $state in + vendorattrs) + _wanted -C $context vendor-attributes expl 'vendor attribute' compadd - \ + ${${${(f)"$(_call_program vendor-attributes $words[1] -v help)"}[(r)*help*,-1]#$'\t'}%%\[*} + ;; + plusfiles) + compset -P \+ || state_descr[1]+=" (prefix with + to prepend entries)" + _wanted -C $context files expl $state_descr _files + ;; + settings) + local values + [[ $context = option-s-1 ]] && + values+=( {on\[en,off\[dis}'able SMART on device]' ) + + _values -S , setting $values {aam,apm,standby}':value' \ + {lookahead,{w,r}cache,wcreorder}':enable:(on off)' security security-freeze + ;; +esac diff --git a/Completion/Unix/Command/_sort b/Completion/Unix/Command/_sort index 91e9132ad..c81e6f856 100644 --- a/Completion/Unix/Command/_sort +++ b/Completion/Unix/Command/_sort @@ -44,7 +44,7 @@ case $variant in "$ordering"{-h,--human-numeric-sort}'[compare human readable numbers (e.g., 2K 1G)]' "$ordering"{-R,--random-sort}'[sort by random hash of keys]' "$ordering"{-V,--version-sort}'[sort version numbers]' - "$ordering--sort=[sort according to ordering]:ordering:(general-numeric human-numeric month numeric random version)" + "$ordering--sort=[specify comparator]:comparator:(general-numeric human-numeric month numeric random version)" '(-i --ignore-nonprinting)'{-i,--ignore-nonprinting}'[consider only printable characters]' '--random-source=[get random bytes from file]:file:_files' '--batch-size=[maximum inputs to merge]:number' diff --git a/Completion/Unix/Command/_split b/Completion/Unix/Command/_split new file mode 100644 index 000000000..25b5aec2d --- /dev/null +++ b/Completion/Unix/Command/_split @@ -0,0 +1,64 @@ +#compdef split gsplit + +local curcontext="$curcontext" variant ret=1 +local -A opt_args +local -a state line args + +_pick_variant -r variant gnu=GNU $OSTYPE --version + +args=( + '-a+[generate suffixes of specified length]:length [2]' \ + '(-l -p -n)-b+[put specified size in bytes in each output file]:size (bytes)' \ + '(-b -p -n)-l+[put specified number of lines/records in each output file]:lines' \ + '1:file:_files' \ + '2: :_guard "^-*" "prefix [x]"' +) + +case $variant in + gnu) + args=( -C + '(H -a --suffix-length)'{-a+,--suffix-length=}'[generate suffixes of specified length]:length [2]' + '(H)--additional-suffix=[append an additional suffix to file names]:suffix' + '(H -b --bytes -C --line-bytes -l --lines -n --number)'{-b+,--bytes=}'[put specified size in bytes in each output file]:size (bytes)' + '(H -b --bytes -C --line-bytes -l --lines -n --number)'{-C+,--line-bytes=}'[put whole lines/records up to size limit in each output file]:size (bytes)' + '(H --numeric-suffixes -x --hex-suffixes)-d[use numeric suffixes starting at 0]' + '(H -d -x --hex-suffixes)--numeric-suffixes=-[use numeric suffixes]::start value [0]' + '(H -d --numeric-suffixes --hex-suffixes)-x[use hex suffixes starting at 0]' + '(H -d --numeric-suffixes -x)--hex-suffixes=-[use hex suffixes]::start value [0]' + '(H -e --elide-empty-files)'{-e,--elide-empty-files}"[don't generate empty output files with '-n']" + '(H)--filter=[write to shell command; filename is in $FILE]:command:_cmdstring' + '(H -b --bytes -C --line-bytes -l --lines -n --number)'{-l+,--lines=}'[put specified number of lines/records in each output file]:lines' + '(H -b --bytes -C --line-bytes -l --lines -n --number)'{-n+,--number=}'[generate specified number of output files]:chunks:->chunks' + '(H -t --separator)'{-t+,--separator=}'[use specified record separator instead of newline]:separator' + '(H -u --unbuffered)'{-u,--unbuffered}"[immediately copy input to output with '-n r/...']" + '(H)--verbose[print a diagnostic just before each output file is opened]' + '(H)1:file:_files' + '(H)2: :_guard "^-*" "prefix [x]"' + + 'H' + '(- 1 2)--help[display usage information]' + '(- 1 2)--version[display version information]' + ) + ;; + (free|net)bsd*) + args+=( '(-b -l -p)-n+[generate specified number of output files]:output files' ) + ;| + freebsd*) + args+=( + '-d[use numeric suffixes]' + '(-b -l -n)-p+[split the file whenever a line matches specified pattern]:pattern' + ) + ;; +esac + +_arguments -s -S $args && ret=0 + +if [[ $state = chunks ]]; then + if [[ ! -prefix *[0-9/]* ]]; then + _alternative 'modifiers: :_values -s/ "modifier" "l[don'\''t split lines/records]" "r[round robin distribution]"' \ + 'lines: :_guard "[0-9/]#" lines' && ret=0 + else + _message -e lines lines + fi +fi + +return ret diff --git a/Completion/Unix/Command/_sqlite b/Completion/Unix/Command/_sqlite index df673894c..f63f4c085 100644 --- a/Completion/Unix/Command/_sqlite +++ b/Completion/Unix/Command/_sqlite @@ -22,7 +22,7 @@ options+=( ) output_modes=( column HTML line list ) -(( $+sqlite3 )) && output_modes+=( csv quote ) +(( $+sqlite3 )) && output_modes+=( ascii csv quote ) exclusive=( $^dashes-${^output_modes:l} ) for display_opt in $output_modes ; do # finagle the description to match the way SQLite's -help formats them @@ -45,7 +45,10 @@ options+=( $^dashes'-cmd[run specified command before reading stdin]:sqlite meta-command' '(-*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'-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' $^dashes'-stats[print memory stats before each finalize]' $^dashes'-vfs[use specified default VFS]:vfs:(unix-dotfile unix-excl unix-none unix-namedsem)' ) diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 984c96e93..20a5536ee 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -4,23 +4,20 @@ _ssh () { local curcontext="$curcontext" state line expl suf ret=1 - local args common tmp p1 file cmn cmds sdesc + local args common common_transfer algopt tmp p1 file cmn cmds sdesc typeset -A opt_args common=( - '(-2)-1[forces ssh to try protocol version 1 only]' - '(-1)-2[forces ssh to try protocol version 2 only]' '(-6)-4[forces ssh to use IPv4 addresses only]' '(-4)-6[forces ssh to use IPv6 addresses only]' '-C[compress data]' - # for protocol version 2, this can be a comma-separated list - '-c+[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)' + '-c+[select encryption cipher]:encryption cipher:->ciphers' '-F+[specify alternate config file]:config file:_files' '*-i+[select identity file]:SSH identity file:_files -g "*(-.^AR)"' '*-o+[specify extra options]:option string:->option' ) common_transfer=( - '-l[limit used bandwidth]:bandwidth in KiB/s:' + '-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]' '-q[disable progress meter and warnings]' @@ -28,16 +25,17 @@ _ssh () { '-S+[specify ssh program]:path to ssh:_command_names -e' \ '-v[verbose mode]' ) + algopt='-E+[specify hash algorithm for fingerprints]:algorithm:(md5 sha256)' case "$service" in ssh) _arguments -C -s \ - '(-a)-A[enables forwarding of the authentication agent connection]' \ + '(-a)-A[enable forwarding of the authentication agent connection]' \ '(-A)-a[disable forwarding of authentication agent connection]' \ '(-P)-b+[specify interface to transmit on]:bind address:_bind_addresses' \ '-D+[specify a dynamic port forwarding]:dynamic port forwarding:->dynforward' \ '-e+[set escape character]:escape character (or `none'\''):' \ - '-E[append log output to file instead of stderr]:_files' \ + '-E+[append log output to file instead of stderr]:_files' \ '(-n)-f[go to background]' \ '-g[allow remote hosts to connect to local forwarded ports]' \ '-G[output configuration and exit]' \ @@ -45,26 +43,26 @@ _ssh () { '-J+[connect via a jump host]: :->userhost' \ '-K[enable GSSAPI-based authentication and forwarding]' \ '-k[disable forwarding of GSSAPI credentials]' \ - '*-L[specify local port forwarding]:local port forwarding:->forward' \ + '*-L+[specify local port forwarding]:local port forwarding:->forward' \ '-l+[specify login name]:login name:_ssh_users' \ '-M[master mode for connection sharing]' \ - '(-1)-m+[specify mac algorithms]:mac spec:->macs' \ - '(-1)-N[do not execute a remote command (protocol version 2 only)]' \ + '-m+[specify mac algorithms]: :->macs' \ + "-N[don't execute a remote command]" \ '-n[redirect stdin from /dev/null]' \ - '-O[control an active connection multiplexing master process]:multiplex control command:((check\:"check master process is running" exit\:"request the master to exit" forward\:"request forward without command execution" stop\:"request the master to stop accepting further multiplexing requests" cancel\:"cancel existing forwardings with -L and/or -R" proxy))' \ + '-O+[control an active connection multiplexing master process]:multiplex control command:((check\:"check master process is running" exit\:"request the master to exit" forward\:"request forward without command execution" stop\:"request the master to stop accepting further multiplexing requests" cancel\:"cancel existing forwardings with -L and/or -R" proxy))' \ '-P[use non privileged port]' \ '-p+[specify port on remote host]:port number on remote host' \ '(-v)*-q[quiet operation]' \ - '*-R[specify remote port forwarding]:remote port forwarding:->forward' \ + '*-R+[specify remote port forwarding]:remote port forwarding:->forward' \ '-S+[specify location of control socket for connection sharing]:path to control socket:_files' \ - '-Q[query parameters]:parameter type:((cipher\:"supported symmetric ciphers" cipher-auth\:"supported symmetric ciphers that support authenticated encryption" mac\:"supported message integrity codes" kex\:"key exchange algorithms" key\:"key types" protocol-version\:"supported SSH protocol versions"))' \ - '(-1)-s[invoke subsystem]' \ - '(-1 -t)-T[disable pseudo-tty allocation (protocol version 2 only)]' \ + '-Q+[query parameters]:parameter type:((cipher\:"supported symmetric ciphers" cipher-auth\:"supported symmetric ciphers that support authenticated encryption" mac\:"supported message integrity codes" kex\:"key exchange algorithms" key\:"key types" protocol-version\:"supported SSH protocol versions"))' \ + '-s[invoke subsystem]' \ + '(-t)-T[disable pseudo-tty allocation]' \ '(-T)-t[force pseudo-tty allocation]' \ '-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' \ - '-w[request tunnel device forwarding]:local_tun[\:remote_tun] (integer or "any"):' \ + '-W+[forward standard input and output to host]:stdinout forward:->hostport' \ + '-w+[request tunnel device forwarding]:local_tun[\:remote_tun] (integer or "any"):' \ '(-x -Y)-X[enable (untrusted) X11 forwarding]' \ '(-X -Y)-x[disable X11 forwarding]' \ '(-x -X)-Y[enable trusted X11 forwarding]' \ @@ -79,17 +77,22 @@ _ssh () { '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0 ;; ssh-add) - _arguments -s \ + [[ $OSTYPE == darwin* ]] && args=( + '-A[add identities from keychain]' + '-K[update keychain when adding/removing identities]' + ) + _arguments -s : $args \ '-c[identity is subject to confirmation via SSH_ASKPASS]' \ '-D[delete all identities]' \ '-d[remove identity]' \ - '-E[specify hash algorithm for fingerprints]:algorithm:(md5 sha256)' \ - '-e[remove keys provided by the PKCS#11 shared library]:library:_files -g "*.(so|dylib)(|.<->)(-.)"' \ + $algopt \ + '-e+[remove keys provided by the PKCS#11 shared library]:library:_files -g "*.(so|dylib)(|.<->)(-.)"' \ '-k[load plain private keys only and skip certificates]' \ - '-L[lists public key parameters of all identities in the agent]'\ + '-L[list public key parameters of all identities in the agent]'\ '-l[list all identities]' \ - '-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):' \ + '-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):' \ + '-q[be quiet after a successful operation]' \ '-X[unlock the agent]' \ '-x[lock the agent with a password]' \ '*:SSH identity file:_files' @@ -97,10 +100,13 @@ _ssh () { ;; ssh-agent) _arguments -s \ - '(-k)-a[UNIX-domain socket to bind agent to]:UNIX-domain socket:_files' \ + '(-k)-a+[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]' \ + "(-k)$algopt" \ '-k[kill current agent]' \ + '(-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):' \ '*::command: _normal' @@ -125,12 +131,12 @@ _ssh () { 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 _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" \ - "(-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)" \ + "(${${(@)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" \ + "(-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)" \ "(${${(@)cmds:#-[lGT]}} ${${(@)cmn:#-[bv]}} -f)*-v[verbose mode]" \ - '(commands)' \ "(-b -P -C -v)-p[change passphrase of private key file]" \ @@ -139,39 +145,45 @@ _ssh () { "($cmn)-y[get public key from private key]" \ '(-b -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" \ + "(-)-D+[download key stored in smartcard reader]:reader" \ "($cmn)-H[hash names in known_hosts file]" \ - "($cmn)-R[remove host from known_hosts file]:host:_ssh_hosts" \ + "($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)-Q[test whether keys have been revoked in a KRL]" \ - finger \ "($cmn)-l[show fingerprint of key file]" \ - "$p1($cmn)-E[specify hash algorithm for displayed fingerprints]:hash algorithim:(md5 sha256)" \ + "$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 -m)-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)" \ + "$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)" \ - screen \ - "(${${(@)cmn:#-v}})-T[screen candidates for DH-GEX moduli]:output file:_files" \ - "${p1}(${${(@)cmn:#-v}})-a[specify number of rounds]:rounds" \ + "(${${(@)cmn:#-v}})-T+[screen candidates for DH-GEX moduli]:output file:_files" \ + "${p1}(${${(@)cmn:#-v}})-a+[specify number of rounds]:rounds" \ "${p1}(${${(@)cmn:#-v}})-J[exit after screening specified number of lines]" \ - "${p1}(${${(@)cmn:#-v}})-j[start screening at the specified line number]:line number" \ - "${p1}(${${(@)cmn:#-v}})-K[write the last line processed to file]:file:_files" \ + "${p1}(${${(@)cmn:#-v}})-j+[start screening at the specified line number]:line number" \ + "${p1}(${${(@)cmn:#-v}})-K+[write the last line processed to file]:file:_files" \ "${p1}(${${(@)cmn:#-v}})-W[specify desired generator]:generator" \ - certify \ "($cmn)-s[$sdesc]:CA key:_files" \ - "$p1($cmn -f -u)-I[specify key identifier to include in certificate]:key id" \ + "$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)-n[specify user/host principal names to include in certificate]:principals" \ - "$p1($cmn -f -u)-O[specify a certificate option]:option" \ - "$p1($cmn -f -u)-V[specify certificate validity interval]:interval" \ + "$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' + 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]" return @@ -181,15 +193,15 @@ _ssh () { '-a[attempt to continue interrupted transfers]' \ '-B+[specify buffer size]:buffer size (bytes) [32768]' \ '-b+[specify batch file to read]:batch file:_files' \ - '-D[connect directly to a local sftp server]:sftp server path' \ + '-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]' \ + '-R+[specify number of outstanding requests]:number of requests [64]' \ + '-s+[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) _arguments \ - '-i:SSH identity file:_files' \ + '-i+[select identity file]:SSH identity file:_files' \ ':remote host name:->userhost' \ ;; esac @@ -209,7 +221,7 @@ _ssh () { ;; esac case "${IPREFIX#-o}" in - (#i)(afstokenpassing|batchmode|canonicalizefallbacklocal|challengeresponseauthentication|checkhostip|clearallforwardings|compression|enablesshkeysign|exitonforwardfailure|fallbacktorsh|forward(agent|x11)|forwardx11trusted|gatewayports|gssapiauthentication|gssapidelegatecredentials|gssapitrustdns|hashknownhosts|hostbasedauthentication|identitiesonly|kbdinteractiveauthentication|(tcp|)keepalive|nohostauthenticationforlocalhost|passwordauthentication|permitlocalcommand|proxyusefdpass|pubkeyauthentication|rhosts(|rsa)authentication|rsaauthentication|streamlocalbindunlink|usersh|kerberos(authentication|tgtpassing)|useprivilegedport|visualhostkey)=*) + (#i)(afstokenpassing|batchmode|canonicalizefallbacklocal|challengeresponseauthentication|checkhostip|clearallforwardings|compression|enablesshkeysign|exitonforwardfailure|fallbacktorsh|forward(agent|x11)|forwardx11trusted|gatewayports|gssapiauthentication|gssapidelegatecredentials|gssapikeyexchange|gssapirenewalforcesrekey|gssapitrustdns|hashknownhosts|hostbasedauthentication|identitiesonly|kbdinteractiveauthentication|(tcp|)keepalive|nohostauthenticationforlocalhost|passwordauthentication|permitlocalcommand|proxyusefdpass|pubkeyauthentication|rhosts(|rsa)authentication|rsaauthentication|streamlocalbindunlink|usersh|kerberos(authentication|tgtpassing)|useprivilegedport|visualhostkey)=*) _wanted values expl 'truth value' compadd yes no && ret=0 ;; (#i)addressfamily=*) @@ -231,32 +243,7 @@ _ssh () { _message -e 'CNAME rule list (source_domain_list:target_domain_list, each pattern list comma separated)' && ret=0 ;; (#i)ciphers=*) - _values -s , 'encryption cipher' \ - '3des-cbc' \ - 'aes128-cbc' \ - 'aes192-cbc' \ - 'aes256-cbc' \ - 'aes128-ctr' \ - 'aes192-ctr' \ - 'aes256-ctr' \ - 'arcfour128' \ - 'arcfour256' \ - 'arcfour' \ - 'blowfish-cbc' \ - 'cast128-cbc' \ - \ - 'rijndael128-cbc' \ - 'rijndael192-cbc' \ - 'rijndael256-cbc' \ - 'rijndael-cbc@lysator.liu.se' \ - && ret=0 - ;; - (#i)cipher=*) - _wanted values expl 'encryption cipher (protocol version 1)' \ - compadd blowfish 3des des idea arcfour tss none && ret=0 - ;; - (#i)compressionlevel=*) - _values 'compression level' {1..9} && ret=0 + state=ciphers ;; (#i)connectionattempts=*) _message -e 'connection attempts' && ret=0 @@ -296,21 +283,7 @@ _ssh () { _wanted hosts expl 'real host name to log into' _ssh_hosts && ret=0 ;; (#i)(hostbasedkeytypes|hostkeyalgorithms|pubkeyacceptedkeytypes)=*) - _values -s , 'key types' \ - 'ecdsa-sha2-nistp256-cert-v01@openssh.com' \ - 'ecdsa-sha2-nistp384-cert-v01@openssh.com' \ - 'ecdsa-sha2-nistp521-cert-v01@openssh.com' \ - 'ssh-ed25519-cert-v01@openssh.com' \ - 'ssh-rsa-cert-v01@openssh.com' \ - 'ssh-dss-cert-v01@openssh.com' \ - 'ssh-rsa-cert-v00@openssh.com' \ - 'ssh-dss-cert-v00@openssh.com' \ - 'ecdsa-sha2-nistp256' \ - 'ecdsa-sha2-nistp384' \ - 'ecdsa-sha2-nistp521' \ - 'ssh-ed25519' \ - 'ssh-rsa' \ - 'ssh-dss' && ret=0 + _wanted key-types expl 'key type' _sequence compadd - $(_call_program key-types ssh -Q key) && ret=0 ;; (#i)identityfile=*) _description files expl 'SSH identity file' @@ -342,12 +315,9 @@ _ssh () { _values -s , 'keyboard-interactive authentication methods' \ 'bsdauth' 'pam' 'skey' && ret=0 ;; - (#i)kexalgorithms=*) - _values -s , 'KEX algorithms' \ - ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 \ - diffie-hellman-group-exchange-sha256 \ - diffie-hellman-group-exchange-sha1 \ - diffie-hellman-group14-sha1 diffie-hellman-group1-sha1 && ret=0 + (#i)(kexalgorithms|gssapikexalgorithms)=*) + _wanted algorithms expl 'key exchange algorithm' _sequence compadd - \ + $(_call_program algorithms ssh -Q kex) && ret=0 ;; (#i)localcommand=*) _description commands expl 'run command locally after connecting' @@ -381,7 +351,7 @@ _ssh () { '1' \ '2' && ret=0 ;; - (#i)proxycommand=*) + (#i)(proxy|remote)command=*) _cmdstring && ret=0 ;; (#i)rekeylimit=*) @@ -413,7 +383,13 @@ _ssh () { (#i)streamlocalbindmask=*) _message -e 'octal mask' && ret=0 ;; - (#i)(stricthostkeychecking|verifyhostkeydns|updatehostkeys)=*) + (#i)stricthostkeychecking=*) + _wanted values expl 'value' compadd yes no ask accept-new off && ret=0 + ;; + (#i)syslogfacility=*) + _wanted facilities expl 'facility' compadd -M 'm:{a-z}={A-Z}' DAEMON USER AUTH LOCAL{0,1,2,3,4,5,6,7} && ret=0 + ;; + (#i)(verifyhostkeydns|updatehostkeys)=*) _wanted values expl 'truthish value' compadd yes no ask && ret=0 ;; (#i)transport=*) @@ -446,7 +422,7 @@ _ssh () { # old options are after the empty "\"-line _wanted values expl 'configure file option' \ compadd -M 'm:{a-z}={A-Z}' -q -S '=' - \ - AddKeysToAgent \ + AddKeysToAgent \ AddressFamily \ BatchMode \ BindAddress \ @@ -455,14 +431,12 @@ _ssh () { CanonicalizeHostname \ CanonicalizeMaxDots \ CanonicalizePermittedCNAMEs \ - CertificateFile \ + CertificateFile \ ChallengeResponseAuthentication \ CheckHostIP \ - Cipher \ Ciphers \ ClearAllForwardings \ Compression \ - CompressionLevel \ ConnectionAttempts \ ConnectTimeout \ ControlMaster \ @@ -480,17 +454,21 @@ _ssh () { GatewayPorts \ GlobalKnownHostsFile \ GSSAPIAuthentication \ + GSSAPIClientIdentity \ GSSAPIDelegateCredentials \ + GSSAPIKeyExchange \ + GSSAPIRenewalForcesRekey \ + GSSAPIServerIdentity \ GSSAPITrustDns \ + GSSAPIKexAlgorithms \ HashKnownHosts \ - Host \ HostbasedAuthentication \ HostbasedKeyTypes \ HostKeyAlgorithms \ HostKeyAlias \ HostName \ IdentitiesOnly \ - IdentityAgent \ + IdentityAgent \ IdentityFile \ IgnoreUnknown \ IPQoS \ @@ -508,13 +486,13 @@ _ssh () { PKCS11Provider \ Port \ PreferredAuthentications \ - Protocol \ ProxyCommand \ - ProxyJump \ + ProxyJump \ ProxyUseFdpass \ PubkeyAcceptedKeyTypes \ PubkeyAuthentication \ RekeyLimit \ + RemoteCommand \ RemoteForward \ RequestTTY \ RevokedHostKeys \ @@ -526,8 +504,8 @@ _ssh () { StreamLocalBindMask \ StreamLocalBindUnlink \ StrictHostKeyChecking \ + SyslogFacility \ TCPKeepAlive \ - Transport \ Tunnel \ TunnelDevice \ UpdateHostKeys \ @@ -600,11 +578,18 @@ _ssh () { return ret ;; macs) - _values -s , 'MAC algorithms' hmac-md5 hmac-sha1 umac-64@openssh.com \ - hmac-ripemd160 hmac-sha1-96 hmac-md5-96 hmac-sha2-256 \ - hmac-sha2-256-96 hmac-sha2-512 hmac-sha2-512-96 && ret=0 + _wanted macs expl 'MAC algorithm' _sequence compadd - $(_call_program macs ssh -Q mac) + return + ;; + ciphers) + _wanted ciphers expl 'encryption cipher' _sequence compadd - $(_call_program ciphers ssh -Q cipher) + return ;; command) + if (( $+opt_args[-s] )); then + _wanted subsystems expl subsystem compadd sftp + return + fi local -a _comp_priv_prefix shift 1 words (( CURRENT-- )) @@ -662,46 +647,4 @@ _ssh_users () { _combination -s '[:@]' my-accounts users-hosts users "$@" } -_ssh_hosts () { - local -a config_hosts - local config - integer ind - - # If users-hosts matches, we shouldn't complete anything else. - if [[ "$IPREFIX" == *@ ]]; then - _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" && return - else - _combination -s '[:@]' my-accounts users-hosts \ - ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" && return - fi - if (( ind = ${words[(I)-F]} )); then - config=${~words[ind+1]} 2>/dev/null - else - config="$HOME/.ssh/config" - fi - if [[ -r $config ]]; then - local key line host - local -a lines=("${(@f)$(<"$config")}") 2>/dev/null - while (($#lines)); do - IFS=$'=\t ' read -r key line <<<"${lines[1]}" - case "$key" in - ((#i)include) - lines[1]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;; - ((#i)host(|name)) - for host in ${(z)line}; do - case $host in - (*[*?]*) ;; - (*) config_hosts+=("$host") ;; - esac - done ;& - (*) shift lines;; - esac - done - if (( ${#config_hosts} )); then - _wanted hosts expl 'remote host name' \ - compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts - fi - fi -} - _ssh "$@" diff --git a/Completion/Unix/Command/_stdbuf b/Completion/Unix/Command/_stdbuf new file mode 100644 index 000000000..e45b5a5cd --- /dev/null +++ b/Completion/Unix/Command/_stdbuf @@ -0,0 +1,30 @@ +#compdef stdbuf gstdbuf + +local -a short long buf args +local i opt gnu=0 + +short=( -e -i -o ) +long=( --error --output --input ) +buf=( err in out ) + +opt='[set initial buffering for std${buf[i]}]:mode or size:((0\:unbuffered L\:line\ buffered' +if _pick_variant gnu=GNU freebsd --version; then + gnu=1 + args=( + '(- *)--help[display usage information]' + '(- *)--version[display version information]' + ) +else + opt+=' B\:fully\ buffered' +fi +opt+='))' + +for ((i=1;i<=3;i++)); do + args+=( "(${long[i]})${short[i]}+${(e)opt}" ) + (( gnu )) && args+=( + "(${short[i]})${long[i]}=${(e)opt}" + ) +done +(( CURRENT > 2 )) && args+=( '*::command:_normal' ) + +_arguments -s -S $args diff --git a/Completion/Unix/Command/_strings b/Completion/Unix/Command/_strings new file mode 100644 index 000000000..8eeff704b --- /dev/null +++ b/Completion/Unix/Command/_strings @@ -0,0 +1,73 @@ +#compdef strings gstrings eu-strings + +local args variant format bytes +format='[precede each string by its byte offset in the file]:format:((d\:decimal o\:octal x\:hexadecimal))' +bytes='[specify minimum string length]:length (bytes) [4]' +args=( + '(-t --radix)-o[precede each string by its decimal byte offset]' + '!(-n --bytes)-'{1,2,3,4,5,6,7,8,9} +) + +if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfutils unix -V; then + args+=( + '(-a --all -d --data)'{-a,--all}'[look everywhere in file, not just initialised data space of object files]' + '(-e --encoding)'{-e+,--encoding=}'[select character size and endianness]:character type:(( + s\:7-bit + S\:8-bit + b\:16-bit\ big-endian + l\:16-bit\ little-endian + B\:32-bit\ big-endian + L\:32-bit\ little-endian))' + '(-f --print-file-name)'{-f,--print-file-name}'[print name of the file before each string]' + '(-n --bytes)'{-n+,--bytes=}"$bytes" + '(-d -t --radix)'{-t+,--radix=}"$format" + '(- *)--help[display help information]' + '(- *)--version[display version information]' + ) + case $variant in + elfutils|binutils) + args+=( '(- *)-V[display version information]' ) + ;| + elftoolchain|binutils) + args+=( + '(- *)-h[display help information]' + '(- *)-v[display version information]' + ) + ;| + binutils) + args+=( + '(-a --all -d --data)'{-d,--data}'[only print strings from file data sections]' + '(-w --include-all-whitespace)'{-w,--include-all-whitespace}'[include all whitespace as valid string characters]' + '(-T --target)'{-T+,--target=}'[specify binary file format]:format:compadd - ${(z)${(M)${(f)"$(_call_program targets strings --help)"}##* supported targets*}##*\: }' + '(-s --output-separator)'{-s+,--output-separator=}'[specify string used to separate strings in output]' + ) + ;; + elfutils) + args+=( + '(- *)--usage[display a short usage message]' + '(- *)-\\?[display help information]' + ) + ;; + esac +else + args+=( + "(-d)-t+$format" + "-n+$bytes" + '-a[look everywhere in file, not just initialised data space of object files]' + ) + case $OSTYPE in + darwin) + local -a arch + arch=( ${${${"$(_call_program architectures strings -arch \? 2>&1)"}#*flags are: }%%$'\n'*} ) + args+=( '-arch[specify the architecture]:architecture:compadd -a arch' ) + ;; + esac +fi + +if compset -P '@'; then + _files + return +fi + +_arguments -S -s $args \ + '*:file:_files' diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip index f244b0ace..630140c64 100644 --- a/Completion/Unix/Command/_strip +++ b/Completion/Unix/Command/_strip @@ -19,17 +19,22 @@ if _pick_variant gnu=GNU solaris --version; then '(-)--help[display usage information]' '(-)--info[display list of architectures and object formats]' '(-I --input-target)'{-I+,--input-target=}'[object code format of input]:bfd name:->bfdnames' - '(-O --output-target)'{-I+,--output-target=}'[object code format of output]:bfd name:->bfdnames' + '(-O --output-target)'{-O+,--output-target=}'[object code format of output]:bfd name:->bfdnames' + '(-D --enable-deterministic-archives -U --disable-deterministic-archives)'{-U,--disable-deterministic-archives}'[disable -D behavior]' + '(-D --enable-deterministic-archives -U --disable-deterministic-archives)'{-D,--enable-deterministic-archives}'[produce deterministic output when stripping archives (zero file metadata)]' '*'{-R+,--remove-section=}'[remove given sections]:section name' '--remove-relocations=[remove relocations from specified section]:section' '(-s --strip-all)'{-s,--strip-all}'[remove all symbols]' '(-g -S -d --strip-debug)'{-g,-S,-d,--strip-debug}'[remove debugging symbols]' + '--strip-dwo[remove all DWARF .dwo sections]' '--strip-unneeded[remove symbols not needed for relocation processing]' + '!(--no-merge-notes)'{-M,--merge-notes} + "--no-merge-notes[don't attempt to remove redundant notes]" '*'{-K+,--keep-symbol=}'[keep given symbol]:symbol name' '*'{-N+,--strip-symbol=}'[strip given symbol]:symbol name' '(*)-o+[output file]:output file:_files' '(-p --preserve-dates)'{-p,--preserve-dates}'[preserve access and modification dates]' - '(-w --wildcard)'{-w,--wildcard}'[permit wilcards in symbol names]' + '(-w --wildcard)'{-w,--wildcard}'[permit wildcards in symbol names]' '(-x --discard-all)'{-x,--discard-all}'[remove non-global symbols]' '(-X --discard-locals)'{-X,--discard-locals}'[remove compiler-generated local symbols]' '--keep-file-symbols[retain symbols specifying source file names]' diff --git a/Completion/Unix/Command/_stty b/Completion/Unix/Command/_stty index b5545ebcd..73347c5b7 100644 --- a/Completion/Unix/Command/_stty +++ b/Completion/Unix/Command/_stty @@ -1,4 +1,4 @@ -#compdef stty +#compdef stty gstty local expl diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index b4ccccfae..b7e10c06b 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -1,4 +1,4 @@ -#compdef svn svnadmin svnadmin-static=svnadmin +#compdef svn svnlite=svn svnadmin svnadmin-static=svnadmin _svn () { local curcontext="$curcontext" state line expl ret=1 @@ -24,7 +24,7 @@ _svn () { zstyle ":completion:*:*:$service:*" cache-policy _svn_caching_policy fi - _arguments -C \ + _arguments -C -A "-*" \ '(-)--help[print help information]' \ '(- *)--version[print client version information]' \ '1: :->cmds' \ @@ -34,7 +34,7 @@ _svn () { typeset -gHA _svn_cmds if _cache_invalid svn-cmds || ! _retrieve_cache svn-cmds; then _svn_cmds=( - ${=${(f)${${"$(_comp_locale; _call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} + ${=${(f)${${"$(_call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z-]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} ) if (( $? == 0 )); then _store_cache svn-cmds _svn_cmds @@ -60,39 +60,42 @@ _svn () { if _cache_invalid svn-${cmd}-usage || \ ! _retrieve_cache svn-${cmd}-usage; then - usage=${${(M)${(f)"$(_comp_locale; _call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] } + usage=${${(M)${(f)"$(_call_program options svn help $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)"$(_comp_locale; _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 $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[(I)*--accept:arg:]=( --accept'=:automatic conflict resolution action:((working\:working base\:base '"`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 `"'))' ) + args[idx]=( --accept'=:automatic conflict resolution action:((working\:working base\:base '"`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 `"'))' ) done while (( idx=$args[(I)*--c(l|hangelist):arg:] )); do - args[(I)*--c(l|hangelist):arg:]=( \*{--cl,--changelist}'=:change list:_svn_changelists' ) + args[idx]=( \*{--cl,--changelist}'=:change list:_svn_changelists' ) done while (( idx=$args[(I)*--config-dir:arg:] )); do - args[(I)*--config-dir:arg:]=( --config-dir'=:config dir:_directories' ) + args[idx]=( --config-dir'=:config dir:_directories' ) done + while (( idx=$args[(I)*--config-option:arg:] )); do + args[idx]=( '*--config-option=: :_svn_config_options' ) + done while (( idx=$args[(I)*--depth:arg:] )); do - args[(I)*--depth:arg:]=( --depth'=:operation depth (how far to recurse):(empty files immediates infinity)' ) + args[idx]=( --depth'=:operation depth (how far to recurse):(empty files immediates infinity)' ) done while (( idx=$args[(I)*(-F|--file):arg:] )); do - args[(I)*(-F|--file):arg:]=( '(-F --file)'{-F+,--file=}':log message file:_files' ) + args[idx]=( '(-F --file)'{-F+,--file=}':log message file:_files' ) done while (( idx=$args[(I)*--set-depth:arg:] )); do - args[(I)*--set-depth:arg:]=( --set-depth'=[make working copy deeper or shallower]:new depth:(exclude empty files immediates infinity)' ) + args[idx]=( --set-depth'=[make working copy deeper or shallower]:new depth:(exclude empty files immediates infinity)' ) done while (( idx=$args[(I)*--trust-server-cert-failures:arg:] )); do - args[(I)*--trust-server-cert-failures:arg:]=( --trust-server-cert-failures'=:failures:_values -s , "certificate failures to ignore" "unknown-ca[unknown authority]" "cn-mismatch[hostname mismatch]" "expired[certificate expired]" "not-yet-valid[certificate not yet valid]" "other[all other failures]"' ) + args[idx]=( --trust-server-cert-failures'=:failures:_values -s , "certificate failures to ignore" "unknown-ca[unknown authority]" "cn-mismatch[hostname mismatch]" "expired[certificate expired]" "not-yet-valid[certificate not yet valid]" "other[all other failures]"' ) done while (( idx=$args[(I)*--show-item:arg:] )); do # (q) to quote the parentheses in the value - args[(I)*--show-item:arg:]=( --show-item'=:item key:(('"`for i j in ${(kv)show_item_keys}; do print -rn - $i\\\\:"${(q)j}" ""; done`"'))' ) + args[idx]=( --show-item'=:item key:(('"`for i j in ${(kv)show_item_keys}; do print -rn - $i\\\\:"${(q)j}" ""; done`"'))' ) done # All other options get {-x+,--long-x=} args=( ${args/(#b)(--[A-Za-z0-9-]##):arg:/$match[1]=:arg:} ) @@ -227,7 +230,7 @@ _svnadmin () { if [[ -n $state ]] && (( ! $+_svnadmin_cmds )); then typeset -gHA _svnadmin_cmds _svnadmin_cmds=( - ${=${(f)${${"$(_comp_locale; _call_program commands svnadmin help)"#l#*Available subcommands:}}}/(#s)[[:space:]]#(#b)([-a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} + ${=${(f)${${"$(_call_program commands svnadmin help)"#l#*Available subcommands:}}}/(#s)[[:space:]]#(#b)([-a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} ) fi @@ -242,9 +245,9 @@ _svnadmin () { if (( $#cmd )); then curcontext="${curcontext%:*:*}:svnadmin-${cmd}:" - usage=${${(M)${(f)"$(_comp_locale; _call_program options svnadmin help $cmd)"}:#$cmd: usage:*}#$cmd: usage: svnadmin $cmd } + usage=${${(M)${(f)"$(_call_program options svnadmin help $cmd)"}:#$cmd: usage:*}#$cmd: usage: svnadmin $cmd } args=( - ${=${${${(M)${(f)"$(_comp_locale; _call_program options svnadmin help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]} + ${=${${${(M)${(f)"$(_call_program options svnadmin help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]} ) # All options get {-x+,--long-x=} args=( ${args/(#b)(--[A-Za-z0-9-]##):arg:/$match[1]=:arg:} ) @@ -417,6 +420,27 @@ _svnadmin_commands() { compadd "$@" -k _svnadmin_cmds || compadd "$@" ${(s.:.)_svnadmin_cmds} } +(( $+functions[_svn_config_options] )) || +_svn_config_options() { + local -a expl suf + local cfgfile + compset -S ':*' || suf=( -qS : ) + if compset -P 2 '*:'; then + if compset -P '*='; then + _message -e values 'value' + else + _message -e options 'option' + fi + elif compset -P 1 '*:'; then + cfgfile=( ~/.subversion/${(M)${IPREFIX%:}%(config|servers)}(N) /dev/null ) + _description sections expl 'section' + compadd $suf "$expl[@]" ${${${(M)${(f)"$(<${cfgfile[1]})"}:#\[*\]}#\[}%\]} + else + _description config-files expl 'configuration file' + compadd $suf "$expl[@]" config servers + fi +} + (( $+functions[_svn_props] )) || _svn_props() { local properties @@ -429,7 +453,7 @@ _svn_props() { _svn_changelists() { local cls - cls=( ${${${(M)${(f)"$(_comp_locale; _call_program changelists svn status 2>/dev/null)"}:#--- Changelist*}%??}##*\'} ) + cls=( ${${${(M)${(f)"$(_call_program changelists svn status 2>/dev/null)"}:#--- Changelist*}%??}##*\'} ) compadd "$@" -a cls && return 0 } diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo index ec293d469..10fa2e82e 100644 --- a/Completion/Unix/Command/_sudo +++ b/Completion/Unix/Command/_sudo @@ -47,7 +47,8 @@ else '(-s --shell)'{-s,--shell}'[run shell as the target user; a command may also be specified]' \ '(-i --login)'{-i,--login}'[run login shell as the target user; a command may also be specified]' \ '(-b --background -i --login -s --shell -e --edit)'{-b,--background}'[run command in the background]' \ - '(-E --preserve-env -i --login -s --shell -e --edit)'{-E,--preserve-env}'[preserve user environment when running command]' \ + '(--preserve-env -i --login -s --shell -e --edit)-E[preserve user environment when running command]' \ + '(-E -i --login -s --shell -e --edit)--preserve-env=-[preserve user environment when running command]::environment variable:_sequence _parameters -g "*export*"' \ '(-H --set-home -i --login -s --shell -e --edit)'{-H,--set-home}"[set HOME variable to target user's home dir]" \ '(-P --preserve-groups -i -login -s --shell -e --edit)'{-P,--preserve-groups}"[preserve group vector instead of setting to target's]" \ '(-)1:command: _command_names -e' diff --git a/Completion/Unix/Command/_tail b/Completion/Unix/Command/_tail index 4e6422621..599503ab5 100644 --- a/Completion/Unix/Command/_tail +++ b/Completion/Unix/Command/_tail @@ -1,4 +1,4 @@ -#compdef tail +#compdef tail gtail local curcontext=$curcontext state state_descr line opts args ret=1 typeset -A opt_args @@ -11,7 +11,7 @@ if _pick_variant gnu=GNU unix --version; then '(-F --follow)-f[same as --follow=descriptor]' '(-f --follow --retry)-F[same as --follow=name --retry]' '--max-unchanged-stats=[with --follow=name, check file rename after the specified number of iterations]:number of iterations' - '(-s --sleep-interval)'{-s+,--sleep-interval=}'[with -f, sleep the specfied seconds between iterations]:seconds' + '(-s --sleep-interval)'{-s+,--sleep-interval=}'[with -f, sleep the specified seconds between iterations]:seconds' '--pid=[with -f, terminate after the specified process dies]:pid:_pids' '(-q --quiet --silent -v --verbose)'{-q,--quiet,--silent}'[never output headers giving file names]' '(-q --quiet --silent -v --verbose)'{-v,--verbose}'[always output headers giving file names]' diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar index 4a2404873..cff50562e 100644 --- a/Completion/Unix/Command/_tar +++ b/Completion/Unix/Command/_tar @@ -99,10 +99,16 @@ if [[ "$PREFIX" = --* ]]; then # ...long options after `--'. - _arguments -- '--owner*:user:_users' \ + _arguments -- -l '--owner=*:user:_users' \ + '--group=*:group:_groups' \ + '--atime-preserve*::method:(replace system)' \ + '--*-script=NAME:script file:_files' \ + '--format=*:format:(gnu oldgnu pax posix ustar v7)' \ + '--quoting-style=*:quoting style:(literal shell shell-always c c-maybe escape locale clocale)' \ + '--totals*=SIGNAL*::signal:(HUP QUIT INT USR1 USR2)' \ '*=(PROG|COMMAND)*:program:_command_names -e' \ '*=ARCHIVE*:archive: _tar_archive' \ - '*=NAME*:file:_files' \ + '*=FILE*:file:_files' \ '*=DIR*:directory:_files -/' \ '*=CONTROL*::version control:(t numbered nil existing never simple)' diff --git a/Completion/Unix/Command/_texinfo b/Completion/Unix/Command/_texinfo index 57e13bdc2..b356ddbe7 100644 --- a/Completion/Unix/Command/_texinfo +++ b/Completion/Unix/Command/_texinfo @@ -1,4 +1,4 @@ -#compdef info tkinfo install-info makeinfo texi2any texi2dvi pdftexi2dvi texi2pdf texindex +#compdef info tkinfo pinfo install-info makeinfo texi2any texi2dvi pdftexi2dvi texi2pdf texindex _info_nodes_caching_policy() { local dir oldp @@ -45,6 +45,7 @@ case $service in '(: - -h --help)'{-h,--help}'[display usage]' \ '(-o --output -O)--index-search=[go directly to node if found]:search string: ' \ '(--index-search -o --output -O)'{-o+,--output=}'[dump selected nodes to filename]:filename:_files -g "*(-.)"' \ + '--init-file=[specify initialisation file]:file:_files' \ '(-n --node)'{-n+,--node=}'[specify nodes in first visited Info file]:node:->nodes' \ '--no-raw-escapes[output escapes as literal text]' \ '--restore=[read keystrokes from file]:filename:_files -g "*(-.)"' \ @@ -91,7 +92,7 @@ case $service in '--description=[specify description for menu entry]:description' \ '(2)--dir-file=[specify dir file]:dir file:_files -g "dir(-.)"' \ '(--test --dry-run)'{--dry-run,--test}"[don't update dir file]" \ - \*{--entry,--info}'[specify directory entry to add]:text' \ + \*{--entry,--item}'[specify directory entry to add]:text' \ '--defsection=[like --section, but only use text if no sections present in info file]:text' \ {--maxwidth,--max-width}'=[specify maximum width of dir file]:width' \ '(- 1 2)--help[display help information]' \ @@ -99,9 +100,10 @@ case $service in '(2)--info-dir=[specify directory containing dir file]:info directory:_files -/' \ '--keep-old=[inhibit replacement of existing entries/removal of empty sections]' \ '(--name --menuentry)'{--name,--menuentry}'=[specify the menu entry for dir file]:menu entry' \ - "--no-indent[don't format new entries in the DIR file]" + "--no-indent[don't format new entries in the DIR file]" \ '--quiet[suppress warnings]' \ '--regex=[specify sections for file entries using a regex]:regex' \ + '--remove-exactly[delete existing entries taking exact entry name]' \ '(--delete --remove)--section=[put new entries in specified section]:section' \ '--silent[no output except errors]' \ '(- 1 2)--version[display version information]' \ @@ -135,11 +137,13 @@ case $service in '(-E --macro-expand)'{-E,--macro-expand}'[output macro-expanded source to specified file]:file:_files' \ '(--docbook --xml)--no-split[suppress splitting of output]' \ '--no-number-sections[output chapter and section numbers]' \ + '!(--no-number-sections)--number-sections' \ '(-o --output=)'{-o,--output}'[specify output file]:output file:_files' \ '(--docbook --html --xml)--disable-encoding[output special characters]' \ - '(--docbook --html --xml)--fill-column=[specify width to break lines at]:width' \ + '!(--disable-encoding)--enable-encoding' \ + '(--docbook --html --xml)--fill-column=[specify width to break lines at]:width [72]' \ '(--docbook --html --xml)--footnote-style=[specify style for output of footnotes]:((separate\:in\ own\ node end\:at\ end\ of\ node))' \ - '(--docbook --html --xml)--paragraph-indent=[specify spaces to indent paragraphs by]' \ + '(--docbook --html --xml)--paragraph-indent=[specify spaces to indent paragraphs by]:indent [3]' \ '(--docbook --html --xml)--split-size=[split Info files at specified size]:size [300000]' \ '(--docbook --xml --plaintext)--css-include=[specify file in include in HTML <style> output]:file:_files' \ '(--docbook --xml --plaintext)--css-ref=[generate reference to a CSS file]:URL:_urls' \ @@ -223,6 +227,27 @@ case $service in '*::menu items:->infomanuals' && ret=0 info=( info ${(kv)opt_args[(I)-file]/-file/-f} ) ;; + pinfo) + cmd=$commands[info] + _arguments -s -S \ + '(- *)'{-h,--help}'[print usage information]' \ + '(- *)'{-v,--version}'[print version information]' \ + {-m,--manual}'[use man page]:*:: := _dispatch man man' \ + '(-r --raw-filename -f --file)'{-r,--raw-filename,-f,--file}'[use raw filename]' \ + '(-a --apropos)'{-a,--apropos}'[call apropos if nothing found]' \ + {-p,--plain-apropos}'[call only apropos]:*:: := _dispatch apropos apropos' \ + '(-c --cut-man-headers)'{-c,--cut-man-headers}'[cut out repeated man headers]' \ + '(-l --long-manual-links)'{-l,--long-manual-links}'[use long link names in manuals]' \ + '(-s --squeeze-manlines)'{-s,--squeeze-manlines}'[cut empty lines from manual pages]' \ + '(-d --dont-handle-without-tag-table)'{-d,--dont-handle-without-tag-table}"[don't display texinfo pages without tag table]" \ + '(-t --force-manual-tag-table)'{-t,--force-manual-tag-table}'[force manual detection of tag table]' \ + '(-l --long-manual-links)'{-l,--long-manual-links}'[use long link names in manuals]' \ + '(-x --clear-at-exit)'{-x,--clear-at-exit}'[clear screen at exit]' \ + '--node=[jump directly to specified node]:node:->nodes' \ + '--rcfile=[use alternate rcfile]:file:_files' \ + '1:menu item:->infomanuals' && ret=0 + file=${line[1]} + ;; esac if [[ -n $state ]]; then diff --git a/Completion/Unix/Command/_tidy b/Completion/Unix/Command/_tidy index ec2d74238..3998ccdb3 100644 --- a/Completion/Unix/Command/_tidy +++ b/Completion/Unix/Command/_tidy @@ -1,43 +1,31 @@ #compdef tidy -# HTML Tidy for Linux/x86 released on 1st March 2003 +local -a opts -local -a access autobool boolean doctype encoding +opts=( ${${${(s.</option>.)"$(_call_program options $words[1] -xml-config)"}##*<name>}/<\/name>*<type>/;} ) +opts=( ${opts/;Integer*/:number} ) +opts=( ${opts/;Boolean*/:boolean:(yes no)} ) +opts=( ${opts/;AutoBool*/:value:(auto yes no)} ) +opts=( ${opts/;(String|Tag|Attributes)*/:value} ) +opts=( ${opts/(#bi);(enum|Encoding|DocType)*<default>(*)<*<example>([^<]#)<*/:value [${match[2]%% *}]:(${(j. .)${(@s., .)match[3]}%% *})} ) +opts=( ${(M)opts:#*:*} ) -access=( 1 2 3 ) -boolean=( yes no ) -autobool=( auto $boolean ) -doctype=( auto omit strict loose transitional ) -encoding=( ascii latin1 raw utf8 iso2022 mac utf16le utf16be utf16 win1252 ibm858 big5 shiftjis ) - -_arguments \ +_arguments -s -A "-*" --$^opts \ '(-indent -i)'{-indent,-i}'[indent element content]' \ '-wrap[wrap text at the specified <column> (default is 68)]:column:' \ '(-upper -u)'{-upper,-u}'[force tags to upper case (default is lower case)]' \ '(-clean -c)'{-clean,-c}'[replace FONT, NOBR and CENTER tags by CSS]' \ '(-bare -b)'{-bare,-b}'[strip out smart quotes and em dashes, etc.]' \ + '(-gdoc -g)'{-gdoc,-g}'[produce clean version of html exported by Google Docs]' \ '(-numeric -n)'{-numeric,-n}'[output numeric rather than named entities]' \ '(-errors -e)'{-errors,-e}'[only show errors]' \ '(-quiet -q)'{-quiet,-q}'[suppress nonessential output]' \ - '-omit[omit optional end tags]' \ + '-omit[omit optional start and end tags]' \ '-xml[specify the input is well formed XML]' \ '(-asxml -asxhtml -ashtml)'{-asxml,-asxhtml}'[convert HTML to well formed XHTML]' \ '(-asxml -asxhtml)-ashtml[force XHTML to well formed HTML]' \ '-access[do additional accessibility checks (<level> = 1, 2, 3)]:priority level:(${access[@]})' \ '-raw[output values above 127 without conversion to entities]' \ - '( -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-ascii[use US-ASCII for output, ISO-8859-1 for input]' \ - '(-ascii -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-latin0[use US-ASCII for output, ISO-8859-1 for input]' \ - '(-ascii -latin0 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-latin1[use ISO-8859-1 for both input and output]' \ - '(-ascii -latin0 -latin1 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-iso2022[use ISO-2022 for both input and output]' \ - '(-ascii -latin0 -latin1 -iso2022 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-utf8[use UTF-8 for both input and output]' \ - '(-ascii -latin0 -latin1 -iso2022 -utf8 -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-mac[use MacRoman for input, US-ASCII for output]' \ - '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-win1252[use Windows-1252 for input, US-ASCII for output]' \ - '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -utf16le -utf16be -utf16 -shiftjis -big5)-ibm858[use IBM-858 (CP850+Euro) for input, US-ASCII for output]' \ - '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16be -utf16 -shiftjis -big5)-utf16le[use UTF-16LE for both input and output]' \ - '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16 -shiftjis -big5)-utf16be[use UTF-16BE for both input and output]' \ - '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -shiftjis -big5)-utf16[use UTF-16 for both input and output]' \ - '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -big5)-shiftjis[use Shift_JIS for both input and output]' \ - '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis )-big5[use Big5 for both input and output]' \ '(-out -o)'{-out,-o}'[specify the output markup file]:output file:_files' \ '-config[set configuration options from the specified <file>]:configuration file:_files' \ '-f[write errors to the specified <file>]:error file:_files' \ @@ -45,82 +33,30 @@ _arguments \ '(- *)'{-version,-v}'[show the version of Tidy]' \ '(- *)'{-help,-h,-\?}'[list the command line options]' \ '(- *)-help-config[list all configuration options]' \ + '(- *)-help-env[show details of environment and runtime configuration]' \ '(- *)-show-config[list the current configuration settings]' \ - '--indent-spaces:number of spaces:' \ - '--wrap:column:' \ - '--wrap-attributes:boolean:(${boolean[@]})' \ - '--wrap-script-literals:boolean:(${boolean[@]})' \ - '--wrap-sections:boolean:(${boolean[@]})' \ - '--wrap-asp:boolean:(${boolean[@]})' \ - '--wrap-jste:boolean:(${boolean[@]})' \ - '--wrap-php:boolean:(${boolean[@]})' \ - '--literal-attributes:boolean:(${boolean[@]})' \ - '--tab-size:tab size:' \ - '--markup:boolean:(${boolean[@]})' \ - '--quiet:boolean:(${boolean[@]})' \ - '--tidy-mark:boolean:(${boolean[@]})' \ - '--indent:boolean:(${autobool[@]})' \ - '--indent-attributes:boolean:(${boolean[@]})' \ - '--hide-endtags:boolean:(${boolean[@]})' \ - '--input-xml:boolean:(${boolean[@]})' \ - '--output-xml:boolean:(${boolean[@]})' \ - '--output-xhtml:boolean:(${boolean[@]})' \ - '--output-html:boolean:(${boolean[@]})' \ - '--add-xml-pi:boolean:(${boolean[@]})' \ - '--add-xml-decl:boolean:(${boolean[@]})' \ - '--assume-xml-procins:boolean:(${boolean[@]})' \ - '--raw:boolean:(${boolean[@]})' \ - '--uppercase-tags:boolean:(${boolean[@]})' \ - '--uppercase-attributes:boolean:(${boolean[@]})' \ - '--bare:boolean:(${boolean[@]})' \ - '--clean:boolean:(${boolean[@]})' \ - '--logical-emphasis:boolean:(${boolean[@]})' \ - '--word-2000:boolean:(${boolean[@]})' \ - '--drop-empty-paras:boolean:(${boolean[@]})' \ - '--drop-font-tags:boolean:(${boolean[@]})' \ - '--drop-proprietary-attribute:boolean:(${boolean[@]})' \ - '--enclose-text:boolean:(${boolean[@]})' \ - '--enclose-block-text:boolean:(${boolean[@]})' \ - '--alt-text:alternate text:' \ - '--add-xml-space:boolean:(${boolean[@]})' \ - '--fix-bad-comments:boolean:(${boolean[@]})' \ - '--split:boolean:(${boolean[@]})' \ - '--break-before-br:boolean:(${boolean[@]})' \ - '--numeric-entities:boolean:(${boolean[@]})' \ - '--quote-marks:boolean:(${boolean[@]})' \ - '--quote-nbsp:boolean:(${boolean[@]})' \ - '--quote-ampersand:boolean:(${boolean[@]})' \ - '--write-back:boolean:(${boolean[@]})' \ - '--keep-time:boolean:(${boolean[@]})' \ - '--show-warnings:boolean:(${boolean[@]})' \ - '--error-file:error file:_files' \ - '--output-file:output file:_files' \ - '--show-body-only:boolean:(${boolean[@]})' \ - '--slide-style:style sheet file:_files' \ - '--new-inline-tags:tag names:' \ - '--new-blocklevel-tags:tag names:' \ - '--new-empty-tags:tag names:' \ - '--new-pre-tags:tag names:' \ - '--char-encoding:encoding:(${encoding[@]})' \ - '--input-encoding:encoding:(${encoding[@]})' \ - '--output-encoding:encoding:(${encoding[@]})' \ - '--doctype:doctype:(${doctype[@]})' \ - '--fix-backslash:boolean:(${boolean[@]})' \ - '--gnu-emacs:boolean:(${boolean[@]})' \ - '--fix-uri:boolean:(${boolean[@]})' \ - '--lower-literals:boolean:(${boolean[@]})' \ - '--hide-comments:boolean:(${boolean[@]})' \ - '--indent-cdata:boolean:(${boolean[@]})' \ - '--force-output:boolean:(${boolean[@]})' \ - '--show-errors:maximum number of errors:' \ - '--ascii-chars:boolean:(${boolean[@]})' \ - '--join-classes:boolean:(${boolean[@]})' \ - '--join-styles:boolean:(${boolean[@]})' \ - '--escape-cdata:boolean:(${boolean[@]})' \ - '--repeated-attributes:value:(keep-first keep-last)' \ - '--output-bom:boolean:(${autobool[@]})' \ - '--replace-color:boolean:(${boolean[@]})' \ - '--css-prefix:CSS class name:' \ - '--accessibility-check:priority level:(${access[@]})' \ - '--newline:newline character:(LF CRLF CR)' \ - '*:file:_files' + '(- *)-export-config[list the current settings in config file form]' \ + '(- *)-export-default-config[list the default settings in config file form]' \ + "(*)-help-option[show a description of specified configuration option]:config option:(${(@j. .)opts%%:*})" \ + '(-lang -language)'{-lang,-language}'[set the two-letter language code]:language:_locales' \ + '-xml-help[list the command line options in XML format]' \ + '-xml-config[list all configuration options in XML format]' \ + "-xml-strings[output all of Tidy's strings in XML format]" \ + '-xml-error-strings[output error constants and strings in XML format]' \ + '-xml-options-strings[output option descriptions in XML format]' \ + '-options[specify file containing configuration settings]:config file:_files' \ + '*:file:_files' \ + + '(encoding)' \ + '-ascii[use US-ASCII for output, ISO-8859-1 for input]' \ + '-latin0[use US-ASCII for output, ISO-8859-1 for input]' \ + '-latin1[use ISO-8859-1 for both input and output]' \ + '-iso2022[use ISO-2022 for both input and output]' \ + '-utf8[use UTF-8 for both input and output]' \ + '-mac[use MacRoman for input, US-ASCII for output]' \ + '-win1252[use Windows-1252 for input, US-ASCII for output]' \ + '-ibm858[use IBM-858 (CP850+Euro) for input, US-ASCII for output]' \ + '-utf16le[use UTF-16LE for both input and output]' \ + '-utf16be[use UTF-16BE for both input and output]' \ + '-utf16[use UTF-16 for both input and output]' \ + '-shiftjis[use Shift_JIS for both input and output]' \ + '-big5[use Big5 for both input and output]' diff --git a/Completion/Unix/Command/_timeout b/Completion/Unix/Command/_timeout new file mode 100644 index 000000000..5c27bee47 --- /dev/null +++ b/Completion/Unix/Command/_timeout @@ -0,0 +1,20 @@ +#compdef timeout gtimeout + +local args + +if [[ $service = g* || $OSTYPE != *bsd* ]]; then + # GNU coreutils as opposed to Free/NetBSD implementation + args=( + '(-v --verbose)'{-v,--verbose}'[indicate when signal is sent upon timeout]' + '(- *)--help[display usage information]' + '(- *)--version[display version information]' + ) +fi + +_arguments -S -A "-" $args \ + '--preserve-status[always exit with the same status as command even if it times out]' \ + "--foreground[don't propagate timeout to the command children]" \ + '(-s --signal)'{-s,--signal}'[specify the signal to send on timeout]:signal:_signals' \ + '(-k --kill-after)'{-k,--kill-after}'[followup first signal with SIGKILL if command persists after specified time]:time:time' \ + '1: :_guard "[0-9.]#([smhd]|)" duration' \ + '*:::command:_normal' diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux index 7ef20c666..730959e84 100644 --- a/Completion/Unix/Command/_tmux +++ b/Completion/Unix/Command/_tmux @@ -168,7 +168,7 @@ _tmux-attach-session() { '-c+[specify working directory for the session]:directory:_directories' \ '-d[detach other clients attached to target session]' \ '-r[put the client into read-only mode]' \ - '-t+[specify target session]:target session:__tmux-sessions' \ + '-t+[specify target session]:target session: __tmux-sessions-separately' \ "-E[don't apply update-environment option]" } @@ -178,19 +178,18 @@ _tmux-bind-key() { '-c[bind to command mode instead of normal mode]' \ '-n[make the binding work without the need for the prefix key]' \ '-r[the key may repeat]' \ - '-t+[specify mode table for the binding]:mode table:__tmux-mode-tables' \ - '-R+[specify repeat count]:repeat count' \ '-T+[specify key table for the binding]:key table' \ '1:key' \ - '*:::template:_tmux' + '*:::template:= _tmux' } _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__tmux-format' \ + '-F+[specify output format]:format:__tmux-format' \ '-P[print information of new window after it has been created]' \ + '-n+[specify window name]:name' \ '-s+[specify source pane]:pane:__tmux-panes' \ '-t+[specify destination window]:pane:__tmux-panes' } @@ -212,49 +211,38 @@ _tmux-capture-pane() { } _tmux-choose-buffer() { - [[ -n ${tmux_describe} ]] && print "put a window into buffer choice mode" && return + [[ -n ${tmux_describe} ]] && print "put a pane into buffer choice mode" && return _arguments -s \ - '-F+[specify output format]:format:__tmux-format' \ + '-N[start without the preview]' \ + '-F+[specify format for each list item]:format:__tmux-formats' \ + '-f+[filter items]:filter format:__tmux-formats' \ + '-O+[initial sort order]:order:(time name size)' \ '-t+[specify target window]:session:__tmux-windows' \ - '*:::template:_tmux' + '*:::template:= _tmux' } _tmux-choose-client() { [[ -n ${tmux_describe} ]] && print "put a window into client choice mode" && return _arguments -s \ - '-F+[specify output format]:format:__tmux-format' \ - '-t+[specify target window]:session:__tmux-windows' \ - '*:::template:_tmux' -} - -_tmux-choose-session() { - [[ -n ${tmux_describe} ]] && print "put a window into session choice mode" && return - _arguments -s \ - '-F+[specify output format]:format:__tmux-format' \ + '-N[start without the preview]' \ + '-F+[specify format for each list item]:format:__tmux-formats' \ + '-f+[filter items]:filter format:__tmux-formats' \ + '-O+[initial sort order]:order:(time name size)' \ '-t+[specify target window]:session:__tmux-windows' \ - '*:::template:_tmux' + '*:::template:= _tmux' } _tmux-choose-tree() { [[ -n ${tmux_describe} ]] && print "put a window into tree choice mode" && return _arguments -s \ - '-b+[override default session command]:session-command' \ - '-c+[override default window command]:window-command' \ - '-S+[specify session format]:session-format:__tmux-formats' \ + '-N[start without the preview]' \ + '-F+[specify format for each list item]:format:__tmux-formats' \ + '-f+[filter items]:filter format:__tmux-formats' \ + '-O+[initial sort order]:order:(time name size)' \ '-s[choose among sessions]' \ '-t+[specify target window]:session:__tmux-windows' \ - '-u[show generated tree uncollapsed at startup]' \ - '-W+[specify window format]:window-format:__tmux-formats' \ '-w[choose among windows]' \ - '*:::template:_tmux' -} - -_tmux-choose-window() { - [[ -n ${tmux_describe} ]] && print "put a window into window choice mode" && return - _arguments -s \ - '-F=[specify output format]:format:__tmux-format' \ - '-t+[specify target window]:session:__tmux-windows' \ - '*:::template:_tmux' + '*:::template:= _tmux' } _tmux-clear-history() { @@ -270,10 +258,13 @@ _tmux-clock-mode() { _tmux-command-prompt() { [[ -n ${tmux_describe} ]] && print "open the tmux command prompt in a client" && return _arguments -s \ + '-1[only accept one key press]' \ + '-N' \ + '-i[execute the command every time the prompt input changes]' \ '-I+[specify list of initial inputs]:initial-text (comma-separated list)' \ '-p+[specify list of prompts]:prompts (comma-separated list)' \ '-t+[specify target client]:client:__tmux-clients' \ - '*:::template:_tmux' + '*:::template:= _tmux' } _tmux-confirm-before() { @@ -281,7 +272,7 @@ _tmux-confirm-before() { _arguments -s \ '-p+[specify prompt]:prompt string' \ '-t+[specify target client]:client:__tmux-clients' \ - '*:::command:_tmux' + '*:::command:= _tmux' } _tmux-copy-mode() { @@ -302,7 +293,8 @@ _tmux-detach-client() { _arguments -s \ '-a[kill all clients except for the named by -t]' \ '-P[send SIGHUP to parent process]' \ - '-s+[specify target session and kill its clients]:session:__tmux-sessions' \ + '-E+[run specified shell command to replace the client]:shell command:_cmdstring' \ + '-s+[specify target session and kill its clients]:session:__tmux-sessions-attached' \ '-t+[specify target client]:client:__tmux-clients' } @@ -312,20 +304,22 @@ _tmux-display-message() { '-c+[specify target client]:client:__tmux-clients' \ '-p[print message to stdout]' \ '-t+[specify target client]:client:__tmux-clients' \ - '-F+[specify output format]:format:__tmux-format' \ + '-F+[specify output format]:format:__tmux-formats' \ ':message' } _tmux-display-panes() { [[ -n ${tmux_describe} ]] && print "display an indicator for each visible pane" && return - _arguments '-t+[specify target client]:client:__tmux-clients' + _arguments -S \ + '-d+[time to show indicator for]:duration (ms)' \ + '-t+[specify target client]:client:__tmux-clients' \ + '*:::command:= _tmux' } _tmux-find-window() { [[ -n ${tmux_describe} ]] && print "search for a pattern in windows" && return _arguments -s \ '-C[match visible contents]' \ - '-F+[specify output format]:format:__tmux-format' \ '-N[match window name]' \ '-T[match window title]' \ '-t+[specify target window]:window:__tmux-windows' \ @@ -417,13 +411,13 @@ _tmux-link-window() { _tmux-list-buffers() { [[ -n ${tmux_describe} ]] && print "list paste buffers of a session" && return - _arguments '-F+[specify output format]:format:__tmux-format' + _arguments '-F+[specify output format]:format:__tmux-formats' } _tmux-list-clients() { [[ -n ${tmux_describe} ]] && print "list clients attached to server" && return _arguments -s \ - '-F+[specify output format]:format:__tmux-format' \ + '-F+[specify output format]:format:__tmux-formats' \ '-t+[specify session]:session:__tmux-sessions' } @@ -435,7 +429,6 @@ _tmux-list-commands() { _tmux-list-keys() { [[ -n ${tmux_describe} ]] && print "list all key-bindings" && return _arguments -s \ - '-t+[specify mode table]:mode table:__tmux-mode-tables' \ '-T+[specify key table]:key table' } @@ -449,20 +442,20 @@ _tmux-list-panes() { fi _arguments -s $args \ '-a[list all panes the server possesses]' \ - '-F+[specify output format]:format:__tmux-format' \ + '-F+[specify output format]:format:__tmux-formats' \ '-s[if specified, -t chooses a session]' } _tmux-list-sessions() { [[ -n ${tmux_describe} ]] && print "list sessions managed by server" && return - _arguments '-F+[specify output format]:format:__tmux-format' + _arguments '-F+[specify output format]:format:__tmux-formats' } _tmux-list-windows() { [[ -n ${tmux_describe} ]] && print "list windows of a session" && return _arguments -s \ '-a[list all windows the tmux server possesses]' \ - '-F[specify output format]:format:__tmux-format' \ + '-F[specify output format]:format:__tmux-formats' \ '-t+[specify session]:session:__tmux-sessions' } @@ -519,7 +512,7 @@ _tmux-new-session() { "-d[don't attach new session to current terminal]" \ "-D[in case of -A behave like attach-session's -d]" \ "-E[don't apply update-environment option]" \ - '-F+[specify output format]:format:__tmux-format' \ + '-F+[specify output format]:format:__tmux-formats' \ '-n+[specify initial window name]:window name' \ '-P[print information about new session after it is created]' \ '-s+[name the session]:session name:__tmux-sessions' \ @@ -535,7 +528,7 @@ _tmux-new-window() { '-a[insert new window at next free index from -t]' \ '-c+[specify working directory for the session]:directory:_directories' \ "-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' \ '-k[destroy it if the specified window exists]' \ '-n+[specify a window name]:window name' \ '-P[print information about new window after it is created]' \ @@ -626,6 +619,7 @@ _tmux-resize-pane() { _tmux-respawn-pane() { [[ -n ${tmux_describe} ]] && print "reuse a pane in which a command has exited" && return _arguments -s -A "-*" -S \ + '-c+[specify a new working directory for the pane]:directory:_directories' \ '-k[kill window if it is in use]' \ '-t+[specify target pane]:pane:__tmux-pane' \ ':command:_cmdambivalent' @@ -634,6 +628,7 @@ _tmux-respawn-pane() { _tmux-respawn-window() { [[ -n ${tmux_describe} ]] && print "reuse a window in which a command has exited" && return _arguments -s -A "-*" -S \ + '-c+[specify a new working directory for the window]:directory:_directories' \ '-k[kill window if it is in use]' \ '-t+[specify target window]:window:__tmux-windows' \ ':command:_cmdambivalent' @@ -686,6 +681,7 @@ _tmux-select-pane() { '-R[move to the pane right of target]' \ '-U[move to the pane above target]' \ '-P+[set pane style]:style:__tmux-style' \ + '-T+[set the pane title]:title' \ '-t+[specify target pane]:pane:__tmux-panes' } @@ -705,6 +701,8 @@ _tmux-send-keys() { '-l[disable key name lookup and send data literally]' \ '-R[reset terminal state]' \ '-M[pass through a mouse event]' \ + '-X[send a command into copy mode]' \ + '-N+[specify repeat count]:repeat count' \ '-t+[specify target pane]:pane:__tmux-panes' \ '*:key' } @@ -732,12 +730,33 @@ _tmux-set-buffer() { _tmux-set-environment() { [[ -n ${tmux_describe} ]] && print "(un)set an environment variable" && return - _arguments -s -A "-*" -S \ - '-g[modify global environment]' \ - '-r[remove variable before starting new processes]' \ - '-u[unset a variable]' \ - '-t[specify target session]:target session:__tmux-sessions' \ - ':name' ':value' + local mode=session action=add + local curcontext="$curcontext" state line ret=1 + typeset -A opt_args + _arguments -C -s -A "-*" -S : \ + '(-t)-g[modify global environment]' \ + '(-u)-r[remove variable before starting new processes]' \ + '(-r)-u[unset a variable]' \ + '(-g)-t[specify target session]:target session:__tmux-sessions' \ + ': :->name' '(-u -r)2: :->value' && ret=0 + + if (( ${+opt_args[-g]} )); then + mode=global + fi + if (( ${+opt_args[-u]} )); then + action=unset + fi + if (( ${+opt_args[-r]} )); then + action=remove + fi + + # TODO: the exclusion "(-g -r)2:" doesn't work, so simulate it here + if [[ $action == (remove|unset) ]] && [[ $state == value ]]; then + __tmux-nothing-else + else + __tmux-environment-variables $mode $state $action && ret=0 + fi + return ret } _tmux-set-option() { @@ -745,8 +764,9 @@ _tmux-set-option() { local mode=session local curcontext="$curcontext" state line ret=1 typeset -A opt_args - _arguments -C -s \ + _arguments -C -s : \ '-a[append to string options]' \ + '-F[expand formats in the option value]' \ '-g[set a global session option]' \ '-o[prevent setting of an option that is already set]' \ '-q[suppress errors about unknown or ambiguous options]' \ @@ -769,8 +789,9 @@ _tmux-set-window-option() { [[ -n ${tmux_describe} ]] && print "set a window option" && return local curcontext="$curcontext" state line ret=1 typeset -A opt_args - _arguments -C -s \ + _arguments -C -s : \ '-a[append to string options]' \ + '-F[expand formats in the option value]' \ '-g[set a global window option]' \ '-o[prevent setting of an option that is already set]' \ '-q[suppress errors about unknown or ambiguous options]' \ @@ -785,8 +806,10 @@ _tmux-set-hook() { [[ -n ${tmux_describe} ]] && print "set a hook to a command" && return _arguments -s \ '-g[add hook to global list]' \ - '-t+[specify target session]:session:__tmux-sessions' - ':command' + '-u[unset a hook]' \ + '-t+[specify target session]:session:__tmux-sessions' \ + ':hook name:_tmux_hooks' \ + '*:::command:= _tmux' } _tmux-show-hooks() { @@ -794,7 +817,6 @@ _tmux-show-hooks() { _arguments -s -S -A "-*" \ '-g[show global list of hooks]' \ '-t+[specify target session]:session:__tmux-sessions' \ - ':hook name:(alert-activity alert-bell alert-silence client-attached client-detached client-resized pane-died pane-exited)' \ } _tmux-show-buffer() { @@ -804,10 +826,21 @@ _tmux-show-buffer() { _tmux-show-environment() { [[ -n ${tmux_describe} ]] && print "display the environment" && return - _arguments -s \ - '-g[show global environment]' \ + local mode=session + local curcontext="$curcontext" state line ret=1 + typeset -A opt_args + _arguments -C -A "-*" -s : \ + '(-t)-g[show global environment]' \ '-s[format output as Bourne shell commands]' \ - '-t+[specify target session]:target session:__tmux-sessions' + '(-g)-t+[specify target session]:target session:__tmux-sessions' \ + '1:: :->name' && ret=0 + + if (( ${+opt_args[-g]} )); then + mode=global + fi + + __tmux-environment-variables $mode $state show && ret=0 + return ret } _tmux-show-messages() { @@ -820,21 +853,38 @@ _tmux-show-messages() { _tmux-show-options() { [[ -n ${tmux_describe} ]] && print "show session options" && return - _arguments -s \ + local mode=session + local curcontext="$curcontext" state line ret=1 + typeset -A opt_args + _arguments -C -s : \ '-g[show global options]' \ '-q[suppress errors about unknown or ambiguous options]' \ '-s[show server options]' \ '-v[show only the option value, not the name]' \ '-w[show window options]' \ - '-t+[specify target session]:target session:__tmux-sessions' + '-t+[specify target session]:target session:__tmux-sessions' \ + '*:: :->name_or_value' && ret=0 + + if (( ${+opt_args[-w]} )); then + mode=window + elif (( ${+opt_args[-s]} )); then + mode=server + fi + __tmux-options-complete ${mode} ${state} && ret=0 + return ret } _tmux-show-window-options() { [[ -n ${tmux_describe} ]] && print "show window options" && return - _arguments -s \ + local curcontext="$curcontext" state line ret=1 + typeset -A opt_args + _arguments -C -s : \ '-g[show global options]' \ '-v[show only the option value, not the name]' \ - '-t+[specify target window]:target window:__tmux-windows' + '-t+[specify target window]:target window:__tmux-windows' \ + '*:: :->name_or_value' && ret=0 + __tmux-options-complete window ${state} && ret=0 + return ret } _tmux-source-file() { @@ -849,7 +899,8 @@ _tmux-split-window() { _arguments -s \ '-b[create new pane left of or above target pane]' \ "-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' \ + '-f[create new pane spanning full window width or height]' \ '-h[split horizontally]' \ '-v[split vertically]' \ "-l[define new pane's size]:size" \ @@ -910,9 +961,7 @@ _tmux-unbind-key() { ow=( "${words[@]}" ) _arguments -C -s \ '-a[remove all key bindings]' \ - '-c[kill the window if it is only in one session]' \ '-n[remove a non-prefix binding]' \ - '-t+[specify mode table]:mode table:__tmux-mode-tables' \ '-T[specify key table]:key table' \ '*:: :->boundkeys' @@ -980,8 +1029,65 @@ function __tmux-clients() { _describe -t clients 'clients' clients } -function __tmux-format() { - _message 'not implemented yet' +function __tmux-environment-variables() { + local mode="$1" state="$2" action="$3" + + local -a dash_g + case $mode in + (global) dash_g=(-g);; + (session) dash_g=();; + (*) return 1;; # bug in the caller + esac + + local hint + case $action in + (add|remove) hint=" (or specify a new one)";; + (unset|show) hint="";; + (*) return 1;; # bug in the caller + esac + + case ${state} in + (name) + local -a vars_and_vals=( ${(@f)"$(command tmux 2>/dev/null show-env $dash_g)"} ) + local -a descriptions + local k_v k v + for k_v in $vars_and_vals; do + k=${k_v%%=*} + if [[ $k == -* ]]; then + k=${k#-} + v='(remove)' + else + v=${k_v#*=} + fi + descriptions+=( "${k//:/\\:}:$v" ) + done + # TODO: this if/else is because '_describe ${hint:+"-x"}' prints the "No matches" error in addition to the message. + local msg="${dash_g[1]:+"global "}environment variables${hint}" + if _describe -t parameters $msg descriptions; then + : + elif [[ -n $hint ]]; then + _message $msg + fi + ;; + (value) + local var_and_val=${(@f)"$(command tmux 2>/dev/null show-env $dash_g -- ${(Q)words[-2]})"} + # 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]}" + compadd "$expl[@]" - ${var_and_val#*=} + else + _message "Value for ${words[-2]}" + fi + ;; + (*) + return 1 + ;; + esac +} + +__tmux-formats() { + _message 'not implemented yet' } function __tmux-colours() { @@ -995,6 +1101,12 @@ function __tmux-colours() { fi } +_tmux_hooks() { + _alternative \ + 'hooks:hook name:(alert-activity alert-bell alert-silence client-attached client-detached client-resized client-session-changed pane-died pane-exited pane-set-clipboard session-created session-closed session-renamed window-linked window-renamed window-unlinked)' \ + 'post-hooks:command post-hook:compadd - after-${_tmux_aliasmap}' +} + function __tmux-get-optarg() { local opt="$1" local -i i @@ -1010,12 +1122,6 @@ function __tmux-get-optarg() { done } -__tmux-mode-tables() { - local expl - _description mode-tables expl 'mode table' - compadd "$@" "$expl[@]" vi-edit emacs-edit vi-choice emacs-choice vi-copy emacs-copy -} - __tmux-nothing-else() { _message "no further arguments" } @@ -1260,6 +1366,32 @@ function __tmux-sessions() { _describe -t sessions 'sessions' sessions "$@" } +function __tmux-sessions-attached() { + local -a sessions + sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} ) + sessions=( ${(M)sessions:#*"(attached)"} ) + _describe -t sessions 'attached sessions' sessions "$@" +} + +# Complete attached-sessions and detached-sessions as separate tags. +function __tmux-sessions-separately() { + local ret=1 + local -a sessions detached_sessions attached_sessions + sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} ) + detached_sessions=( ${sessions:#*"(attached)"} ) + attached_sessions=( ${(M)sessions:#*"(attached)"} ) + + # ### This seems to work without a _tags loop but not with it. I suspect + # ### that has something to do with _describe doing its own _tags loop. + _tags detached-sessions attached-sessions + # Placing detached before attached means the default behaviour of this + # function better suits its only current caller, _tmux-attach-session(). + _requested detached-sessions && _describe -t detached-sessions 'detached sessions' detached_sessions "$@" && ret=0 + _requested attached-sessions && _describe -t attached-sessions 'attached sessions' attached_sessions "$@" && ret=0 + + return ret +} + function __tmux-socket-name() { local expl sdir local curcontext="${curcontext}" diff --git a/Completion/Unix/Command/_todo.sh b/Completion/Unix/Command/_todo.sh index eb0be55e5..287c9ff78 100644 --- a/Completion/Unix/Command/_todo.sh +++ b/Completion/Unix/Command/_todo.sh @@ -17,12 +17,24 @@ local -a cmdlist itemlist match mbegin mend integer NORMARG _arguments -s -n : \ + '-@[hide context names]' \ + '-\+[hide project names]' \ + '-c[color mode]' \ '-d[alternate config file]:config file:_files' \ '-f[force, no confirmation]' \ '-h[display help]' \ '-p[plain mode, no colours]' \ + '-P[hide priority labels]' \ + "-a[don't auto-archive tasks when done]" \ + '-A[auto-archive tasks when done]' \ + '-n[automatically remove blank lines]' \ + '-N[preserve line numbers]' \ + '-t[add current date to task on creation]' \ + "-T[don't add current date to task]" \ '-v[verbose mode, confirmation messages]' \ + '-vv[extra verbose (debug)]' \ '-V[display version etc.]' \ + '-x[disable final filter]' \ '1:command:->commands' \ '*:arguments:->arguments' && return 0 diff --git a/Completion/Unix/Command/_tr b/Completion/Unix/Command/_tr index d55fab5ff..1cfe1200a 100644 --- a/Completion/Unix/Command/_tr +++ b/Completion/Unix/Command/_tr @@ -1,7 +1,7 @@ -#compdef tr +#compdef tr gtr local curcontext="$curcontext" state line expl ret=1 -local args variant +local args variant k local -A descr descr=( -c '[complement characters specified by first string]' @@ -28,7 +28,7 @@ case $variant in ;| *) for k in c d s; do - args+=( -$k$descr[$k] ) + args+=( -$k$descr[-$k] ) done ;; esac diff --git a/Completion/Unix/Command/_tracepath b/Completion/Unix/Command/_tracepath deleted file mode 100644 index eb49e567d..000000000 --- a/Completion/Unix/Command/_tracepath +++ /dev/null @@ -1,5 +0,0 @@ -#compdef tracepath tracepath6 - -_arguments \ - ':destination:_hosts' \ - ':port:_ports' diff --git a/Completion/Unix/Command/_truss b/Completion/Unix/Command/_truss index 656c94244..b798f03cb 100644 --- a/Completion/Unix/Command/_truss +++ b/Completion/Unix/Command/_truss @@ -15,6 +15,9 @@ args=( ) case $OSTYPE in + solaris2.<11->) + args+=( '(-c)-A[include absolute timestamps in output]' ) + ;| aix*|solaris*) args+=( '(-c)-E[include delta timestamps of time spent within the system call]' @@ -40,6 +43,9 @@ case $OSTYPE in "(-c)-S[don't report signals received by the process]" '(*)-p[trace specified existing processes]:pid:_pids' ) + ;| + freebsd<10->.*) + args+=( '-H[include thread ID in the output of each event]' ) ;; esac diff --git a/Completion/Unix/Command/_uname b/Completion/Unix/Command/_uname index 414a82a87..31af91eb7 100644 --- a/Completion/Unix/Command/_uname +++ b/Completion/Unix/Command/_uname @@ -1,4 +1,4 @@ -#compdef uname +#compdef uname guname typeset -A _uname_args local -a args diff --git a/Completion/Unix/Command/_unexpand b/Completion/Unix/Command/_unexpand index c983c628f..b548b3c3a 100644 --- a/Completion/Unix/Command/_unexpand +++ b/Completion/Unix/Command/_unexpand @@ -1,26 +1,37 @@ -#compdef unexpand +#compdef unexpand gunexpand expand gexpand -local all tabs ret=1 +local all tabs local -a args all="convert all whitespace, instead of just initial whitespace" -tabs="use comma separated list of tab positions" -args=( - "(--all)-a[$all]" - "(--tabs)-t[$tabs]:tablist" - "*:file:_files" -) +tabs="[use comma separated list of tab positions]:list of tab positions" if _pick_variant gnu="Free Soft" unix --version; then - args+=( - "(-a)--all[$all]" - "--first-only[convert only leading sequences of whitespace]" - "(-t)--tabs=[$tabs]:tablist" - "(* -)--help[display help message and exit]" - "(* -)--version[output version information and exit]" + if [[ $service = *un* ]]; then + args=( + "(-a --help --version)--all[$all]" + '(--help --version)--first-only[convert only leading sequences of whitespace]' ) + else + args=( + '(-i --initial --help --version)'{-i,--initial}"[don't convert tabs after non blanks]" + ) + fi + + args+=( + "(-t --help --version)--tabs=${tabs}" + '(* -)--help[display usage information]' + '(* -)--version[display version information]' + ) +elif [[ $OSTYPE = (*bsd*|dragonfly*|darwin*) ]]; then + args=( -A "-*" ) fi +[[ $service = *un* ]] && args+=( "(--all --help --version)-a[$all]" ) -_arguments "$args[@]" && ret=0 +# Most (un)expand variants, excluding BusyBox, allow e.g. -4 instead of -t4 +[[ $_cmd_variant[$service] == *busybox* ]] || +args+=( '!(-0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -t --tabs)-'{0..9} ) -return ret +_arguments -s -S "$args[@]" \ + "(--tabs --help)-t+${tabs}" \ + '*:file:_files' diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim index 9fd2d63e8..042974338 100644 --- a/Completion/Unix/Command/_vim +++ b/Completion/Unix/Command/_vim @@ -1,4 +1,4 @@ -#compdef vim gvim gex gview nvim rvim rview rgvim rgview evim eview vimdiff gvimdiff +#compdef vim gvim gex gview nvim rvim rview rgvim rgview evim eview vimdiff gvimdiff mvim (( $+functions[_vim_files] )) || _vim_files () { @@ -40,6 +40,7 @@ arguments=( '(-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]::rc file:_files' "--noplugin[don't load plugin scripts]" '-o-[number of windows to open (default: one for each file)]::window count: ' @@ -70,10 +71,12 @@ arguments=( '--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' + '--clean[defaults, no plugins, no viminfo]' '(- *)'{-h,--help}'[print help and exit]' '(- *)--version[print version information and exit]' '(* -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]' [[ $service != r* ]] && arguments+='-Z[restricted mode]' @@ -99,7 +102,7 @@ if [[ "$state" = server ]]; then elif [[ $state = verbosity ]]; then _tags numbers files while _tags; do - _requested numbers && _describe 'verbosity [10]' "( + _requested numbers && _describe -V 'verbosity [10]' "( 0:don\'t' display any messages' 1:'display when viminfo file is read or written' 2:'display sourced files' diff --git a/Completion/Unix/Command/_vorbis b/Completion/Unix/Command/_vorbis index eee4f7a5e..cb3e3f9d8 100644 --- a/Completion/Unix/Command/_vorbis +++ b/Completion/Unix/Command/_vorbis @@ -79,7 +79,7 @@ case $service in esac if [[ $state = devopts ]]; then - if compset -p '*:'; then + if compset -P '*:'; then _message -e value value else _wanted devopts expl 'device option' \ diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget index 8a9cc871a..1a7e2d0a3 100644 --- a/Completion/Unix/Command/_wget +++ b/Completion/Unix/Command/_wget @@ -1,6 +1,6 @@ #compdef wget -local curcontext="$curcontext" state line +local curcontext="$curcontext" state line expl typeset -A opt_args _arguments -C -s \ @@ -19,12 +19,15 @@ _arguments -C -s \ '(--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' \ + '(--config)--no-config' '--rejected-log=:file:_files' \ '(--tries -t)'{--tries=,-t+}'[set number of retries]:number of retries' \ '--retry-connrefused[retry even if connection is refused]' \ '(--output-document -O)'{--output-document=,-O+}'[specify file to write documents to]:output file:_files' \ '(--continue -c)'{--continue,-c}'[continue getting an existing file]' \ + '--start-pos=:offset' '--show-progress' \ '--progress=[set progress gauge type]:gauge type:->gauge' \ '(--timestamping -N)'{--timestamping,-N}'[retrieve only files newer than existing]' \ + '--no-if-modified-since' \ "--no-use-server-timestamps[don't set the local file's timestamp by the one on the server]" \ '(--server-response -S)'{--server-response,-S}'[print server response]' \ "--spider[don't download anything]" \ @@ -49,11 +52,15 @@ _arguments -C -s \ '(--http-user --ftp-user)--user[set both ftp and http user]:user' \ '(--http-password --ftp-password)--password[set both ftp and http password]:password' \ '(--password --http-password --ftp-password)--ask-password:[prompt for passwords]' \ + '--use-askpass=:command:_command_names -e' \ '--no-iri[turn off IRI support]' \ '--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]' \ + '(-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]" \ '--protocol-directories[use protocol name in directories]' \ '(--directory-prefix -P)'{--directory-prefix=,-P+}'[specify prefix to save files to]:prefix:_files -/' \ '--cut-dirs=:number:' \ @@ -64,6 +71,7 @@ _arguments -C -s \ '(--adjust-extension -E)'{--adjust-extension,-E}'[save all HTML/CSS documents with proper extensions]' \ "--ignore-length[ignore \`Content-Length' header field]" \ '*--header=[send a custom HTTP header]:header:->header' \ + '--compression=:compression:(auto gzip none)' \ '--max-redirect=:number' \ '--proxy-user=:user' \ '--proxy-password=:password' \ @@ -83,7 +91,7 @@ _arguments -C -s \ '--content-disposition[honor the Content-Disposition header when choosing local file names]' \ '--content-on-error[output received content on server errors]' \ "--auth-no-challenge[send basic HTTP authentication without first waiting for server's challenge]" \ - '--secure-protocol=[choose secure protocol]:protocol:(SSLv2 SSLv3 TLSv1)' \ + '--secure-protocol=[choose secure protocol]:protocol:(SSLv2 SSLv3 TLSv1 TLSv1_1 TLSv1_2 PFS)' \ --https-only \ "--no-check-certificate=[don't check the server certificate]" \ '--certificate=[specify client certificate]:client certificate file:_files' \ @@ -92,15 +100,20 @@ _arguments -C -s \ '--private-key-type=[specify private key type]:key type:key type:(PEM DER)' \ "--ca-certificate=[specify file with bundle of CA's]:file:_files" \ "--ca-directory=[specify dir where hash list of CA's are stored]:directory:_directories" \ + '--crl-file=[specify file with bundle of CRLs]:file:_files' \ + '--pinnedpubkey=:file:_files' \ '--random-file[specify file with random data for seeding generator]:file:_files' \ '--egd-file=[specify filename of EGD socket]:file:_files' \ + '--no-hsts[disable HSTS]' \ + '--hsts-file[specify path of HSTS database]:file:_files' \ '(--user)--ftp-user=:user' \ '(--password --ask-password)--ftp-password=:password' \ "--no-remove-listing[don't remove \`.listing' files]" \ '--no-glob[turn off FTP file name globbing]' \ '--no-passive-ftp' \ '--preserve-permissions[preserve remote file permissions with ftp]' \ - '--retr-symlinks' \ + --retr-symlinks --ftps-implicit --ftps-resume-ssl \ + --ftps-clear-data-connection --ftps-fallback-to-ftp \ '--warc-file=:file:_files' --warc-header=:string --warc-max-size=:number \ --warc-cdx --warc-dedup=:file:_files --no-warc-compression --no-warc-digests \ --no-warc-keep-log --warc-tempdir=:directory:_directories \ @@ -108,6 +121,7 @@ _arguments -C -s \ '(--level -l)'{--level=,-l+}'[specify maximum recursion depth]:level' \ '--delete-after' \ '(--convert-links -k)'{--convert-links,-k}'[convert links to be relative]' \ + --convert-file-only \ '--backups=:max backups' \ '(--backup-converted -K)'{--backup-converted,-K}'[backup files before conversion]' \ '(--mirror -m -r -N -l)'{--mirror,-m}'[mirror (-r -N -l inf --no-remove-listing)]' \ @@ -129,8 +143,7 @@ _arguments -C -s \ '(-np --no-parent)'{-np,--no-parent}"[don't ascend to parent directory]" \ '--no-verbose' \ '--no-clobber' \ - '--no-directories' \ - '--no-host-directories' \ + '--no-netrc' \ '--no-use-server-timestamps[do not set timestamp to server provided value]' \ '--htmlify=:htmlify:' \ '--no:no:->noflags' \ @@ -154,10 +167,15 @@ case "$state" in _values -s , 'filename char restriction' \ '(windows)unix' \ '(unix)windows' \ - '(unix windows)nocontrol' + '(unix windows)nocontrol' \ + ascii \ + '(uppercase)lowercase' \ + '(lowercase)uppercase' ;; header) local -a headers + local suf=': ' + compquote suf headers=( Accept{,-{Charset,Encoding,Language,Datetime}} Authorization @@ -191,7 +209,6 @@ case "$state" in X-ATT-DeviceId X-Wap-Profile ) - headers=($^headers\\:\ ) - _describe -t header 'HTTP header' headers + _wanted headers expl 'HTTP header' compadd -S $suf -a headers ;; esac diff --git a/Completion/Unix/Command/_whois b/Completion/Unix/Command/_whois index 2dd04f9cd..a8180f60e 100644 --- a/Completion/Unix/Command/_whois +++ b/Completion/Unix/Command/_whois @@ -1,6 +1,7 @@ #compdef whois fwhois _whois () { + local _whois_comp _whois_setup case "$0" in fwhois) _whois_fwhois;; diff --git a/Completion/Unix/Command/_xmlstarlet b/Completion/Unix/Command/_xmlstarlet new file mode 100644 index 000000000..4c8257046 --- /dev/null +++ b/Completion/Unix/Command/_xmlstarlet @@ -0,0 +1,177 @@ +#compdef xmlstarlet xml + +local curcontext="$curcontext" ret=1 +local -a args state line suf + +args=( '(- *)--help[display usage information]' ) +_arguments -C -A "-*" $args \ + '(-q --quiet)'{-q,--quiet}'[no error output]' \ + "--no-doc-namespace[don't extract namespace bindings from input doc]" \ + '!(--no-doc-namespace)--doc-namespace' \ + '(-)--version[display version information]' \ + '1:command:(( + ed{,it}\:edit\ or\ update\ documents + sel{,ect}\:select\ date\ or\ query\ documents + tr{,ransform}\:transform\ documents\ using\ XSLT + val{,idate}\:validate\ documents + fo{,rmat}\:format\ documents + el{,ements}\:display\ element\ structure + {c14n,canonic}\:XML\ canonicalization + l{s,ist}\:list\ directory\ as\ XML + esc{,ape}\:escape\ special\ XML\ characters + unesc{,ape}\:unescape\ special\ XML\ characters + {pyx,xmln}\:convert\ XML\ into\ the\ line-oriented\ PYX\ format + {p2x,depyx}\:convert\ PYX\ into\ XML + ))' \ + '*: :->args' && ret=0 + +if [[ -n $state ]]; then + shift words + (( CURRENT-- )) + curcontext="${curcontext%:*:*}:$service-${words[1]}:" + case $words[1] in + el(|ements)|fo(|rmat)|sel(|ect)|c14n|canonic|xmln|pyx) + args+=( '1:file:_files -g "(#i)*.xml(-.)"' ) + ;| + ed(|it)|sel(|ect)) + args+=( '*-N[predefine namespaces]:namespace' ) + ;| + c14n|canonic|ed(|it)|fo(|rmat)|sel(|ect)|tr(|ansform)|val(|idate)) + args+=( '--net[allow fetching of DTDs or entities over network]' ) + ;| + fo(|rmat)|tr(|ansform)) + args+=( '(-o --omit-decl)'{-o,--omit-decl}'[omit XML declaration]' ) + ;| + + ed(|it)) + args=( + '(opt)*'{-d,--delete}'[remove element]:xpath expression' + '(opt)*'{-i,--insert}'[add element before node matched by expression]:xpath expression - insert before matched node' + '(opt)*'{-a,--append}'[add element after node matched by expression]:xpath expression - insert after matched node' + '(opt)*'{-s,--subnode}'[add element as a child of node matched by expression]:xpath expression for parent modes' + '(opt)*'{-m,--move}'[move element]:xpath expression: :xpath expression' + '(opt)*'{-r,--rename}'[rename element]:xpath expression' + '(opt)*'{-u,--update}'[update element]:xpath expression' + '*:file:_files -g "(#i)*.xml(-.)"' + + opt $args + '(-P -S --pf --ps)'{-P,-S,--pf,--ps}'[preserve whitespace nodes]' + '(-O --omit-decl)'{-O,--omit-decl}'[omit XML declaration]' + '(-L --inplace)'{-L,--inplace}'[edit file inplace]' + ) + if [[ -n ${${words[2,CURRENT-1]}[(r)-([ias]|-insert|-append|-subnode)]} ]]; then + args=( + '(opt)*'{-t,--type}'[specify type of node to add]:type:(elem text attr)' + '(opt)*'{-n,--name}'[specify name of node to add]:name' + $args + ) + fi + if [[ -n ${${words[2,CURRENT-1]}[(r)-([iasru]|-insert|-append|-subnode|-rename|-update)]} ]]; then + args=( '(opt)*'{-v,--value}'[specify value of node to add or name of renamed node]:value' $args ) + fi + ;; + el(|ements)) + args+=( + '(-)-a[show attributes as well]' + '(-)-v[show attributes and their values]' + '(-)-u[print out sorted unique lines]' + '(-)-d-[print out sorted unique lines up to specified depth]:depth' + ) + ;; + fo(|rmat)) + args+=( + '(-t --indent-tab -s --indent-spaces -n --noindent)'{-n,--noindent}"[don't indent]" + '(-t --indent-tab -s --indent-spaces -n --noindent)'{-t,--indent-tab}'[indent output with tabs]' + '(-t --indent-tab -s --indent-spaces -n --noindent)'{-s,--indent-spaces}'[indent output with specified number of spaces]:spaces' + '(-R --recover)'{-R,--recover}'[try to recover what is parsable]' + '(-D --dropdtd)'{-D,--dropdtd}'[remove the DOCTYPE of the input docs]' + '(-C --nocdata)'{-C,--nocdata}'[replace cdata section with text nodes]' + '(-N --nsclean)'{-N,--nsclean}'[remove redundant namespace declarations]' + '(-e --encode)'{-e,--encode}'[output in the specified encoding]:encoding' + '(-H --html)'{-H,--html}'[input is HTML]' + ) + ;; + sel(|ect)) + [[ -n ${${words[2,CURRENT-1]}[(r)-t]} ]] && args+=( + \*{-c,--copy-of}'[print copy of XPath expression]:xpath expression' + \*{-v,--value-of}'[print value of XPath expression]:xpath expression' + \*{-o,--output}'[output string literal]:string' + \*{-n,--nl}'[print new line]' + \*{-f,--inp-name}'[print input file name (or URL)]' + \*{-m,--match}'[match XPath expression]:xpath expression' + \*{-v,--var}'[declare a variable]:variable' + \*{-i,--if,--elif}'[check condition]:condition' + '*--else[check if previous conditions failed]' + \*{-e,--elem}'[print out specified element]:element' + \*{-b,--break}'[break nesting]' + \*{-s,--sort}'[specify sort order]:order:->ordering:xpath expression' + ) + args+=( + '(opt)*-t[start query template]' + + opt + '(-Q --quiet)'{-Q,--quiet}"[don't write anything to standard output]" + '(-C --comp)'{-C,--comp}'[display generated XSLT]' + '(-R --root)'{-R,--root}'[print root element]' + '(-T --text -e --elem)'{-T,--text}'[output is text]' + '(-I --indent)'{-I,--indent}'[indent output]' + '(-D --xml-decl)'{-D,--xml-decl}"[don't omit xml declaration line]" + '(-B --noblanks)'{-B,--noblanks}'[remove insignificant spaces from XML tree]' + '(-E --encode)'{-E,--encode}'[output in the specified encoding]:encoding' + ) + ;; + tr(|ansform)) + args+=( + '(--embed -E)'{--embed,-E}'[allow applying embedded stylesheet]' + '(1 * -)--show-ext[show list of extensions]' + '--val[allow validation against DTD or schema]' + '--xinclude[do XInclude processing on document input]' + '--maxdepth[increase the maximum depth]:val' + '--html[input is HTML]' + '1:xsl file:_files -g "(#i)*.xsl(|t)(-.)"' + '*:xml file:_files' + ) + ;; + val(|idate)) + args+=( + '!(-d --dtd -s --xsd -r --relaxng)'{-w,--well-formed} + '(-d --dtd -s --xsd -r --relaxng)'{-d,--dtd}'[validate against DTD]:file:_files -g "(#i)*.dtd(-.)"' + '(-d --dtd -s --xsd -r --relaxng)'{-s,--xsd}'[validate against XSD schema]:schema file:_files -g "(#i)*.xsd(-.)"' + '(-E --embed)'{-E,--embed}'[validate using embedded DTD]' + '(-d --dtd -s --xsd -r --relaxng)'{-r,--relaxng}'[validate against schema]:schema file:_files -g "(#i)*.rng(-.)"' + '(-e --err)'{-e,--err}'[print verbose error messages on stderr]' + '(-S --stop)'{-S,--stop}'[stop on first error]' + '(-b --list-bad -g --list-good)'{-b,--list-bad}"[list only files that don't validate]" + '(-b --list-bad -g --list-good -q --quiet)'{-g,--list-good}'[list only files that validate]' + '(-b --list-bad -g --list-good -q --quiet)'{-q,--quiet}"[don't list files (return result code only)]" + '*:file:_files -g "(#i)*.xml(-.)"' + ) + ;; + c14n|canonic) + args+=( + '!(-)--with-comments' + '(-)--without-comments[XML file canonicalization without comments]' + '(-)--exc-with-comments[exclusive XML file canonicalization with comments]' + '(-)--exc-without-comments[exclusive XML file canonicalization without comments]' + '2:xpath file:_files' + '3:namespace prefix list' + ) + ;; + (un|)esc(|ape)) args+=( '1: :_guard "^-*" string' ) ;; + ls|list) args+=( '1:path:_directories' ) ;; + depyx|p2x) args+=( '1:pyx file:_files' ) ;; + esac + _arguments -C -A "-*" $args && ret=0 + case $state in + ordering) + compset -S ':*' || suf=( -S : ) + if compset -P 2 '*:'; then + _describe -t case-order case-order '(U:upper-first L:lower-first)' && ret=0 + elif compset -P 1 '*:'; then + _describe -t data-type data-type '(N:numeric T:text)' $suf && ret=0 + else + _describe -t order order '(A:ascending D:descending)' $suf && ret=0 + fi + ;; + esac +fi + +return ret diff --git a/Completion/Unix/Command/_yp b/Completion/Unix/Command/_yp index 104a0b4df..ed3761436 100644 --- a/Completion/Unix/Command/_yp +++ b/Completion/Unix/Command/_yp @@ -1,25 +1,27 @@ #compdef ypcat ypmatch yppasswd ypwhich ypset ypserv ypbind yppush yppoll ypxfr domainname -local curcontext="$curcontext" line state expl ret=1 +local curcontext="$curcontext" line state expl args ret=1 typeset -A opt_args -if (( ! $+_yp_cache_maps )); then - _yp_cache_maps=( "${(@)${(@f)$(_call_program maps ypwhich -m)}%% *}" ) - _yp_cache_nicks=( "${(@)${(@)${(@f)$(_call_program names ypwhich -x)}#*\"}%%\"*}" ) - _yp_args=( - '(-x)-d[specify domain]:domain name' \ - '(-x)-k[display keys]' \ - '(-x)-t[inhibit nicknames]' \ - '(: -d -k -t)-x[display nicknames]' \ - ) +if (( ! $+_cache_yp_maps )); then + typeset -ga _cache_yp_maps _cache_yp_nicks + _cache_yp_maps=( "${(@)${(@f)$(_call_program maps ypwhich -m)}%% *}" ) + _cache_yp_nicks=( "${(@)${(@)${(@f)$(_call_program names ypwhich -x)}#*\"}%%\"*}" ) fi +args=( + '(-x)-d[specify domain]:domain name' \ + '(-x)-k[display keys]' \ + '(-x)-t[inhibit nicknames]' \ + '(: -d -k -t)-x[display nicknames]' \ +) + case "$service" in ypcat) - _arguments -C -s "$_yp_args[@]" ':map name:->map' && ret=0 + _arguments -C -s $args ':map name:->map' && ret=0 ;; ypmatch) - _arguments -C -s "$_yp_args[@]" '::key map:->keymap' ':map name:->map' && + _arguments -C -s $args '::key map:->keymap' ':map name:->map' && ret=0 ;; yppasswd) @@ -96,9 +98,9 @@ if [[ "$state" = map* ]]; then # The `-M ...' allows `pa.n<TAB>' to complete to `passwd.byname'. _requested maps expl 'map name' \ compadd -M 'l:.|by=by l:.|=by r:|.=* r:|=*' -a \ - _yp_cache_maps && ret=0 + _cache_yp_maps && ret=0 _requested nicknames expl nicknames \ - compadd -a _yp_cache_nicks && ret=0 + compadd -a _cache_yp_nicks && ret=0 (( ret )) || return 0 done elif [[ "$state" = servers ]]; then diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs index 553996da0..ce5df5877 100644 --- a/Completion/Unix/Command/_zfs +++ b/Completion/Unix/Command/_zfs @@ -6,7 +6,7 @@ _zfs() { typeset -A opt_args local -a subcmds rw_properties rw_propnames ro_properties create_properties local -a share_nfs_ro_properties share_nfs_rw_properties - local -a share_smb_ro_properties share_nfs_rw_properties + local -a share_smb_ro_properties share_smb_rw_properties local -a share_ro_properties share_rw_properties local -a difffields delegatable_perms diff --git a/Completion/Unix/Type/_bpf_filters b/Completion/Unix/Type/_bpf_filters index c62481e09..54e2172c9 100644 --- a/Completion/Unix/Type/_bpf_filters +++ b/Completion/Unix/Type/_bpf_filters @@ -1,3 +1,5 @@ +#autoload + # spaces are valid instead of word ends, perhaps better to just do compset -q local -a networks fields dirs protos relop diff --git a/Completion/Unix/Type/_directories b/Completion/Unix/Type/_directories index 2125645fe..456af3b6c 100644 --- a/Completion/Unix/Type/_directories +++ b/Completion/Unix/Type/_directories @@ -1,4 +1,4 @@ -#compdef rmdir zf_rmdir dircmp -P -value-,*path,-default- +#compdef rmdir grmdir zf_rmdir dircmp -P -value-,*path,-default- local expl diff --git a/Completion/Unix/Type/_dns_types b/Completion/Unix/Type/_dns_types new file mode 100644 index 000000000..b6bc2e680 --- /dev/null +++ b/Completion/Unix/Type/_dns_types @@ -0,0 +1,8 @@ +#autoload + +local expl +_description dns-types expl 'DNS type' +compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z}' \ + ANY A AAAA AFSDB APL AXFR CAA CDNSKEY CDS CERT CNAME DHCID DLV DNAME \ + DNSKEY DS HIP HINFO IPSECKEY IXFR KEY KX LOC MX NAPTR NS NSEC NSEC3 \ + NSEC3PARAM OPT PTR RRSIG RP SIG SOA SPF SRV SSHFP TA TKEY TLSA TSIG TXT diff --git a/Completion/Unix/Type/_file_modes b/Completion/Unix/Type/_file_modes new file mode 100644 index 000000000..fbe4c9363 --- /dev/null +++ b/Completion/Unix/Type/_file_modes @@ -0,0 +1,37 @@ +#autoload + +# Provides completion for file modes (formerly part of _chmod) + +local curcontext=$curcontext +local -a context line state state_descr copts=( "${@}" ) privs +local -A val_args + +privs=( + 'r[read]' 'w[write]' 'x[execute]' + 's[set uid/gid]' 't[sticky]' + 'X[execute only if directory or executable to another]' + "u[owner's current permissions]" + "g[group's current permissions]" + "o[others' current permissions]" +) + +[[ $OSTYPE == solaris* ]] && +privs+=( 'l[mandatory locking]' ) + +compset -P '*,' +compset -S ',*' + +if [[ -prefix [0-7] ]]; then + _message -e number 'numeric mode' +elif compset -P '[a-z]#[+-=]'; then + _values -O copts -S '' privilege $privs && return 0 +else + compset -P '*' + copts=( -S '' ) + _alternative -O copts \ + 'who:who:((a\:all u\:owner g\:group o\:others))' \ + 'operators:operator:(+ - =)' \ + && return 0 +fi + +return 1 diff --git a/Completion/Unix/Type/_object_files b/Completion/Unix/Type/_object_files index 31a13aefc..595265116 100644 --- a/Completion/Unix/Type/_object_files +++ b/Completion/Unix/Type/_object_files @@ -5,7 +5,8 @@ local expl _description files expl 'object file' __object_file() { - [[ -x $REPLY || $REPLY = *.([ao]|so|elf)(.<->)## || $REPLY = (core*|*.core) ]] + [[ -x $REPLY || $REPLY = *.(a|o|elf|dylib) || $REPLY = *.so(.<->)# || + $REPLY = (core*|*.core) ]] } _files -g '*(-.e,__object_file,)' diff --git a/Completion/Unix/Type/_ssh_hosts b/Completion/Unix/Type/_ssh_hosts new file mode 100644 index 000000000..e20142cfd --- /dev/null +++ b/Completion/Unix/Type/_ssh_hosts @@ -0,0 +1,41 @@ +#autoload + +local -a config_hosts +local config +integer ind + +# If users-hosts matches, we shouldn't complete anything else. +if [[ "$IPREFIX" == *@ ]]; then + _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" && return +else + _combination -s '[:@]' my-accounts users-hosts \ + ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" && return +fi +if (( ind = ${words[(I)-F]} )); then + config=${~words[ind+1]} 2>/dev/null +else + config="$HOME/.ssh/config" +fi +if [[ -r $config ]]; then + local key line host + local -a lines=("${(@f)$(<"$config")}") 2>/dev/null + while (($#lines)); do + IFS=$'=\t ' read -r key line <<<"${lines[1]}" + case "$key" in + ((#i)include) + lines[1]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;; + ((#i)host(|name)) + for host in ${(z)line}; do + case $host in + (*[*?]*) ;; + (*) config_hosts+=("$host") ;; + esac + done ;& + (*) shift lines;; + esac + done + if (( ${#config_hosts} )); then + _wanted hosts expl 'remote host name' \ + compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts + fi +fi diff --git a/Completion/Unix/Type/_tilde_files b/Completion/Unix/Type/_tilde_files index b1b3b37f0..0ee12332b 100644 --- a/Completion/Unix/Type/_tilde_files +++ b/Completion/Unix/Type/_tilde_files @@ -29,7 +29,7 @@ case "$PREFIX" in _files "$@" -W "$user" ;; \~*) - compset -P '?' + compset -p 1 local -a expl=( "$@" ) _alternative -O expl users:user:_users named-directories:'named directory':'compadd -k nameddirs' ;; |