diff options
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r-- | Completion/Unix/Command/_ant | 3 | ||||
-rw-r--r-- | Completion/Unix/Command/_baz | 4 | ||||
-rw-r--r-- | Completion/Unix/Command/_cp | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_git | 102 | ||||
-rw-r--r-- | Completion/Unix/Command/_ip | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_locate | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_make | 6 | ||||
-rw-r--r-- | Completion/Unix/Command/_pgrep | 12 | ||||
-rw-r--r-- | Completion/Unix/Command/_php | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_ps | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_python | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_subversion | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_tar | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_tla | 4 | ||||
-rw-r--r-- | Completion/Unix/Command/_vim | 2 |
15 files changed, 95 insertions, 54 deletions
diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant index 8e4bd82af..ee9f7d910 100644 --- a/Completion/Unix/Command/_ant +++ b/Completion/Unix/Command/_ant @@ -123,8 +123,7 @@ case $state in # Output target again indicating its the default one. print -n "'${default_target}:(Default target) ' " ;; - (Searching:*|Main:targets:|Subtargets:|BUILD:SUCCESSFUL|Total:time: - *) + (Searching:*|Main:targets:|Subtargets:|BUILD:SUCCESSFUL|Total:time:*) ;; (*) # Return target and description diff --git a/Completion/Unix/Command/_baz b/Completion/Unix/Command/_baz index 132c6e31d..6787f41e2 100644 --- a/Completion/Unix/Command/_baz +++ b/Completion/Unix/Command/_baz @@ -6,13 +6,13 @@ local baz_version local hide_short # ask the user which version of baz this is -if ! zstyle -s ":completion:${curcontext}" baz-version baz_version; then +if ! zstyle -s ":completion:${curcontext}:" baz-version baz_version; then # ask baz instead baz_version="${${$($BAZ --version)#baz Bazaar version }%% \(thelove@canonical.com*}" fi # test whether to hide short options from completion -if zstyle -s ":completion:${curcontext}" hide-shortopts hide_short; then +if zstyle -s ":completion:${curcontext}:" hide-shortopts hide_short; then case $hide_short in true|yes|on|1) hide_short='!' ;; *) hide_short='' ;; diff --git a/Completion/Unix/Command/_cp b/Completion/Unix/Command/_cp index 4c4dea2e9..7087b4e6c 100644 --- a/Completion/Unix/Command/_cp +++ b/Completion/Unix/Command/_cp @@ -13,7 +13,7 @@ if _pick_variant gnu=GNU unix --version; then '-H[follow command-line symbolic links]' \ '(-l --link)'{-l,--link}'[link files instead of copying]' \ '(-L --dereference)'{-L,--dereference}'[always follow symbolic links]' \ - (-n --no-clobber -i --interactive){-n,--no-clobber}"[don't overwrite an existing file]" \ + '(-n --no-clobber -i --interactive)'{-n,--no-clobber}"[don't overwrite an existing file]" \ '(-P --no-dereference)'{-P,--no-dereference}'[never follow symbolic links]' \ '-p[same as --preserve=mode,ownership,timestamps]' \ '--preserve=-[preserve specified attributes]:: :_values -s , attribute mode timestamps ownership links context xattr all' \ diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 979e3e76f..4403a48a8 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -714,12 +714,14 @@ _git-diff () { local curcontext=$curcontext state line ret=1 declare -A opt_args - local -a diff_options + local -a diff_options diff_stage_options __git_setup_diff_options + __git_setup_diff_stage_options _arguments -w -C -s \ $* \ $diff_options \ + $diff_stage_options \ '(--cached --staged)'{--cached,--staged}'[show diff between index and named commit]' \ '(-)--[start file arguments]' \ '*:: :->from-to-file' && ret=0 @@ -1081,12 +1083,10 @@ _git-log () { local -a log_options revision_options diff_options __git_setup_log_options __git_setup_revision_options - __git_setup_diff_options _arguments -w -C -s \ $log_options \ $revision_options \ - $diff_options \ '-L+[trace the evolution of a line range or regex within a file]:range' \ '(-)--[start file arguments]' \ '*:: :->commit-range-or-file' && ret=0 @@ -1484,10 +1484,9 @@ _git-show () { local curcontext=$curcontext state line ret=1 typeset -A opt_args - local -a log_options revision_options diff_options + local -a log_options revision_options __git_setup_log_options __git_setup_revision_options - __git_setup_diff_options _arguments -w -C -s \ $log_options \ @@ -1794,7 +1793,7 @@ _tig () { (( $+functions[_git-config] )) || _git-config () { local name_arg value_arg - local curcontext=$curcontext state line ret=1 + local curcontext=$curcontext state line expl ret=1 declare -A opt_args if (( words[(I)--get-regexp] )); then @@ -2554,7 +2553,7 @@ _git-config () { options -M 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' && ret=0 ;; (gettable-option) - _describe -t git-options option \ + _wanted git-options expl option compadd -M 'r:|.=* r:|=*' - \ ${${${(0)"$(_call_program gettable-options git config -z --list)"}%%$'\n'*}//:/\\:} && ret=0 ;; (gettable-colorbool-option) @@ -2948,7 +2947,8 @@ _git-fast-export () { '--progress=[insert progress statements]: :__git_guard_number interval' \ '--signed-tags=[specify how to handle signed tags]:action:((verbatim\:"silently export" warn\:"export, but warn" - strip\:"export unsigned tags instead" + warn-strip\:"export as unsigned tags, but warn" + strip\:"export as unsigned tags instead" abort\:"abort on signed tags (default)"))' \ '--tag-of-filtered-object=[specify how to handle tags whose tagged object is filtered out]:action:((abort\:"abort on such tags" drop\:"omit such tags" @@ -3733,7 +3733,9 @@ _git-send-email () { '( --no-validate)--validate[perform sanity checks on patches]' \ '(--validate )--no-validate[do not perform sanity checks on patches]' \ '--force[send emails even if safety checks would prevent it]' \ - '*: :_files' + '*: : _alternative -O expl + "files:file:_files" + "commits:recent commit object name:__git_commit_objects_prefer_recent"' } (( $+functions[_git-svn] )) || @@ -4341,11 +4343,13 @@ _git-cat-file () { (( $+functions[_git-diff-files] )) || _git-diff-files () { - declare -a revision_options + local -a revision_options diff_stage_options __git_setup_revision_options + __git_setup_diff_stage_options _arguments -w -S -s \ $revision_options \ + $diff_stage_options \ ': :__git_changed-in-working-tree_files' \ ': :__git_changed-in-working-tree_files' \ '*: :__git_changed-in-working-tree_files' @@ -5532,7 +5536,7 @@ __git_stashes () { local expl declare -a stashes - stashes=(${${(f)"$(_call_program stashes git stash list 2>/dev/null)"}/: */}) + stashes=(${(f)"$(_call_program stashes git stash list --pretty=format:%gd 2>/dev/null)"}) __git_command_successful $pipestatus || return 1 _wanted stashes expl stash compadd "$@" -a - stashes @@ -5585,7 +5589,7 @@ __git_remote_branch_names () { branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/}) __git_command_successful $pipestatus || return 1 - _wanted remote-branch-names expl 'remote branch name' compadd "$@" -a - branch_names + _wanted remote-branch-names expl 'remote branch name' compadd -M 'r:|/=**' "$@" -a - branch_names } (( $+functions[__git_remote_branch_names_noprefix] )) || @@ -5596,7 +5600,12 @@ __git_remote_branch_names_noprefix () { branch_names=(${${${(f)"$(_call_program remote-branch-refs-noprefix git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}##*/}:#HEAD}) __git_command_successful $pipestatus || return 1 - _wanted remote-branch-names-noprefix expl 'remote branch name' compadd "$@" -a - branch_names + _wanted remote-branch-names-noprefix expl 'remote branch name' compadd -M 'r:|/=**' "$@" -a - branch_names +} + +(( $+functions[__git_commit_objects_prefer_recent] )) || +__git_commit_objects_prefer_recent () { + __git_recent_commits || __git_commit_objects } (( $+functions[__git_commits] )) || @@ -5609,15 +5618,21 @@ __git_commits () { _alternative \ "heads::__git_heads $sopts" \ "commit-tags::__git_commit_tags $sopts" \ - 'commit-objects::__git_commit_objects' + 'commit-objects::__git_commit_objects_prefer_recent' } (( $+functions[__git_heads] )) || __git_heads () { + __git_heads_local + __git_heads_remote +} + +(( $+functions[__git_heads_local] )) || +__git_heads_local () { local gitdir expl start declare -a heads - heads=(${${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname)"' refs/heads refs/remotes 2>/dev/null)"}#refs/(heads|remotes)/}) + heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)" refs/heads' 2>/dev/null)"}) gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) if __git_command_successful $pipestatus; then for f in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do @@ -5626,7 +5641,17 @@ __git_heads () { [[ -f $gitdir/refs/stash ]] && heads+=stash fi - _wanted heads expl head compadd "$@" -a - heads + _wanted heads-local expl "local head" compadd -M 'r:|/=**' "$@" -a - heads +} + +(( $+functions[__git_heads_remote] )) || +__git_heads_remote () { + local gitdir expl start + declare -a heads + + heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)" refs/remotes' 2>/dev/null)"}) + + _wanted heads-remote expl "remote head" compadd -M 'r:|/=**' "$@" -a - heads } (( $+functions[__git_commit_objects] )) || @@ -5634,29 +5659,47 @@ __git_commit_objects () { local gitdir expl start declare -a commits + # Abort if the argument does not match a commit hash (including empty). + [[ "$PREFIX$SUFFIX" == [[:xdigit:]](#c1,40) ]] || return 1 + # Note: the after-the-colon part must be unique across the entire array; # see workers/34768 - : ${(A)commits::=${(f)"$(_call_program commits git --no-pager log -20 --format='%h:\\\[%h\\\]\ %s')"}} + commits=(${(f)"$(_call_program commits git --no-pager log -1000 --all --reflog --format='%h:\[%h\]\ %s\ \(%cr\)')"}) __git_command_successful $pipestatus || return 1 - _describe -V -t commits 'commit object name' commits || _guard '[[:xdigit:]](#c,40)' 'commit object name' + _describe -V -t commits 'commit object name' commits } (( $+functions[__git_recent_commits] )) || __git_recent_commits () { local gitdir expl start declare -a descr tags heads commits - local i j k + local i j k ret + integer distance_from_head # Careful: most %d will expand to the empty string. Quote properly! - : "${(A)commits::=${(@f)"$(_call_program commits git --no-pager log -20 --format='%h%n%d%n%s')"}}" + # NOTE: we could use %D directly, but it's not available in git 1.9.1 at least. + commits=("${(f)"$(_call_program commits git --no-pager log -20 --format='%h%n%d%n%s\ \(%cr\)')"}") __git_command_successful $pipestatus || return 1 for i j k in "$commits[@]" ; do # Note: the after-the-colon part must be unique across the entire array; # see workers/34768 - descr+=("$i:[$i] $k") + if (( distance_from_head == 0 )); then + descr+=($i:"[HEAD] $k") + elif (( distance_from_head == 1 )); then + descr+=($i:"[HEAD^] $k") + elif (( distance_from_head == 2 )); then + descr+=($i:"[HEAD^^] $k") + elif (( distance_from_head < 10 )); then + descr+=($i:"[HEAD~$distance_from_head] $k") + else + descr+=($i:"[HEAD~$distance_from_head] $k") + fi + (( ++distance_from_head )) + j=${${j# \(}%\)} # strip leading ' (' and trailing ')' + j=${j/ ->/,} # Convert " -> master, origin/master". for j in ${(s:, :)j}; do if [[ $j == 'tag: '* ]] ; then tags+=( ${j#tag: } ) @@ -5673,7 +5716,8 @@ __git_recent_commits () { expl=() _wanted heads expl 'head' compadd "$@" -a - heads && ret=0 expl=() - _describe -2Vx -t commits 'commit object name' descr && ret=0 + _describe -Vx -t commits 'recent commit object name' descr && ret=0 + return $ret } (( $+functions[__git_blob_objects] )) || @@ -6214,14 +6258,20 @@ __git_setup_diff_options () { '(--no-prefix)--dst-prefix=[use given prefix for destination]:prefix' '(--src-prefix --dst-prefix)--no-prefix[do not show any source or destination prefix]' + '(-c,--cc)'{-c,--cc}'[combined diff format for merge commits]' + + # TODO: --output is undocumented. + '--output[undocumented]:undocumented') +} + +(( $+functions[__git_setup_diff_stage_options] )) || +__git_setup_diff_stage_options () { + diff_stage_options=( '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-1,--base}'[diff against "base" version]' '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-2,--ours}'[diff against "our branch" version]' '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-3,--theirs}'[diff against "their branch" version]' '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)-0[omit diff output for unmerged entries]' - '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-c,--cc}'[compare "our branch", "their branch" and working tree files]' - - # TODO: --output is undocumented. - '--output[undocumented]:undocumented') + ) } (( $+functions[__git_setup_revision_options] )) || diff --git a/Completion/Unix/Command/_ip b/Completion/Unix/Command/_ip index bfa7d995b..1e3949148 100644 --- a/Completion/Unix/Command/_ip +++ b/Completion/Unix/Command/_ip @@ -531,6 +531,8 @@ args=( ) _regex_words options "ip options" \ + '-h*uman:output statistics with human readable values' \ + '-i*ec:print human readable rates in IEC units (ie. 1K = 1024)' \ '-s*tatistics:output statistics' \ '-f*amily:select protocol family:$subcmd_family' \ '-4:IPv4' \ diff --git a/Completion/Unix/Command/_locate b/Completion/Unix/Command/_locate index 0b35b7cdd..694f506c3 100644 --- a/Completion/Unix/Command/_locate +++ b/Completion/Unix/Command/_locate @@ -25,7 +25,7 @@ case $basename in ltype=gnu ;; - (*illegal option*) + (*"illegal option"*) if [[ $OSTYPE == (freebsd|openbsd|dragonfly|darwin)* ]]; then ltype=bsd else diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make index 225c0af85..c14a34c58 100644 --- a/Completion/Unix/Command/_make +++ b/Completion/Unix/Command/_make @@ -65,7 +65,7 @@ _make-parseMakefile () { do case "$input " in # VARIABLE = value OR VARIABLE ?= value - ([[:alnum:]][[:alnum:]_]#[ $TAB]#(\?|)=*) + ([[:alnum:]][[:alnum:]_]#[" "$TAB]#(\?|)=*) var=${input%%[ $TAB]#(\?|)=*} val=${input#*=} val=${val##[ $TAB]#} @@ -74,7 +74,7 @@ _make-parseMakefile () { # VARIABLE := value OR VARIABLE ::= value # Evaluated immediately - ([[:alnum:]][[:alnum:]_]#[ $TAB]#:(:|)=*) + ([[:alnum:]][[:alnum:]_]#[" "$TAB]#:(:|)=*) var=${input%%[ $TAB]#:(:|)=*} val=${input#*=} val=${val##[ $TAB]#} @@ -97,7 +97,7 @@ _make-parseMakefile () { ;; # Include another makefile - (${~incl} *) + (${~incl}" "*) local f=${input##${~incl} ##} if [[ $incl == '.include' ]] then diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep index 3af55a379..d3dcd1812 100644 --- a/Completion/Unix/Command/_pgrep +++ b/Completion/Unix/Command/_pgrep @@ -8,7 +8,7 @@ arguments=('-P[parent process id]:parent process id:->ppid' '-F[match only in process in pidfile]:files:_files' '-g[match only in process group ids]:group:->pgid' '-G[match only real group id]:group:_groups' - '-j[match only in processes inside jails]:jail id:->jid' + '-j[match only in processes inside jails]:jail id:_sequence _jails -0 -o jid' '-J[match only in project ids]:project id:->projid' '-M[extract the name list from the specified core]:files:_files' '-N[extract the name list from the specified system]:files:_files' @@ -93,16 +93,6 @@ case $state in _wanted sid expl 'session id' compadd -S ',' -q -F used $sid ;; - (jid) - compset -P '*,' - - local -a used jid - used=(${(s:,:)IPREFIX}) - jid=(${(uon)$(ps -ax -o jid=)}) - - _wanted jid expl 'jail id' compadd -S ',' -q -F used $jid - ;; - (ppid) compset -P '*,' diff --git a/Completion/Unix/Command/_php b/Completion/Unix/Command/_php index 5d7b84e28..4edcd1e57 100644 --- a/Completion/Unix/Command/_php +++ b/Completion/Unix/Command/_php @@ -9,7 +9,7 @@ typeset -A opt_args local -a args local exclusions php_suffix -zstyle -s ":completion:$curcontext" suffixes php_suffix '|' || php_suffix='php|phar' +zstyle -s ":completion:${curcontext}:" suffixes php_suffix '|' || php_suffix='php|phar' local php_files=":PHP file:_files -g '*.($php_suffix)(-.)'" if _pick_variant php5=PHP\ 5 php4 --version; then diff --git a/Completion/Unix/Command/_ps b/Completion/Unix/Command/_ps index 925f48390..e557b27b9 100644 --- a/Completion/Unix/Command/_ps +++ b/Completion/Unix/Command/_ps @@ -160,7 +160,7 @@ if (( CURRENT > 1 )) && [[ $OSTYPE != solaris* || ( $OSTYPE = linux-gnu && $word _wanted -C option-k-1 properties expl 'property' _sequence -s , _ps_props -s - && return ;; *G) _sequence -s , _groups && return ;; - *J) _sequence -s , _jails && return ;; + *J) _sequence _jails -0 && return ;; *[MNW]) _files && return ;; *t) _wanted -C option-t-1 ttys expl tty _sequence -s , \ diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python index dedb9ceda..2fb4a915b 100644 --- a/Completion/Unix/Command/_python +++ b/Completion/Unix/Command/_python @@ -31,7 +31,7 @@ _arguments -C -s -S "$args[@]" \ '-E[ignore PYTHON* environment variables (such as PYTHONPATH)]' \ '(1 * -)-h[display help information]' \ '-i[inspect interactively after running script]' \ - '(1 -)-m[run library module as a script (terminates option list)]:module:_python_modules' \ + '(1 -)-m+[run library module as a script (terminates option list)]:module:_python_modules' \ '-O[optimize generated bytecode slightly]' \ '-OO[remove doc-strings in addition to the -O optimizations]' \ "-s[don't add user site directory to sys.path]" \ diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index 597f2325c..188a81367 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -96,7 +96,7 @@ _svn () { ) ;; (mergeinfo) - args[(r)--show-revs:arg:]=( '--show-revs:revisions:(merged eligible)' ) + args[(r)--show-revs:arg:]=( '--show-revs=:revisions:(merged eligible)' ) ;; (propget|propedit) args+=( diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar index ce5852453..1e99ac013 100644 --- a/Completion/Unix/Command/_tar +++ b/Completion/Unix/Command/_tar @@ -23,7 +23,7 @@ local _tar_cmd tf tmp tmpb del index if _pick_variant gnu=GNU unix --version; then case "$($service --version)" in - (tar \(GNU tar\) (#b)([0-9.-]##)*) + ("tar (GNU tar) "(#b)([0-9.-]##)*) autoload -z is-at-least is-at-least 1.14.91 "$match[1]" || _cmd_variant[$service]="gnu-old" ;; diff --git a/Completion/Unix/Command/_tla b/Completion/Unix/Command/_tla index 358a6a736..1e4cdd8d9 100644 --- a/Completion/Unix/Command/_tla +++ b/Completion/Unix/Command/_tla @@ -6,7 +6,7 @@ local tla_version local hide_short # ask the user which version of tla this is -if ! zstyle -s ":completion:${curcontext}" tla-version tla_version; then +if ! zstyle -s ":completion:${curcontext}:" tla-version tla_version; then # ask tla instead tla_version="$($TLA --version)" if [[ "${${(f)tla_version}[1]}" == The\ GNU\ Arch\ Revision\ Control\ System\ \(tla\)\ (#b)([0-9.]##) ]]; then @@ -18,7 +18,7 @@ if ! zstyle -s ":completion:${curcontext}" tla-version tla_version; then fi # test whether to hide short options from completion -if zstyle -s ":completion:${curcontext}" hide-shortopts hide_short; then +if zstyle -s ":completion:${curcontext}:" hide-shortopts hide_short; then case $hide_short in true|yes|on|1) hide_short='!' ;; *) hide_short='' ;; diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim index 021054d47..007671be8 100644 --- a/Completion/Unix/Command/_vim +++ b/Completion/Unix/Command/_vim @@ -4,7 +4,7 @@ _vim_files () { case $PREFIX in (+*) _files -P './' $* && return 0 ;; - (scp|http(|s)|(|s)ftp):*) _urls ;; + ((scp|http(|s)|(|s)ftp):*) _urls ;; (*) _files $* ;; esac case $PREFIX in |