From e8cf611879a2d9e6bf84af0dabaa1ff985c96f4e Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 7 Jun 2015 23:49:32 +0200 Subject: 35216: _git-checkout: do not call __git_commits twice This makes `branch_arg` empty by default, to be used only for __git_remote_branch_names. `branches::__git_revisions` was used here, but that's the same as tree_ish_arg='tree-ishs::__git_tree_ishs' - both call __git_commits. Only tree_ish_arg will call __git-commits now. --- Completion/Unix/Command/_git | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b8edc109e..088a7dbb7 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -456,14 +456,13 @@ _git-checkout () { [[ $line[CURRENT] = -* ]] && return if (( CURRENT == 1 )) && [[ -z $opt_args[(I)--] ]]; then # TODO: Allow A...B - local branch_arg='branches::__git_revisions' \ + local branch_arg='' \ remote_branch_noprefix_arg='remote branches::__git_remote_branch_names_noprefix' \ tree_ish_arg='tree-ishs::__git_tree_ishs' \ file_arg='modified-files::__git_modified_files' if [[ -n ${opt_args[(I)-b|-B|--orphan|--detach]} ]]; then remote_branch_noprefix_arg= - tree_ish_arg= file_arg= elif [[ -n $opt_args[(I)--track] ]]; then branch_arg='remote-branches::__git_remote_branch_names' @@ -471,7 +470,6 @@ _git-checkout () { tree_ish_arg= file_arg= elif [[ -n ${opt_args[(I)--ours|--theirs|-m|--conflict|--patch]} ]]; then - branch_arg= remote_branch_noprefix_arg= fi -- cgit v1.2.3 From 8ebb4e65a9b47d68b730ff02e70d9ba28d3ccd3f Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 18 Jun 2015 23:47:40 +0200 Subject: 35504: complete % placeholders for git log --format --- ChangeLog | 3 ++ Completion/Unix/Command/_git | 100 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 93 insertions(+), 10 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 9614924d6..2b4dfb4a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-06-18 Oliver Kiddle + * 35504: Completion/Unix/Command/_git: complete % placeholders + for git log --format + * 35521: Completion/Zsh/Type/_file_descriptors: sort matches numerically and use pfiles on Solaris diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 088a7dbb7..3e728865b 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6269,6 +6269,95 @@ __git_setup_diff_stage_options () { ) } +(( $+functions[__git_format_placeholders] )) || +__git_format_placeholders() { + local sep + local -a disp names placeholders expl + if compset -P 'format:'; then + compset -P '(%[^acgCG]|%?[^%]|[^%])#' + if compset -P '%C'; then + _wanted colors expl color compadd reset red green blue + return + fi + if [[ -prefix %G ]]; then + placeholders=( + 'GG:raw verification message' + 'G?:indicate [G]ood, [B]ad, [U]ntrusted or [N]o signature' + 'GS:name of signer' + 'GK:signing key' + ) + disp=( -l ) + elif [[ -prefix %g ]]; then + placeholders=( + gD:'reflog selector' + gd:'short reflog selector' + gn:'reflog identity' + gs:'reflog subject' + ) + disp=( -l ) + elif [[ $PREFIX = (#b)%([ac]) ]]; then + placeholders=( + n:'name' + N:'name (use .mailmap)' + e:'email' + E:'email (use .mailmap)' + d:'date' + D:'date, RFC2822 style' + r:'date, relative' + t:'date, UNIX timestamp' + i:'date, like ISO 8601' + I:'date, strict ISO 8601' + ) + placeholders=( $match[1]$^placeholders ) + else + placeholders=( + H:commit\ hash + h:'abbreviated commit hash' + T:'tree hash' + t:'abbreviated tree hash' + P:'parent hash' + p:'abbreviated parent hash' + a:'author details' + c:'committer details' + d:'ref name in brackets' + D:'ref name' + e:encoding + s:subject + f:'sanitized subject' + g:reflog + b:body + B:'raw body' + N:notes + G:GPG\ details + C:color + m:mark + n:newline + %:raw\ % + x:'hex code' + w:'switch line wrapping' + ) + fi + names=( ${placeholders%%:*} ) + if zstyle -T ":completion:${curcontext}:" verbose; then + zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- + zformat -a placeholders " $sep " $placeholders + disp+=(-d placeholders) + else + disp=() + 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] )) || __git_setup_revision_options () { local -a diff_options @@ -6276,16 +6365,7 @@ __git_setup_revision_options () { revision_options=( $diff_options - # TODO: format pretty print format is a lot more advanced than this. - # TODO: You can't actually specify --format without a format. - '(-v --header)'{--pretty=-,--format=-}'[pretty print commit messages]::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"))' + '(-v --header)'{--pretty=-,--format=-}'[pretty print commit messages]::format:__git_format_placeholders' '(--abbrev-commit --no-abbrev-commit)--abbrev-commit[show only partial prefixes of commit object names]' '(--abbrev-commit --no-abbrev-commit)--no-abbrev-commit[show the full 40-byte hexadecimal commit object name]' '(--abbrev --no-abbrev)--abbrev=[set minimum SHA1 display-length (for use with --abbrev-commit)]: :__git_guard_number length' -- cgit v1.2.3 From deb2ec7f174df720033e7001be0c8d8f0bd9a9d9 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 18 Jun 2015 23:50:59 +0200 Subject: 35510: use consistent formatting for git subcommands --- ChangeLog | 3 ++ Completion/Unix/Command/_git | 116 ++++++++++++------------------------------- 2 files changed, 36 insertions(+), 83 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 2b4dfb4a3..42b25a74d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-06-18 Oliver Kiddle + * 35510: Completion/Unix/Command/_git: use consistent + formatting for git subcommands + * 35504: Completion/Unix/Command/_git: complete % placeholders for git log --format diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 3e728865b..a44de405c 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5023,7 +5023,16 @@ __git_ignore_line_inside_arguments () { (( $+functions[_git_commands] )) || _git_commands () { - local -a main_porcelain_commands + local -a cmdtypes + cmdtypes=( main_porcelain_commands user_commands + third_party_commands ancillary_manipulator_commands + ancillary_interrogator_commands interaction_commands + plumbing_manipulator_commands plumbing_interrogator_commands + plumbing_sync_commands plumbing_sync_helper_commands + plumbing_internal_helper_commands + ) + local -a $cmdtypes + main_porcelain_commands=( add:'add file contents to index' am:'apply patches from a mailbox' @@ -5062,7 +5071,6 @@ _git_commands () { submodule:'initialize, update, or inspect submodules' tag:'create, list, delete or verify tag object signed with GPG') - local -a ancillary_manipulator_commands ancillary_manipulator_commands=( config:'get and set repository or global options' fast-export:'data exporter' @@ -5077,7 +5085,6 @@ _git_commands () { repack:'pack unpacked objects in a repository' replace:'create, list, delete refs to replace objects') - local -a ancillary_interrogator_commands ancillary_interrogator_commands=( blame:'show what revision and author last modified each line of a file' cherry:'find commits not merged upstream' @@ -5095,7 +5102,6 @@ _git_commands () { verify-tag:'check GPG signature of tags' whatchanged:'show commit-logs and differences they introduce') - local -a interaction_commands interaction_commands=( archimport:'import an Arch repository into git' cvsexportcommit:'export a single commit to a CVS checkout' @@ -5107,7 +5113,6 @@ _git_commands () { send-email:'send collection of patches as emails' svn:'bidirectional operation between a Subversion repository and git') - local -a plumbing_manipulator_commands plumbing_manipulator_commands=( apply:'apply patch to files and/or to index' checkout-index:'copy files from index to working directory' @@ -5127,7 +5132,6 @@ _git_commands () { update-ref:'update object name stored in a reference safely' write-tree:'create tree from the current index') - local -a plumbing_interrogator_commands plumbing_interrogator_commands=( cat-file:'provide content or type information for repository objects' diff-files:'compare files in working tree and index' @@ -5147,7 +5151,6 @@ _git_commands () { var:'show git logical variable' verify-pack:'validate packed git archive files') - local -a plumbing_sync_commands plumbing_sync_commands=( daemon:'run a really simple server for git repositories' fetch-pack:'receive missing objects from another repository' @@ -5155,7 +5158,6 @@ _git_commands () { send-pack:'push objects over git protocol to another repository' update-server-info:'update auxiliary information file to help dumb servers') - local -a plumbing_sync_helper_commands plumbing_sync_helper_commands=( http-fetch:'download from remote git repository via HTTP' http-push:'push objects over HTTP/DAV to another repository' @@ -5165,7 +5167,6 @@ _git_commands () { upload-archive:'send archive back to git-archive' upload-pack:'send objects packed back to git fetch-pack') - local -a plumbing_internal_helper_commands plumbing_internal_helper_commands=( check-attr:'display gitattributes information' check-ignore:'debug gitignore/exclude files' @@ -5178,91 +5179,40 @@ _git_commands () { patch-id:'compute unique ID for a patch' stripspace:'filter out empty lines') - local -a user_commands zstyle -a :completion:$curcontext: user-commands user_commands - local -a third_party_commands local command for command in $_git_third_party_commands; do (( $+commands[git-${command%%:*}] )) && third_party_commands+=$command done - local -a aliases unique_aliases + local -a aliases __git_extract_aliases - local alias - for alias in $aliases; do - local name=${alias%%:*} - (( main_porcelain_commands[(I)$name:*] || - user_commands[(I)$name:*] || - third_party_commands[(I)$name:*] || - ancillary_manipulator_commands[(I)$name:*] || - ancillary_interrogator_commands[(I)$name:*] || - interaction_commands[(I)$name:*] || - plumbing_manipulator_commands[(I)$name:*] || - plumbing_interrogator_commands[(I)$name:*] || - plumbing_sync_commands[(I)$name:*] || - plumbing_sync_helper_commands[(I)$name:*] || - plumbing_internal_helper_commands[(I)$name:*] )) || unique_aliases+=$alias + local cmdtype len dup sep + local -a allcmds allmatching alts disp + + zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- + for cmdtype in $cmdtypes aliases; do + if [[ $cmdtype = aliases ]]; then + for dup in ${${aliases%:*}:*allcmds}; do + aliases=( ${aliases:#$dup:*} ) + done + fi + local -a ${cmdtype}_m + set -A ${cmdtype}_m ${(P)cmdtype%%:*} + allcmds+=( ${(P)${:-${cmdtype}_m}} ) done - - integer ret=1 - - _tags \ - aliases \ - main-porcelain-commands \ - user-commands \ - third-party-commands \ - ancillary-manipulator-commands \ - ancillary-interrogator-commands \ - interaction-commands \ - plumbing-manipulator-commands \ - plumbing-interrogator-commands \ - plumbing-sync-commands \ - plumbing-sync-helper-commands \ - plumbing-internal-helper-commands - - while _tags; do - - _requested aliases && \ - _describe -t aliases 'alias' unique_aliases && ret=0 - - _requested main-porcelain-commands && \ - _describe -t main-porcelain-commands 'main porcelain command' main_porcelain_commands && ret=0 - - _requested user-commands && \ - _describe -t user-commands 'user command' user_commands && ret=0 - - _requested third-party-commands && \ - _describe -t third-party-commands 'third-party command' third_party_commands && ret=0 - - _requested ancillary-manipulator-commands && \ - _describe -t ancillary-manipulator-commands 'ancillary manipulator command' ancillary_manipulator_commands && ret=0 - - _requested ancillary-interrogator-commands && \ - _describe -t ancillary-interrogator-commands 'ancillary interrogator command' ancillary_interrogator_commands && ret=0 - - _requested interaction-commands && \ - _describe -t interaction-commands 'interaction command' interaction_commands && ret=0 - - _requested plumbing-manipulator-commands && \ - _describe -t plumbing-manipulator-commands 'plumbing manipulator command' plumbing_manipulator_commands && ret=0 - - _requested plumbing-interrogator-commands && \ - _describe -t plumbing-interrogator-commands 'plumbing interrogator command' plumbing_interrogator_commands && ret=0 - - _requested plumbing-sync-commands && \ - _describe -t plumbing-sync-commands 'plumbing sync command' plumbing_sync_commands && ret=0 - - _requested plumbing-sync-helper-commands && \ - _describe -t plumbing-sync-helper-commands 'plumbing sync helper command' plumbing_sync_helper_commands && ret=0 - - _requested plumbing-internal-helper-commands && \ - _describe -t plumbing-internal-helper-commands 'plumbing internal helper command' plumbing_internal_helper_commands && ret=0 - - (( ret )) || break + zstyle -T ":completion:${curcontext}:" verbose && disp=(-ld '${cmdtype}_d') + compadd -O allmatching -a allcmds + len=${#${(O)allmatching//?/.}[1]} # length of longest match + for cmdtype in aliases $cmdtypes; do + local -a ${cmdtype}_d + (( $#disp )) && set -A ${cmdtype}_d \ + ${${(Pr.COLUMNS-4.)cmdtype/(#s)(#m)[^:]##:/${(r.len.)MATCH[1,-2]} $sep }%% #} + alts+=( "${cmdtype//_/-}:${${cmdtype//_/ }%%(e|)s}:compadd ${(e)disp} -a ${cmdtype}_m" ) done - return ret + _alternative $alts } (( $+functions[__git_aliases] )) || -- cgit v1.2.3 From 8024de798d1b3eb0eca5772bf5c316124748e74c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 12 Jul 2015 18:14:03 +0200 Subject: 35779: completion: _git-config: remove extraneous "local expl" It is defined at the beginning of the function already, and results in the output of `expl=''` when completing after `git config branch.local.pushremote ` etc. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 71f4755ea..354418d05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-07-13 Daniel Hahler + + * 35779: Completion/Unix/Command/_git: _git-config: remove + extraneous "local expl". + 2015-07-12 Daniel Shahaf * unposted: Test/B01cd.ztst: Typo diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index a44de405c..26f108fbd 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2923,7 +2923,6 @@ _git-config () { (*) # TODO: Do we need to set up a _requested/_next_label? declare -a action - local expl _description values expl "$parts[2]" eval "action=($parts[4])" "$action[1]" "$expl[@]" "${(@)action[2,-1]}" && ret=0 -- cgit v1.2.3 From d90f92194fe42973046b02da93f97f82d6a1aa13 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 2 Aug 2015 17:45:35 +0200 Subject: 35970: completion: fix typos in _git and _brace_parameter --- ChangeLog | 6 ++++++ Completion/Unix/Command/_git | 4 ++-- Completion/Zsh/Context/_brace_parameter | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 7f7bb892f..373ff3cd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-08-02 Daniel Hahler + + * 35970: Completion/Unix/Command/_git, + Completion/Zsh/Context/_brace_parameter: completion: fix typos in _git + and _brace_parameter. + 2015-08-01 Jun-ichi Takimoto * 35957: Completion/Unix/Command/_make: fix _make-expandVars(), diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 26f108fbd..5b78a2b81 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -922,7 +922,7 @@ _git-grep () { # TODO: Need to implement - as a shorthand for -C _arguments -C -A '-*' \ '(-O --open-files-in-pager --no-index)--cached[search blobs registered in index file instead of working tree]' \ - '(--cached)--no-index[search files in current directory, not just treacked files]' \ + '(--cached)--no-index[search files in current directory, not just tracked files]' \ '(--exclude-standard)--no-exclude-standard[also search in ignored files]' \ '(--no-exclude-standard)--exclude-standard[exclude files standard ignore mechanisms]' \ '--untracked[search in untracked files]' \ @@ -948,7 +948,7 @@ _git-grep () { '(-z --null)'{-z,--null}'[output \0 after filenames]' \ '(-c --count)'{-c,--count}'[show number of matching lines in files]' \ '( --no-color)--color=-[color matches]:: :__git_color_whens' \ - '(--color )---no-color[do not color matches]' \ + '(--color )--no-color[do not color matches]' \ '--break[prefix the line number to matching lines]' \ '--heading[show the filename above the matches]' \ '(-A --after-context)'{-A,--after-context=}'[show trailing lines, and separate groups of matches]: :__git_guard_number lines' \ diff --git a/Completion/Zsh/Context/_brace_parameter b/Completion/Zsh/Context/_brace_parameter index 3955cb7a4..4097895ee 100644 --- a/Completion/Zsh/Context/_brace_parameter +++ b/Completion/Zsh/Context/_brace_parameter @@ -192,7 +192,7 @@ elif compset -P '*:([\|\*\^]|\^\^)'; then elif compset -P '*:'; then flags=( '-:substitute alternate value if parameter is null' - '+:susbtitute alternate value if parameter is non-null' + '+:substitute alternate value if parameter is non-null' '=:substitute and assign alternate value if parameter is null' '\:=:unconditionally assign value to parameter' '?:print error if parameter is set and non-null' -- cgit v1.2.3 From 8815500f95aeb7599704877a80a392321f753f43 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 22 Sep 2011 18:13:23 +0200 Subject: 36116: _git: various fixes Add = to git checkout --conflict= completion fix transposed [- git push remote argument is not optional can use shorter syntax for a check --- ChangeLog | 2 ++ Completion/Unix/Command/_git | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 1d3ce244f..77e18c537 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,8 @@ * 36078: Doc/Zsh/contrib.yo: vcs_info: Adjust documentation for no longer exporting + * 36116: Completion/Unix/Command/_git: various fixes + 2015-08-11 Barton E. Schaefer * 36108: NEWS: list of major changes so far since 5.0.8 diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 5b78a2b81..4357b7448 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -132,7 +132,7 @@ _git-archive () { declare -a backend_args - if (( words[(I)--format=*] > 0 && words[(I)--format=*] < CURRENT )); then + if (( words[(b:CURRENT-1:I)--format=*] )); then case ${words[$words[(I)--format=*]]#--format=} in (zip) backend_args=( @@ -442,7 +442,7 @@ _git-checkout () { '(-b -B -t --track --patch --detach)--orphan[create a new orphan branch based at given commit]: :__git_branch_names' \ '--ignore-skip-worktree-bits[ignores patterns and adds back any files in ]' \ '(-q --quiet -f --force -m --merge --conflict --patch)'{-m,--merge}'[3way merge current branch, working tree and new branch]' \ - '(-q --quiet -f --force -m --merge --patch)--conflict[same as --merge, using given merge style]:style:(merge diff3)' \ + '(-q --quiet -f --force -m --merge --patch)--conflict=[same as --merge, using given merge style]:style:(merge diff3)' \ '(-)'{-p,--patch}'[interactively select hunks in diff between given tree-ish and working tree]' \ '(-)--[start file arguments]' \ '*:: :->branch-or-tree-ish-or-file' && ret=0 @@ -1285,7 +1285,7 @@ _git-push () { '(--verify)--no-verify[bybass the pre-push hook]' \ '--recurse-submodules=[submodule handling]:submodule handling:((check\:"refuse pushing of supermodule if submodule commit cannot be found on the remote" on-demand\:"push all changed submodules"))' \ - ':: :__git_any_repositories' \ + ': :__git_any_repositories' \ '*: :__git_ref_specs' && ret=0 case $state in @@ -6356,8 +6356,8 @@ __git_setup_revision_options () { '*--not[reverses meaning of ^ prefix for revisions that follow]' '--all[show all commits from refs]' '--branches=-[show all commits from refs/heads]::pattern' - '--tags=[-show all commits from refs/tags]::pattern' - '--remotes=[-show all commits from refs/remotes]::pattern' + '--tags=-[show all commits from refs/tags]::pattern' + '--remotes=-[show all commits from refs/remotes]::pattern' '--glob=[show all commits from refs matching glob]:pattern' '--exclude=[do not include refs matching glob]:pattern' '--exclude=[do not include refs matching glob]:pattern' -- cgit v1.2.3 From cf77e28a3fe46035faf6c1815cb7dbc92207e5f4 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 12 Aug 2015 18:02:57 +0200 Subject: 36127: assorted minor completion function changes --- ChangeLog | 8 ++++++++ Completion/Unix/Command/_clay | 2 +- Completion/Unix/Command/_git | 5 +++-- Completion/Unix/Command/_ifconfig | 2 +- Completion/Unix/Command/_kvno | 3 +-- Completion/Unix/Command/_mh | 7 +++++-- Completion/Unix/Command/_rm | 2 +- Completion/Unix/Command/_ssh | 2 +- Completion/Unix/Command/_stty | 2 +- Completion/Unix/Command/_vim | 2 +- Completion/Unix/Type/_pdf | 2 +- Completion/Zsh/Context/_brace_parameter | 2 +- 12 files changed, 25 insertions(+), 14 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 468ba8f1e..be4874c27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2015-08-12 Oliver Kiddle + * 36127: Completion/Zsh/Context/_brace_parameter, + Completion/Unix/Command/_git, Completion/Unix/Command/_ifconfig, + Completion/Unix/Command/_kvno, Completion/Unix/Command/_mh, + Completion/Unix/Command/_rm, Completion/Unix/Command/_ssh, + Completion/Unix/Command/_stty, Completion/Unix/Command/_vim, + Completion/Unix/Type/_pdf, Completion/Unix/Command/_clay: + assorted minor completion function changes + * 36125: Src/Zle/zle_hist.c: don't set history context in get-line * 35834 (tweaked): Src/Zle/zle_misc.c: strip a final newline from diff --git a/Completion/Unix/Command/_clay b/Completion/Unix/Command/_clay index 71f05bf64..581338b8b 100644 --- a/Completion/Unix/Command/_clay +++ b/Completion/Unix/Command/_clay @@ -38,5 +38,5 @@ _arguments -C \ "-e:compile and run (implies -run)" \ "-M-:import .*; for -e" \ "-v[display version info]" \ - ":program file:_files -g '*.clay'" + ":program file:_files -g '*.clay(-.)'" diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 4357b7448..a5e44641b 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5188,7 +5188,7 @@ _git_commands () { local -a aliases __git_extract_aliases local cmdtype len dup sep - local -a allcmds allmatching alts disp + local -a allcmds allmatching alts disp expl zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- for cmdtype in $cmdtypes aliases; do @@ -5202,7 +5202,8 @@ _git_commands () { allcmds+=( ${(P)${:-${cmdtype}_m}} ) done zstyle -T ":completion:${curcontext}:" verbose && disp=(-ld '${cmdtype}_d') - compadd -O allmatching -a allcmds + _description '' expl '' # get applicable matchers + compadd "$expl[@]" -O allmatching -a allcmds len=${#${(O)allmatching//?/.}[1]} # length of longest match for cmdtype in aliases $cmdtypes; do local -a ${cmdtype}_d diff --git a/Completion/Unix/Command/_ifconfig b/Completion/Unix/Command/_ifconfig index 49b018841..0c81bce10 100644 --- a/Completion/Unix/Command/_ifconfig +++ b/Completion/Unix/Command/_ifconfig @@ -65,7 +65,7 @@ esac _arguments -C "$args[@]" \ '-a[apply to all interfaces]' \ - '1:network interface:_net_interfaces' \ + '1:network interface:_net_interfaces -r ": \t\n\-"' \ '::address family:(atalk ether inet inet6 ax25 ddp ipx netrom)' \ '*:option:->options' && ret=0 diff --git a/Completion/Unix/Command/_kvno b/Completion/Unix/Command/_kvno index 285aab3c8..782d9e6fc 100644 --- a/Completion/Unix/Command/_kvno +++ b/Completion/Unix/Command/_kvno @@ -11,8 +11,7 @@ _arguments -C \ ':principal:->principal' && ret=0 if [[ $state = principal ]]; then - if [[ -prefix host/ ]]; then - compset -P host/ + if compset -P host/; then _hosts && ret=0 else _alternative \ diff --git a/Completion/Unix/Command/_mh b/Completion/Unix/Command/_mh index 48177982e..3eddd41a6 100644 --- a/Completion/Unix/Command/_mh +++ b/Completion/Unix/Command/_mh @@ -1,4 +1,4 @@ -#compdef ali anno burst comp dist flist flists folder folders forw inc mark mhlist mhmail mhn mhparam mhpath mhshow mhstore msgchk next packf pick prev refile repl rmf rmm scan show sortm whom +#compdef ali anno burst comp dist flist flists fmttest folder folders forw fnext fprev inc mark mhfixmsg mhlist mhmail mhn mhparam mhpath mhshow mhstore msgchk new next packf pick prev refile repl rmf rmm scan show sortm whom if [[ -z $commands[mhpath] ]]; then _message "MH commands are not available" @@ -73,7 +73,9 @@ elif [[ $service = mhparam ]]; then elif [[ $service = ali ]]; then _email_addresses -n MH elif compset -P '*:'; then - _message -e number 'number of messages' + _alternative \ + 'sequences:sub-sequence:(first last cur prev next)' + 'number: : _message -e number "number of messages"' else # Generate sequences. local foldnam folddir f sequences mhneg ret=1 @@ -95,6 +97,7 @@ else sequences=( ${${(f)"$(mark $foldnam 2>/dev/null)"}%%:*} ) mhneg="$(mhparam Sequence-Negation)" && sequences=( {,$mhneg}$^sequences ) sequences+=( all first last prev next ) + [[ $service = mhpath ]] && sequences+=( new ) _tags sequences while _tags; do while _next_label sequences expl sequence; do diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm index 4728ad464..4d0dbdb3f 100644 --- a/Completion/Unix/Command/_rm +++ b/Completion/Unix/Command/_rm @@ -40,7 +40,7 @@ fi local curcontext=$curcontext state line ret=1 declare -A opt_args -_arguments -C $opts \ +_arguments -C -s $opts \ $args && ret=0 case $state in diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index b7b7e41dc..c2514a1a7 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -105,7 +105,7 @@ _ssh () { ;; ssh-keygen) cmds=( -p -i -e -y -c -l -B -D -U ) - _arguments \ + _arguments -s \ '-q[silence ssh-keygen]' \ "($cmds -P)-b[specify number of bits in key]:bits in key" \ "($cmds -P)-t[specify the type of the key to create]:key type:(rsa1 rsa dsa ecdsa ed25519)" \ diff --git a/Completion/Unix/Command/_stty b/Completion/Unix/Command/_stty index f40cd856e..b5545ebcd 100644 --- a/Completion/Unix/Command/_stty +++ b/Completion/Unix/Command/_stty @@ -14,5 +14,5 @@ else parmrk inpck istrip inlcr igncr icrnl iuclc ixon ixany ixoff \ imaxbel isig icanon xcase echo echoe echok echonl noflsh \ tostop echoctl echoprt echoke flusho pending iexten opost \ - olcuc onlcr ocrnl onocr onlret ofill ofdel + olcuc onlcr ocrnl onocr onlret ofill ofdel raw sane fi diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim index 007671be8..dbc946cb1 100644 --- a/Completion/Unix/Command/_vim +++ b/Completion/Unix/Command/_vim @@ -1,4 +1,4 @@ -#compdef vim exim 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 (( $+functions[_vim_files] )) || _vim_files () { diff --git a/Completion/Unix/Type/_pdf b/Completion/Unix/Type/_pdf index 60cee84ee..5fda42a12 100644 --- a/Completion/Unix/Type/_pdf +++ b/Completion/Unix/Type/_pdf @@ -1,4 +1,4 @@ -#compdef pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext pdfopt pdffonts kpdf apvlv epdfview +#compdef pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext pdfopt pdffonts kpdf apvlv epdfview mupdf local expl ext='' diff --git a/Completion/Zsh/Context/_brace_parameter b/Completion/Zsh/Context/_brace_parameter index 4097895ee..9eb3465ae 100644 --- a/Completion/Zsh/Context/_brace_parameter +++ b/Completion/Zsh/Context/_brace_parameter @@ -152,7 +152,7 @@ if [[ $PREFIX = *'${('[^\)]# ]]; then "F:join arrays with newlines" "g:process echo array sequences (needs options)" "i:sort case-insensitively" - "k:subsitute keys of associative arrays" + "k:substitute keys of associative arrays" "L:lower case all letters" "n:sort decimal integers numerically" "o:sort in ascending order (lexically if no other sort option)" -- cgit v1.2.3 From 8e0b5e0e009271a7a9fc371e7278e9d9de22cfb3 Mon Sep 17 00:00:00 2001 From: Wieland Hoffmann Date: Thu, 13 Aug 2015 15:53:12 +0200 Subject: Wieland Hoffmann: 36123: protect against word splitting in __git_is_committish_range --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index c7444164b..1c847dbbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-08-13 Oliver Kiddle + + * Wieland Hoffmann: 36123: Completion/Unix/Command/_git: + protect against word splitting in __git_is_committish_range + 2015-08-12 Peter Stephenson * Kamil Dudka: 36106: Src/Zle/zle_keymap.c: fix const parameter. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index a5e44641b..92db67928 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -4973,8 +4973,8 @@ __git_is_treeish () { (( $+functions[__git_is_committish_range] )) || __git_is_committish_range () { [[ $1 == *..(.|)* ]] || return 1 - local first=$(__git_committish_range_first $1) - local last=$(__git_committish_range_last $1) + local first="$(__git_committish_range_first $1)" + local last="$(__git_committish_range_last $1)" [[ $first != *..* && $last != *..* ]] && \ __git_is_committish $first && \ __git_is_committish $last -- cgit v1.2.3 From ea5d100643646af718309d54975424f08963fe6f Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 19 Aug 2015 23:27:33 +0000 Subject: 36148: _git-log: Complete flags after positional argument --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 48 +++++++++++++++++++++----------------------- 2 files changed, 28 insertions(+), 25 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 4f95ca5c8..21cd189fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-08-19 Oliver Kiddle + + * 36148: Completion/Unix/Command/_git: _git-log: Complete flags + after positional argument + 2015-08-19 Peter Stephenson * 36241: Test/V09datetime.ztst: Test for 36227. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 92db67928..3c20ca663 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1087,33 +1087,31 @@ _git-log () { $revision_options \ '-L+[trace the evolution of a line range or regex within a file]:range' \ '(-)--[start file arguments]' \ - '*:: :->commit-range-or-file' && ret=0 + '1: :->first-commit-ranges-or-files' \ + '*: :->commit-ranges-or-files' && ret=0 case $state in - (commit-range-or-file) - case $CURRENT in - (1) - if [[ -n ${opt_args[(I)--]} ]]; then - __git_cached_files && ret=0 - else - _alternative \ - 'commit-ranges::__git_commit_ranges' \ - 'cached-files::__git_cached_files' && ret=0 - fi - ;; - (*) - # TODO: Write a wrapper function that checks whether we have a - # committish range or comittish and calls __git_tree_files - # appropriately. - if __git_is_committish_range $line[1]; then - __git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0 - elif __git_is_committish $line[1]; then - __git_tree_files ${PREFIX:-.} $line[1] && ret=0 - else - __git_cached_files && ret=0 - fi - ;; - esac + (first-commit-ranges-or-files) + if [[ -n ${opt_args[(I)--]} ]]; then + __git_cached_files && ret=0 + else + _alternative \ + 'commit-ranges::__git_commit_ranges' \ + 'cached-files::__git_cached_files' && ret=0 + fi + ;; + (commit-ranges-or-files) + # TODO: Write a wrapper function that checks whether we have a + # committish range or comittish and calls __git_tree_files + # appropriately. + if __git_is_committish_range $line[1]; then + __git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0 + elif __git_is_committish $line[1]; then + __git_tree_files ${PREFIX:-.} $line[1] && ret=0 + else + __git_cached_files && ret=0 + fi + ;; esac return ret -- cgit v1.2.3 From d70e7149df96e94e747ea3ed9ae6787f5a04d8b5 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 18 Aug 2015 04:19:27 +0000 Subject: 36236: _git-log: complete 'git rm'd files --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 21cd189fa..3e361c5a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-08-19 Daniel Shahaf + + * 36236: Completion/Unix/Command/_git: _git-log: complete + 'git rm'd files + 2015-08-19 Oliver Kiddle * 36148: Completion/Unix/Command/_git: _git-log: Complete flags diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 3c20ca663..df9375ff4 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1093,11 +1093,11 @@ _git-log () { case $state in (first-commit-ranges-or-files) if [[ -n ${opt_args[(I)--]} ]]; then - __git_cached_files && ret=0 + __git_tree_files ${PREFIX:-.} HEAD && ret=0 else _alternative \ 'commit-ranges::__git_commit_ranges' \ - 'cached-files::__git_cached_files' && ret=0 + 'cached-files::__git_tree_files ${PREFIX:-.} HEAD' && ret=0 fi ;; (commit-ranges-or-files) @@ -1109,7 +1109,7 @@ _git-log () { elif __git_is_committish $line[1]; then __git_tree_files ${PREFIX:-.} $line[1] && ret=0 else - __git_cached_files && ret=0 + __git_tree_files ${PREFIX:-.} HEAD && ret=0 fi ;; esac -- cgit v1.2.3 From a4c41fff1261c4c0251fe969e7684c582160f93a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 18 Aug 2015 04:26:48 +0000 Subject: 36236: _git-log: Complete multiple revspecs e.g., git log origin/master origin/foo origin/bar --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 3e361c5a7..ad64ca2df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-08-19 Daniel Shahaf + * 36236: Completion/Unix/Command/_git: _git-log: Complete + multiple revspecs + * 36236: Completion/Unix/Command/_git: _git-log: complete 'git rm'd files diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index df9375ff4..fc9d7ce9f 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1101,6 +1101,11 @@ _git-log () { fi ;; (commit-ranges-or-files) + # Multiple revspecs are permitted. + if [[ -z ${opt_args[(I)--]} ]]; then + __git_commit_ranges "$@" && ret=0 + fi + # TODO: Write a wrapper function that checks whether we have a # committish range or comittish and calls __git_tree_files # appropriately. -- cgit v1.2.3 From 663fa4092fcc492e49fbf4d396d0b5b0a2325a48 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 19 Aug 2015 21:17:50 +0000 Subject: 36237: __git_objects: Complete HEAD:foo correctly in worktree subdir --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index ad64ca2df..7479cfe6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-08-19 Daniel Shahaf + * 36237: Completion/Unix/Command/_git: __git_objects: Complete + HEAD:foo correctly in worktree subdir + * 36236: Completion/Unix/Command/_git: _git-log: Complete multiple revspecs diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index fc9d7ce9f..e1a38e935 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5740,7 +5740,7 @@ __git_tree_ishs () { __git_objects () { compset -P '*:' if [[ -n $IPREFIX ]]; then - __git_tree_files "$PREFIX" "${IPREFIX%:}" + __git_tree_files --root-relative "$PREFIX" "${IPREFIX%:}" else _alternative \ 'revisions::__git_revisions' \ @@ -5985,12 +5985,23 @@ __git_changed_files () { 'changed-in-working-tree-files::__git_changed-in-working-tree_files' } +# __git_tree_files [--root-relative] FSPATH TREEISH [TREEISH...] [COMPADD OPTIONS] +# +# Complete [presently: a single level of] repository files under FSPATH. +# FSPATH is interpreted as a directory path within each TREEISH. +# FSPATH is relative to cwd, unless --root-relative is specified, in +# which case it is relative to the repository root. (( $+functions[__git_tree_files] )) || __git_tree_files () { local multi_parts_opts local tree Path integer at_least_one_tree_added local -a tree_files compadd_opts + local -a extra_args + + if [[ $1 == --root-relative ]]; then + extra_args+=(--full-tree) + fi zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F: @@ -5998,7 +6009,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 --name-only -z $tree $Path 2>/dev/null)"}) + tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree $extra_args --name-only -z $tree $Path 2>/dev/null)"}) __git_command_successful $pipestatus && (( at_least_one_tree_added = 1 )) done -- cgit v1.2.3 From a69994ede1ce9ba608e8deedad548b95235053c5 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 19 Aug 2015 21:18:08 +0000 Subject: 36247: __git_objects: Complete HEAD:./foo correctly in worktree subdir --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 7479cfe6c..73dc3d5ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-08-19 Daniel Shahaf + * 36247: Completion/Unix/Command/_git: __git_objects: Complete + HEAD:./foo correctly in worktree subdir + * 36237: Completion/Unix/Command/_git: __git_objects: Complete HEAD:foo correctly in worktree subdir diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index e1a38e935..0d705a9da 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5740,7 +5740,11 @@ __git_tree_ishs () { __git_objects () { compset -P '*:' if [[ -n $IPREFIX ]]; then - __git_tree_files --root-relative "$PREFIX" "${IPREFIX%:}" + if compset -P ./ ; then + __git_tree_files "$PREFIX" "${IPREFIX%:./}" + else + __git_tree_files --root-relative "$PREFIX" "${IPREFIX%:}" + fi else _alternative \ 'revisions::__git_revisions' \ -- cgit v1.2.3