* PATCH: _git: support for user-specific sub commands
@ 2010-03-04 15:45 Frank Terbeck
2010-03-04 15:52 ` Nikolai Weibull
0 siblings, 1 reply; 3+ messages in thread
From: Frank Terbeck @ 2010-03-04 15:45 UTC (permalink / raw)
To: zsh-workers; +Cc: Nikolai Weibull
Someone asked for this on IRC.
Documentation included on top of the _git file. This also changes one
':completion:${curcontext}:' to ":completion:${curcontext}:" (single
versus double quotes), which I believe is right.
Would you agree, Nikolai?
Regards, Frank
---
Completion/Unix/Command/_git | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index c87593e..d7570cc 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1,5 +1,25 @@
#compdef git git-cvsserver git-receive-pack git-upload-archive git-upload-pack git-shell
+# Some parts of this completion's behaviour are configurable:
+#
+# 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<tab>" to complete that sub
+# commands name for you. You can make that sub-command know to the completion
+# via the user-command style:
+#
+# % zstyle ':completion:*:*:git:*' user-commands foo:'description for foo'
+#
+# `user-commands' is a list style, so you can add any number of programs there.
+# The :description part is optional, so you could add all git-* programs from
+# your $path like this:
+#
+# % 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.
+
+# TODO: There is still undocumented configurability in here.
+
# TODO: All if (( words[(I)-option] )) should be turned into
# if (( words[(I)-option] > 0 && words[(I)-option] < CURRENT )), as the user
# may go back and want to add an option before -option and in that case should
@@ -304,7 +324,9 @@ _git_commands () {
'upload-pack:command invoked by clone-pack and fetch-pack')
local wanted_commands
- zstyle -s ':completion:${curcontext}:' commands wanted_commands || wanted_commands="all -internal"
+ zstyle -s ":completion:${curcontext}:" commands wanted_commands || wanted_commands="all -internal"
+ local -a user_commands
+ zstyle -a ":completion:${curcontext}:" user-commands user_commands || user_commands=()
local -aU unique_wanted_commands
unique_wanted_commands=($=wanted_commands)
@@ -339,6 +361,7 @@ _git_commands () {
commands+=($internal_commands) ;;
esac
done
+ commands+=( $user_commands )
_describe -t commands 'git command' commands && ret=0
}
--
1.7.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: _git: support for user-specific sub commands
2010-03-04 15:45 PATCH: _git: support for user-specific sub commands Frank Terbeck
@ 2010-03-04 15:52 ` Nikolai Weibull
2010-03-04 16:20 ` Frank Terbeck
0 siblings, 1 reply; 3+ messages in thread
From: Nikolai Weibull @ 2010-03-04 15:52 UTC (permalink / raw)
To: Frank Terbeck; +Cc: zsh-workers
On Thu, Mar 4, 2010 at 16:45, Frank Terbeck <ft@bewatermyfriend.org> wrote:
> Documentation included on top of the _git file.
Nice.
> This also changes one
> ':completion:${curcontext}:' to ":completion:${curcontext}:" (single
> versus double quotes), which I believe is right.
Was this still not fixed? I thought this had made the rounds a couple
of times at least :-/.
> Would you agree, Nikolai?
Yes, this all seems right.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: _git: support for user-specific sub commands
2010-03-04 15:52 ` Nikolai Weibull
@ 2010-03-04 16:20 ` Frank Terbeck
0 siblings, 0 replies; 3+ messages in thread
From: Frank Terbeck @ 2010-03-04 16:20 UTC (permalink / raw)
To: Nikolai Weibull; +Cc: zsh-workers
Nikolai Weibull wrote:
> On Thu, Mar 4, 2010 at 16:45, Frank Terbeck <ft@bewatermyfriend.org> wrote:
[...]
>> This also changes one
>> ':completion:${curcontext}:' to ":completion:${curcontext}:" (single
>> versus double quotes), which I believe is right.
>
> Was this still not fixed? I thought this had made the rounds a couple
> of times at least :-/.
>
>> Would you agree, Nikolai?
>
> Yes, this all seems right.
Okay, I've committed this.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-03-04 16:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-04 15:45 PATCH: _git: support for user-specific sub commands Frank Terbeck
2010-03-04 15:52 ` Nikolai Weibull
2010-03-04 16:20 ` Frank Terbeck
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).