diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2016-01-24 17:19:53 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2016-01-24 17:19:53 +0100 |
commit | 86ca06fb4b5a835caac37700952207db4c5073cd (patch) | |
tree | c2686e6d126d59052310c6bb7cd8df6d76fa0fca /Completion/Unix/Command | |
parent | 370659ae9ae918a07a7950bbc2827b2593126f7d (diff) | |
parent | d18ce35d060163ea0d531170b65e1c38311af166 (diff) | |
download | zsh-86ca06fb4b5a835caac37700952207db4c5073cd.tar.gz zsh-86ca06fb4b5a835caac37700952207db4c5073cd.zip |
Merge branch 'upstream' at 5.2-dev-1 into debian
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r-- | Completion/Unix/Command/_bibtex | 5 | ||||
-rw-r--r-- | Completion/Unix/Command/_dig | 85 | ||||
-rw-r--r-- | Completion/Unix/Command/_elfdump | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | Completion/Unix/Command/_getent | 0 | ||||
-rw-r--r-- | Completion/Unix/Command/_git | 23 | ||||
-rw-r--r-- | Completion/Unix/Command/_man | 21 | ||||
-rw-r--r--[-rwxr-xr-x] | Completion/Unix/Command/_mtools | 0 | ||||
-rw-r--r-- | Completion/Unix/Command/_nm | 6 | ||||
-rw-r--r-- | Completion/Unix/Command/_objdump | 7 | ||||
-rw-r--r-- | Completion/Unix/Command/_readelf | 6 |
10 files changed, 120 insertions, 39 deletions
diff --git a/Completion/Unix/Command/_bibtex b/Completion/Unix/Command/_bibtex new file mode 100644 index 000000000..8db38a244 --- /dev/null +++ b/Completion/Unix/Command/_bibtex @@ -0,0 +1,5 @@ +#compdef bibtex + +# bibtex only works when the *.aux file exists, but complete the *.tex file in +# case it hasn't been compiled yet. +_files -g '*.(aux|tex)(:r)' diff --git a/Completion/Unix/Command/_dig b/Completion/Unix/Command/_dig new file mode 100644 index 000000000..2b851c91f --- /dev/null +++ b/Completion/Unix/Command/_dig @@ -0,0 +1,85 @@ +#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=( + '*+'{no,}'tcp[use TCP instead of UDP for queries]' + '*+'{no,}'ignore[ignore truncation in UDP responses]' + '*+domain=[set search list to single domain]:domain:_hosts' + '*+'{no,}'search[use search list defined in resolv.conf]' + '*+'{no,}'showsearch[show intermediate results in domain search]' + '*+'{no,}'aaonly[set aa flag in the query]' + '*+'{no,}'adflag[set the AD (authentic data) bit in the query]' + '*+'{no,}'cdflag[set the CD (checking disabled) bit in the query]' + '*+'{no,}'cl[display the CLASS whening printing the record]' + '*+'{no,}'ttlid[display the TTL whening printing the record]' + '*+'{no,}'recurse[set the RD (recursion desired) bit in the query]' + '*+'{no,}'nssearch[search all authoritative nameservers]' + '*+'{no,}'trace[trace delegation down from root]' + '*+'{no,}'cmd[print initial comment in output]' + '*+'{no,}'short[print terse output]' + '*+'{no,}'identify[print IP and port of responder]' + '*+'{no,}'comments[print comment lines in output]' + '*+'{no,}'stats[print statistics]' + '*+'{no,}'qr[print query as it was sent]' + '*+'{no,}'question[print question section of a query]' + '*+'{no,}'answer[print answer section of a reply]' + '*+'{no,}'authority[print authority section of a reply]' + '*+'{no,}'additional[print additional section of a reply]' + '*+'{no,}'all[set all print/display flags]' + '*+time=[set query timeout]:timeout (seconds)' + '*+tries=[specify number of UDP query attempts]:tries' + '*+retry=[specify number of UDP query retries]:retries' + '*+ndots=[specify number of dots to be considered absolute]:dots' + '*+bufsize=[specify UDP buffer size]:size (bytes)' + '*+edns=[specify EDNS version for query]:version (0-255)' + '*+noedns[clean EDNS version]' + '*+'{no,}'multiline[verbose multi-line output]' + '*+'{no,}'onesoa[AXFR prints only one soa record]' + '*+'{no,}"fail[don't try next server on SERVFAIL]" + '*+'{no,}'besteffort[try to parse even malformed messages]' + '*+'{no,}'dnssec[request DNSSEC records]' + '*+'{no,}'sigchase[chase DNSSEC signature chains]' + '*+trusted-key=[specify file conrtaing trusted kets]:file:_files' + '*+'{no,}'topdown[do DNSSEC validation in top down mode]' + '*+'{no,}'nsid[include EDNS name server ID request in query]' +) +_arguments -s -C $args \ + '(- *)-h[display help information]' \ + '(- *)-v[display version information]' \ + '*-c+[specify class]:class:compadd -M "m:{a-z}={A-Z}" - IN CS CH HS' \ + '*-b+[specify source IP]:IP' \ + '*-f+[batch mode, read arguments from file]:file:_files' \ + '*-m[enable memory usage debugging]' \ + '*-p+[specify port number]:port:_ports' \ + '*-4[use IPv4 only]' \ + '*-6[use IPv6 only]' \ + '*-t+[specify type]:type:_dns_types' \ + '*-q+[specify host name to query]:host:_hosts' \ + '*-x+[reverse lookup]:IP address' \ + '*-k+[specify TSIG key file]:file:_files' \ + '*-y+[specify TSIG key]:hmac\:name\:key' \ + '*: :->args' && ret=0 + +if [[ -n $state ]]; then + if compset -P @; then + _wanted hosts expl 'DNS server' _hosts && ret=0; + else + case $#line in + <3->) alts+=( 'classes:query class:compadd -M "m:{a-z}={A-Z}" - IN CS CH HS' ) ;& + 2) alts+=( 'types:query type:_dns_types' ) ;; + esac + _alternative 'hosts:host:_hosts' $alts && ret=0 + fi +fi + +return ret diff --git a/Completion/Unix/Command/_elfdump b/Completion/Unix/Command/_elfdump index ee92402d2..065f4b97f 100644 --- a/Completion/Unix/Command/_elfdump +++ b/Completion/Unix/Command/_elfdump @@ -2,10 +2,6 @@ local -a args -_elf_file() { - [[ -x $REPLY || $REPLY = (core*|*.([ao]|so|elf)) ]] -} - args=( '-c[dump section header information]' '-d[dump .dynamic section]' @@ -38,7 +34,7 @@ case $OSTYPE in '-l[show long section names without truncation]' '-O[specify osabi to apply]:osabi' '-P[use alternative section header]' - "*:elf file:_files -g '*(-.e:_elf_file:)'" + "*:elf file:_object_files" ) ;; freebsd*) args+=( '-a[dump all information]' ) ;; diff --git a/Completion/Unix/Command/_getent b/Completion/Unix/Command/_getent index b9aff6642..b9aff6642 100755..100644 --- a/Completion/Unix/Command/_getent +++ b/Completion/Unix/Command/_getent diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 6e8e9c665..5f137d009 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1941,7 +1941,7 @@ _git-config () { 'branch.*.pushremote:what remote git push should push to::__git_remotes' 'branch.*.rebase:rebase on top of fetched branch::->bool:false' 'browser.*.cmd:browser command to use:browser:_cmdstring' - 'browser.*.path:path to use for the browser:absolute browser path:_files -g "*(*)"' + 'browser.*.path:path to use for the browser:absolute browser path:_absolute_command_paths' clean.requireForce:'require --force for git clean to actually do something::->bool:true' color.branch:'color output of git branch::->color-bool:false' color.branch.current:'color of the current branch::->color' @@ -2013,7 +2013,7 @@ _git-config () { diff.suppressBlankEmpty:'inhibit printing space before empty output lines::->bool:false' diff.tool:'diff tool to use::__git_difftools' 'difftool.*.cmd:command to invoke for the diff tool::_cmdstring' - 'difftool.*.path:path to use for the diff tool:absolute diff tool path:_files -g "*(*)"' + 'difftool.*.path:path to use for the diff tool:absolute diff tool path:_absolute_command_paths' difftool.prompt:'prompt before each invocation of the diff tool::->bool:true' diff.wordRegex:'regex used to determine what a word is when performing word-by-word diff:regular expression:->string' diff.guitool:'diff tool with gui to use::__git_difftools' @@ -2180,7 +2180,7 @@ _git-config () { mailmap.file:'augmenting mailmap file:mailmap file:_files' man.viewer:'man viewer to use for help in man format::__git_man_viewers' 'man.*.cmd:the command to invoke the specified man viewer:man command:_cmdstring' - 'man.*.path:path to use for the man viewer:absolute man tool path:_files -g "*(*)"' + 'man.*.path:path to use for the man viewer:absolute man tool path:_absolute_command_paths' merge.branchdesc:'populate the log message with the branch description text as well::->bool:false' merge.conflictstyle:'style used for conflicted hunks::->merge.conflictstyle:merge' merge.defaultToUpstream:'merge the upstream branches configured for the current branch by default::->bool:true' @@ -2194,7 +2194,7 @@ _git-config () { 'merge.*.name:human-readable name for custom low-level merge driver:name:->string' 'merge.*.driver:command that implements a custom low-level merge driver:merge command:_cmdstring' 'merge.*.recursive:low-level merge driver to use when performing internal merge between common ancestors::__git_builtin_merge_drivers' - 'mergetool.*.path:path to use for the merge tool:absolute merge tool path:_files -g "*(*)"' + 'mergetool.*.path:path to use for the merge tool:absolute merge tool path:_absolute_command_paths' 'mergetool.*.cmd:command to invoke for the merge tool:merge command:_cmdstring' 'mergetool.*.trustExitCode:trust the exit code of the merge tool::->bool:false' mergetool.keepBackup:'keep the original file with conflict markers::->bool:true' @@ -3710,7 +3710,7 @@ _git-send-email () { '--smtp-encryption=[specify encryption method to use]: :__git_sendemail_smtpencryption_values' \ '--smtp-domain=[specify FQDN used in HELO/EHLO]: :_domains' \ '--smtp-pass=[specify password to use for SMTP-AUTH]::password' \ - '--smtp-server=[specify SMTP server to connect to]:smtp server:_hosts' \ + '--smtp-server=[specify SMTP server to connect to, or sendmail command]: : __git_sendmail_smtpserver_values' \ '--smtp-server-port=[specify port to connect to SMTP server on]:smtp port:_ports' \ '--smtp-server-option=[specify the outgoing SMTP server option to use]:SMPT server option' \ '--smtp-ssl-cert-path=[path to ca-certificates (directory or file)]:ca certificates path:_files' \ @@ -5623,8 +5623,8 @@ __git_commits () { (( $+functions[__git_heads] )) || __git_heads () { - __git_heads_local - __git_heads_remote + __git_heads_local "$@" + __git_heads_remote "$@" } (( $+functions[__git_heads_local] )) || @@ -5815,7 +5815,7 @@ __git_commit_ranges () { if [[ ${PREFIX} = (#b)((\\|)\^)* ]]; then compset -p ${#match[1]} else - suf=( -S .. -r '.@~ ^:\t\n\-' ) + suf=( -S .. -r '@~ \^:\t\n\-' ) fi fi expl=( $* $suf ) @@ -6119,7 +6119,7 @@ __git_tree_files () { shift (( at_least_one_tree_added = 0 )) for tree in $*; do - tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree $extra_args --name-only -z $tree $Path 2>/dev/null)"}) + tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree -r $extra_args --name-only -z $tree 2>/dev/null)"}) __git_command_successful $pipestatus && (( at_least_one_tree_added = 1 )) done @@ -6859,6 +6859,11 @@ __git_sendemail_suppresscc_values () { all:'avoid all auto Cc values' } +(( $+functions[__git_sendmail_smtpserver_values] )) || +__git_sendmail_smtpserver_values() { + _alternative "smtp hosts:host:_hosts" "sendmail command: :_absolute_command_paths" +} + (( $+functions[__git_colors] )) || __git_colors () { declare -a expl diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man index 81ac40bc2..0534db753 100644 --- a/Completion/Unix/Command/_man +++ b/Completion/Unix/Command/_man @@ -37,7 +37,10 @@ _man() { mrd=(${^_manpath/\%L/${LANG:-En_US.ASCII}}/mandb(N)) - local sect + # $sect is from the command line, the "3p" in "man 3p memcpy" + # $sect_dirname is from the filesystem, the "3" in "/usr/share/man/man3" + # These are used by _man_pages + local sect sect_dirname if [[ $OSTYPE = solaris* ]]; then sect=${${words[(R)-s*]#-s}:-$words[$words[(i)-s]+1]} elif [[ -n ${sect:=$words[$words[(i)-S]+1]} || -n ${sect:=$MANSECT} ]]; then @@ -49,7 +52,7 @@ _man() { fi if [[ $sect = (<->*|1M|l|n) || $sect = \(*\|*\) ]]; then - dirs=( $^_manpath/(sman|man|cat)${~sect}/ ) + dirs=( $^_manpath/(sman|man|cat)${~sect%%[^0-9]#}/ ) awk="\$2 == \"$sect\" {print \$1}" else dirs=( $^_manpath/(sman|man|cat)*/ ) @@ -69,8 +72,8 @@ _man() { _tags manuals.${^sects} while _tags; do - for sect in $sects; do - _requested manuals.$sect expl "manual page, section $sect" _man_pages && + for sect_dirname in $sects; do + _requested manuals.$sect_dirname expl "manual page, section $sect_dirname" _man_pages && ret=0 done (( ret )) || return 0 @@ -78,7 +81,7 @@ _man() { return 1 else - sect= + sect_dirname= _wanted manuals expl 'manual page' _man_pages fi } @@ -107,8 +110,8 @@ _man_pages() { matcher= fi - pages=( ${(M)dirs:#*$sect/} ) - compfiles -p pages '' '' "$matcher" '' dummy '*' + pages=( ${(M)dirs:#*$sect_dirname/} ) + compfiles -p pages '' '' "$matcher" '' dummy "*${(b)sect}*" pages=( ${^~pages}(N:t) ) (($#mrd)) && pages[$#pages+1]=($(awk $awk $mrd)) @@ -119,11 +122,11 @@ _man_pages() { [[ $OSTYPE = solaris* ]] && sopt='-s ' if ((CURRENT > 2)) || - ! zstyle -t ":completion:${curcontext}:manuals.$sect" insert-sections + ! zstyle -t ":completion:${curcontext}:manuals.$sect_dirname" insert-sections then compadd "$@" - ${pages%$~suf} else - compadd "$@" -P "$sopt$sect " - ${pages%$~suf} + compadd "$@" -P "$sopt$sect_dirname " - ${pages%$~suf} fi } diff --git a/Completion/Unix/Command/_mtools b/Completion/Unix/Command/_mtools index 63851b86f..63851b86f 100755..100644 --- a/Completion/Unix/Command/_mtools +++ b/Completion/Unix/Command/_mtools diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm index d171ef5a3..73d7508b4 100644 --- a/Completion/Unix/Command/_nm +++ b/Completion/Unix/Command/_nm @@ -2,11 +2,7 @@ local args files variant -_nm_object_file() { - [[ -x $REPLY || $REPLY = *.([ao]|so|elf) ]] -} - -files="*:object file:_files -g '*(-.e,_nm_object_file,)'" +files="*:object file:_object_files" args=( '(-A -o --print-file-name)'{-A,-o,--print-file-name}'[print name of input file on each line]' '(--demangle)-C[decode symbol names]' diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump index 607719a19..cc213d911 100644 --- a/Completion/Unix/Command/_objdump +++ b/Completion/Unix/Command/_objdump @@ -1,8 +1,3 @@ #compdef objdump -# borrowed from _nm_object_file -_objdump_object_file() { - [[ -x $REPLY || $REPLY = *.([ao]|so|elf) ]] -} - -_arguments -- '*:object file:_files -g "*(-.e,_objdump_object_file,)"' +_arguments -- '*:object file:_object_files' diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf index 9312ea864..a474a8dc4 100644 --- a/Completion/Unix/Command/_readelf +++ b/Completion/Unix/Command/_readelf @@ -2,10 +2,6 @@ local variant args sections -_elf_file() { - [[ -x $REPLY || $REPLY = (core*|*.([ao]|so|elf)) ]] -} - sections=( .bss .data .dynamic .dynsym .got .interp .shstrtab .symtab .text ) _pick_variant -r variant elftoolchain=elftoolchain elfutils=elfutils binutils --version @@ -29,7 +25,7 @@ args=( '(-W --wide)'{-W,--wide}'[allow output width to exceed 80 characters]' '(- *)'{-H,--help}'[display help information]' '(- *)'{-v,--version}'[display version information]' - "*:elf file:_files -g '*(-.e:_elf_file:)'" + "*:elf file:_object_files" ) case $variant in |