From 67ef9605f12969b5eab407f83fb117867b15655f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 20 Jun 2011 02:24:56 +0000 Subject: unposted: clean up completion descriptions as per Etc/completion-style-guide --- Completion/Debian/Command/_git-buildpackage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Completion/Debian/Command') diff --git a/Completion/Debian/Command/_git-buildpackage b/Completion/Debian/Command/_git-buildpackage index 784d53028..936539fcc 100644 --- a/Completion/Debian/Command/_git-buildpackage +++ b/Completion/Debian/Command/_git-buildpackage @@ -30,7 +30,7 @@ _arguments \ '--git-prebuild=-[command to run before a build]:command:' \ '--git-postbuild=-[hook run after a successful build]:command:' \ '--git-posttag=-[hook run after a successful tag operation]:command:' \ - '--git-pbuilder[Invoke git-pbuilder for building]' \ + '--git-pbuilder[invoke git-pbuilder for building]' \ '--git-no-pbuilder[negates --git-pbuilder]' \ '--git-dist=-[build for this distribution when using git-pbuilder]:distribution:' \ '--git-arch=-[build for this architecture when using git-pbuilder]:architecture:' \ -- cgit v1.2.3 From 38868daa446d331a5e2d9cb1d79b1e7904e60399 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Tue, 28 Jun 2011 19:22:50 +0000 Subject: Sebastian Ramacher: 29513: _apt: Add markauto and unmarkauto sub-commands. --- ChangeLog | 7 ++++++- Completion/Debian/Command/_apt | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'Completion/Debian/Command') diff --git a/ChangeLog b/ChangeLog index 6253d50bc..300400632 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-06-28 Frank Terbeck + + * Sebastian Ramacher: 29513: Completion/Debian/Command/_apt: Add + markauto and unmarkauto sub-commands. + 2011-06-27 Peter Stephenson * Mikael Muszynski: 29510: Completion/X/Command/_mplayer: @@ -15047,5 +15052,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5381 $ +* $Revision: 1.5382 $ ***************************************************** diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt index 788fe3127..3200fc9ac 100644 --- a/Completion/Debian/Command/_apt +++ b/Completion/Debian/Command/_apt @@ -438,7 +438,9 @@ _apt-get () { /$'build-dep\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \ /$'autoremove\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \ /$'help\0/' \| \ - /"[]"/ ':argument-1::compadd "$expl_action[@]" update upgrade install remove purge dist-upgrade dselect-upgrade clean autoclean check source build-dep autoremove help' + /$'markauto\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \ + /$'unmarkauto\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \ + /"[]"/ ':argument-1::compadd "$expl_action[@]" update upgrade install remove purge dist-upgrade dselect-upgrade clean autoclean check source build-dep autoremove help markauto unmarkauto' _apt-get () { local expl_action expl_packages -- cgit v1.2.3 From 73497c5f5eb2e003d758b96e8e55ee52090727ae Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Fri, 1 Jul 2011 07:39:15 +0000 Subject: 29523: _git-buildpackage: Use "#desc:" line for _git third-party add-on completion description. --- ChangeLog | 5 ++++- Completion/Debian/Command/_git-buildpackage | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'Completion/Debian/Command') diff --git a/ChangeLog b/ChangeLog index 041a2264d..a0a73df9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ * 29521: Completion/Unix/Command/_git: Add `user-commands' support again. + * 29523: Completion/Debian/Command/_git-buildpackage: Use "#desc:" + line for _git third-party add-on completion description. + 2011-06-30 Frank Terbeck * 29526: Functions/VCS_Info/vcs_info: Set `max-exports' early @@ -15071,5 +15074,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5387 $ +* $Revision: 1.5388 $ ***************************************************** diff --git a/Completion/Debian/Command/_git-buildpackage b/Completion/Debian/Command/_git-buildpackage index 936539fcc..935100802 100644 --- a/Completion/Debian/Command/_git-buildpackage +++ b/Completion/Debian/Command/_git-buildpackage @@ -1,4 +1,5 @@ #compdef git-buildpackage +#desc:build Debian packages from a git repository _arguments \ '--version[show program version number and exit]' \ -- cgit v1.2.3 From 47347fc7d7decb08155abbeebdbeed4fc7ace6d9 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Fri, 1 Jul 2011 12:04:54 +0000 Subject: Daniel Bolton: 29529: _aptitude: Complete format specifiers with the `-F' option. --- ChangeLog | 5 ++++- Completion/Debian/Command/_aptitude | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) (limited to 'Completion/Debian/Command') diff --git a/ChangeLog b/ChangeLog index a0a73df9e..e4016aa3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,9 @@ * 29523: Completion/Debian/Command/_git-buildpackage: Use "#desc:" line for _git third-party add-on completion description. + * Daniel Bolton: 29529: Completion/Debian/Command/_aptitude: Complete + format specifiers with the `-F' option. + 2011-06-30 Frank Terbeck * 29526: Functions/VCS_Info/vcs_info: Set `max-exports' early @@ -15074,5 +15077,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5388 $ +* $Revision: 1.5389 $ ***************************************************** diff --git a/Completion/Debian/Command/_aptitude b/Completion/Debian/Command/_aptitude index bfec49730..2c462e462 100644 --- a/Completion/Debian/Command/_aptitude +++ b/Completion/Debian/Command/_aptitude @@ -13,6 +13,39 @@ ${${(M)${(f)"$( Date: Fri, 22 Jul 2011 13:08:25 +0000 Subject: * 29582, 29589: Update handling of third-party Git commands --- ChangeLog | 10 +- Completion/Debian/Command/_git-buildpackage | 2 +- Completion/Unix/Command/_git | 147 ++++++++++++++++------------ 3 files changed, 92 insertions(+), 67 deletions(-) (limited to 'Completion/Debian/Command') diff --git a/ChangeLog b/ChangeLog index 7368f87ab..7479f3218 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,14 @@ * unposted: Completion/Unix/Command/_git: Use _files, not _path_files. + * 29582: Completion/Unix/Command/_git: Alter the way that commands and + aliases are listed when both are requested. + + * 29589: Completion/Unix/Command/_git, + Completion/Debian/Command/_git-buildpackage: Use #description instead + of #desc: for description of third-party commands. Also, refactor the + code to match the rest of the file. + 2011-07-21 Nikolai Weibull * 29272: Completion/Unix/Command/_git: Use return values correctly @@ -15141,5 +15149,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5404 $ +* $Revision: 1.5405 $ ***************************************************** diff --git a/Completion/Debian/Command/_git-buildpackage b/Completion/Debian/Command/_git-buildpackage index 935100802..a2dc65689 100644 --- a/Completion/Debian/Command/_git-buildpackage +++ b/Completion/Debian/Command/_git-buildpackage @@ -1,5 +1,5 @@ #compdef git-buildpackage -#desc:build Debian packages from a git repository +#description build Debian packages from a git repository _arguments \ '--version[show program version number and exit]' \ diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 1c9d8a8e3..fb0450608 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2,7 +2,7 @@ # Some parts of this completion's behaviour are configurable: # -# Say, you got your own git sub-commands (git will run a program `git-foo' +# Say you got your own git sub-commands (git will run a program `git-foo' # when you run "git foo") and you want "git f" to complete that sub # commands name for you. You can make that sub-command know to the completion # via the user-command style: @@ -15,8 +15,21 @@ # # % zstyle ':completion:*:*:git:*' user-commands ${${(M)${(k)commands}:#git-*}/git-/} # -# You could even create a function _git-foo() to handle specific completion -# for that command. +# A better solution is to create a function _git-foo() to handle specific +# completion for that command. This also allows you to add command-specific +# completion as well. Place such a function inside an autoloaded #compdef file +# and you should be all set. You can add a description to such a function by +# adding a line matching +# +# #description DESCRIPTION +# +# as the second line in the file. See +# Completion/Debian/Command/_git-buildpackage in the Zsh sources for an +# example. +# +# As this solution is so much better than the user-commands zstyle method, the +# zstyle method is now DEPRECATED. It will most likely be removed in the next +# major release of Zsh (5.0). # # When _git does not know a given sub-command (say `bar'), it falls back to # completing file names for all arguments to that sub command. I.e.: @@ -2114,7 +2127,7 @@ _git-config () { __git_mergetools -S . && ret=0 ;; (pager.) - __git_aliases_and_commands && ret=0 + _git_commands && ret=0 ;; (pretty.) __git_config_sections -a '(|)' '^pretty\..+\.[^.]+$' prettys 'pretty format string' && ret=0 @@ -2930,7 +2943,7 @@ _git-help () { '(-a --all -m --man -w --web)'{-i,--info}'[show all available commands]' \ '(-a --all -i --info -w --web)'{-m,--man}'[show all available commands]' \ '(-a --all -i --info -m --man )'{-w,--web}'[show all available commands]' \ - ': :__git_aliases_and_commands' + ': :_git_commands' } (( $+functions[_git-instaweb] )) || @@ -4685,11 +4698,41 @@ _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 + __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 + done + integer ret=1 - # TODO: Is this the correct way of doing it? - # TODO: Should we be chaining them together with || instead? + # TODO: Is this the correct way of doing it? Should we be using _alternative + # and separate functions for each set of commands instead? + _describe -t aliases alias unique_aliases && ret=0 _describe -t main-porcelain-commands 'main porcelain command' main_porcelain_commands && ret=0 + _describe -t user-commands 'user command' user_commands && ret=0 + _describe -t third-party-commands 'third-party command' third_party_commands && ret=0 _describe -t ancillary-manipulator-commands 'ancillary manipulator command' ancillary_manipulator_commands && ret=0 _describe -t ancillary-interrogator-commands 'ancillary interrogator command' ancillary_interrogator_commands && ret=0 _describe -t interaction-commands 'interaction command' interaction_commands && ret=0 @@ -4699,34 +4742,20 @@ _git_commands () { _describe -t plumbing-sync-helper-commands 'plumbing sync helper command' plumbing_sync_helper_commands && ret=0 _describe -t plumbing-internal-helper-commands 'plumbing internal helper command' plumbing_internal_helper_commands && ret=0 - local -a addons - local a - for a in $_git_third_party; do - (( ${+commands[git-${a%%:*}]} )) && addons+=( $a ) - done - _describe -t third-party-addons 'third party addon' addons && ret=0 - - local -a user_commands - zstyle -a ":completion:${curcontext}:" user-commands user_commands || user_commands=() - _describe -t user-specific-commands 'user specific command' user_commands && ret=0 - return ret } (( $+functions[__git_aliases] )) || __git_aliases () { - declare -a aliases - - aliases=(${^${${(0)"$(_call_program aliases "git config -z --get-regexp '^alias.'")"}#alias.}/$'\n'/:alias for \'}\') + local -a aliases + __git_extract_aliases _describe -t aliases alias aliases $* } -(( $+functions[__git_aliases_and_commands] )) || -__git_aliases_and_commands () { - _alternative \ - 'aliases::__git_aliases' \ - 'commands::_git_commands' +(( $+functions[__git_extract_aliases] )) || +__git_extract_aliases () { + aliases=(${^${${(0)"$(_call_program aliases "git config -z --get-regexp '^alias.'")"}#alias.}/$'\n'/:alias for \'}\') } (( $+functions[__git_date_formats] )) || @@ -6073,7 +6102,7 @@ _git() { aliases=(${(f)${${${(f)"$(_call_program aliases git config --get-regexp '\^alias\.')"}#alias.}/ /$'\n'}/(#e)/$'\n'}) (( $#aliases % 2 == 0 )) && git_aliases=($aliases) - if [[ -n ${git_aliases[$words[2]]} ]] ; then + if (( $+git_aliases[$words[2]] && !$+commands[git-$words[2]] )); then local -a tmpwords expalias expalias=(${(z)git_aliases[$words[2]]}) tmpwords=(${words[1]} ${expalias}) @@ -6114,14 +6143,14 @@ _git() { case $state in (command) - __git_aliases_and_commands && ret=0 + _git_commands && ret=0 ;; (option-or-argument) curcontext=${curcontext%:*:*}:git-$words[1]: - if (( ${+functions[_git-$words[1]]} )); then + if (( $+functions[_git-$words[1]] )); then _call_function ret _git-$words[1] - elif zstyle -T ":completion:${curcontext}:" use-fallback; then + elif zstyle -T :completion:$curcontext: use-fallback; then _files && ret=0 else _message 'unknown sub-command' @@ -6135,42 +6164,30 @@ _git() { return ret } -# Handle add-on completions. Say you got a third party add-on `foo'. What you -# want to do is write your completion as `_git-foo' and this code will pick it -# up. That should be a regular compsys function, which starts like this: -# -# #compdef git-foo -# -# In addition to what compinit does, this also reads the second line of the -# completion. If that matches "#desc:*" the part behind "#desc:" will be used -# as the addon's description. Like this: -# -# #desc:checks git's foobar value -local addon input i desc -typeset -gUa _git_third_party -for addon in ${^fpath}/_git-*~*~(.N); do - if [[ -n ${(M)_git_third_party:#${${addon:t}#_git-}*} ]]; then - # This makes sure only the first _git-foo in $fpath gets read. - continue - fi - # Read the second line of the file. - i=1 - desc= - while read input; do - if (( i == 2 )); then - desc=$input - break - fi - (( i++ )) - done < $addon - # Setup `$desc' appropriately. - if [[ $desc != '#desc:'* ]]; then - desc= - else - desc=${desc#\#desc} +# Load any _git-* definitions so that they may be completed as commands. +declare -gUa _git_third_party_commands +_git_third_party_commands=() + +local file +for file in ${^fpath}/_git-*~(*~|*.zwc)(.N); do + local name=${${file:t}#_git-} + if (( $+_git_third_party_commands[$name] )); then + continue + fi + + local desc= + integer i=1 + while read input; do + if (( i == 2 )); then + if [[ $input == '#description '* ]]; then + desc=:${input#\#description } + fi + break fi - # Add the addon's completion. - _git_third_party+=( ${${addon:t}#_git-}$desc ) + (( i++ )) + done < $file + + _git_third_party_commands+=$name$desc done _git -- cgit v1.2.3 From ed5e4106fdacc81798973f269a4688d40eb3db2a Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 6 Sep 2011 16:24:20 +0000 Subject: 29733: Jonathan: add apt-get changelog completion. --- ChangeLog | 5 ++++- Completion/Debian/Command/_apt | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Completion/Debian/Command') diff --git a/ChangeLog b/ChangeLog index 06abc71a5..2c0dd4700 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,9 @@ * 29741: Completion/Zsh/Command/_zattr: add ret=0, fix filename globbing like in 27658 for _zip. + * 29733: Jonathan Kolberg: Completion/Debian/Command/_apt: add + completion for apt-get changelog. + 2011-09-05 Barton E. Schaefer * users/16302: Completion/Unix/Type/_path_files: pattern matching @@ -15380,5 +15383,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5458 $ +* $Revision: 1.5459 $ ***************************************************** diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt index 3200fc9ac..b51b2fc74 100644 --- a/Completion/Debian/Command/_apt +++ b/Completion/Debian/Command/_apt @@ -433,6 +433,7 @@ _apt-get () { /$'dselect-upgrade\0'/ \| \ /$'clean\0'/ \| \ /$'autoclean\0'/ \| \ + /$'changelog\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \ /$'check\0'/ \| \ /$'source\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \ /$'build-dep\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \ @@ -440,7 +441,7 @@ _apt-get () { /$'help\0/' \| \ /$'markauto\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \ /$'unmarkauto\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \ - /"[]"/ ':argument-1::compadd "$expl_action[@]" update upgrade install remove purge dist-upgrade dselect-upgrade clean autoclean check source build-dep autoremove help markauto unmarkauto' + /"[]"/ ':argument-1::compadd "$expl_action[@]" update upgrade install remove purge dist-upgrade dselect-upgrade clean autoclean changelog check source build-dep autoremove help markauto unmarkauto' _apt-get () { local expl_action expl_packages -- cgit v1.2.3 From 01778d160a16fcc5a76a14d3b6392a154e515dc7 Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Sat, 10 Sep 2011 22:28:00 +0000 Subject: 29762: bts completion tag update from Ansgar Burchardt. --- ChangeLog | 7 ++++++- Completion/Debian/Command/_bts | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'Completion/Debian/Command') diff --git a/ChangeLog b/ChangeLog index 980e311d4..c822e58c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-09-10 Clint Adams + + * 29762: Completion/Debian/Command/_bts: bts completion tag + update from Ansgar Burchardt. + 2011-09-10 Barton E. Schaefer * 29760: Completion/compaudit: declare _i_ulwdirs and make sure @@ -15403,5 +15408,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5464 $ +* $Revision: 1.5465 $ ***************************************************** diff --git a/Completion/Debian/Command/_bts b/Completion/Debian/Command/_bts index 8ef1530c7..4907d15c1 100644 --- a/Completion/Debian/Command/_bts +++ b/Completion/Debian/Command/_bts @@ -85,16 +85,18 @@ case "$words[1]" in _wanted operator expl 'operator' compadd - '+' '-' '=' elif [[ CURRENT -eq 4 ]]; then _wanted tag expl 'tag' \ - compadd patch wontfix moreinfo unreproducible fixed security \ - potato woody sid help pending upstream lfs sarge experimental \ - sarge-ignore d-i confirmed ipv6 fixed-in-experimental \ - fixed-upstream + compadd patch wontfix moreinfo unreproducible help pending \ + fixed security upstream confirmed fixed-upstream \ + fixed-in-experimental d-i ipv6 lfs l10n potato woody sarge \ + sarge-ignore etch etch-ignore lenny lenny-ignore squeeze \ + squeeze-ignore wheezy wheezy-ignore sid experimental else _wanted tag expl 'tag' \ - compadd patch wontfix moreinfo unreproducible fixed security \ - potato woody sid help pending upstream lfs sarge experimental \ - sarge-ignore d-i confirmed ipv6 fixed-in-experimental \ - fixed-upstream + compadd patch wontfix moreinfo unreproducible help pending \ + fixed security upstream confirmed fixed-upstream \ + fixed-in-experimental d-i ipv6 lfs l10n potato woody sarge \ + sarge-ignore etch etch-ignore lenny lenny-ignore squeeze \ + squeeze-ignore wheezy wheezy-ignore sid experimental _wanted sep expl 'separator' compadd -S ' ' , . fi ;; -- cgit v1.2.3