* Use helper functions for git completion in my own completions
@ 2011-10-18 12:10 Ansgar Burchardt
2011-10-18 14:58 ` Julien Nicoulaud
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ansgar Burchardt @ 2011-10-18 12:10 UTC (permalink / raw)
To: zsh-users
Hi,
is it possible to use the helper functions defined in "_git" for the git
command in my own completion functions?
I am taking my first steps with writing completions for the
git-import-dsc, git-import-orig commands in Debian, but am not surehow I
can make sure helper functions such as __git_branch_names are available
when I user "git-import-dsc" (they are available when I use "git
import-dsc").
Regards,
Ansgar
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Use helper functions for git completion in my own completions
2011-10-18 12:10 Use helper functions for git completion in my own completions Ansgar Burchardt
@ 2011-10-18 14:58 ` Julien Nicoulaud
2011-10-18 18:50 ` Oliver Kiddle
2011-10-18 20:05 ` Benjamin R. Haskell
2 siblings, 0 replies; 5+ messages in thread
From: Julien Nicoulaud @ 2011-10-18 14:58 UTC (permalink / raw)
To: zsh-users
[-- Attachment #1: Type: text/plain, Size: 524 bytes --]
May be _dispatch could do it ?
2011/10/18 Ansgar Burchardt <ansgar@43-1.org>
> Hi,
>
> is it possible to use the helper functions defined in "_git" for the git
> command in my own completion functions?
>
> I am taking my first steps with writing completions for the
> git-import-dsc, git-import-orig commands in Debian, but am not surehow I
> can make sure helper functions such as __git_branch_names are available
> when I user "git-import-dsc" (they are available when I use "git
> import-dsc").
>
> Regards,
> Ansgar
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Use helper functions for git completion in my own completions
2011-10-18 12:10 Use helper functions for git completion in my own completions Ansgar Burchardt
2011-10-18 14:58 ` Julien Nicoulaud
@ 2011-10-18 18:50 ` Oliver Kiddle
2011-10-18 20:05 ` Benjamin R. Haskell
2 siblings, 0 replies; 5+ messages in thread
From: Oliver Kiddle @ 2011-10-18 18:50 UTC (permalink / raw)
To: zsh-users
Ansgar Burchardt wrote:
> is it possible to use the helper functions defined in "_git" for the git
> command in my own completion functions?
It seems to work if you modify $words in _git-import-dsc, call _git
and rely on it calling you back. As follows:
#compdef git-import-dsc
if [[ $words[1] = git-* ]]; then
words=( ${=words[1]/-/ } ${words[2,-1]} )
_git "$@"
return
fi
The rest of your function can then follow on here and everything in _git
should be defined.
Oliver
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Use helper functions for git completion in my own completions
2011-10-18 12:10 Use helper functions for git completion in my own completions Ansgar Burchardt
2011-10-18 14:58 ` Julien Nicoulaud
2011-10-18 18:50 ` Oliver Kiddle
@ 2011-10-18 20:05 ` Benjamin R. Haskell
2011-10-18 20:28 ` Nikolai Weibull
2 siblings, 1 reply; 5+ messages in thread
From: Benjamin R. Haskell @ 2011-10-18 20:05 UTC (permalink / raw)
To: zsh-users
On Tue, 18 Oct 2011, Ansgar Burchardt wrote:
> Hi,
>
> is it possible to use the helper functions defined in "_git" for the
> git command in my own completion functions?
Yes, though with the recent(-ish) rewrite (and in general), I'm not sure
there's really a stable API.
E.g. if __git_pattern_escape isn't needed by _git anymore, I suspect it
would simply disappear. As would __git_commits2, or whatnot.
> I am taking my first steps with writing completions for the
> git-import-dsc, git-import-orig commands in Debian, but am not surehow
> I can make sure helper functions such as __git_branch_names are
> available when I user "git-import-dsc" (they are available when I use
> "git import-dsc").
If you create the _git-{command-name} function (e.g. _git-import-dsc),
it will be used by _git (at least by the version of _git I'm currently
using). By virtue of being used from within _git, all of the helper
functions will exist, because they're defined when _git is autoloaded.
--
Best,
Ben
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Use helper functions for git completion in my own completions
2011-10-18 20:05 ` Benjamin R. Haskell
@ 2011-10-18 20:28 ` Nikolai Weibull
0 siblings, 0 replies; 5+ messages in thread
From: Nikolai Weibull @ 2011-10-18 20:28 UTC (permalink / raw)
To: Benjamin R. Haskell; +Cc: zsh-users
On Tue, Oct 18, 2011 at 22:05, Benjamin R. Haskell <zsh@benizi.com> wrote:
> On Tue, 18 Oct 2011, Ansgar Burchardt wrote:
>> is it possible to use the helper functions defined in "_git" for the git
>> command in my own completion functions?
>
> Yes, though with the recent(-ish) rewrite (and in general), I'm not sure
> there's really a stable API.
>
> E.g. if __git_pattern_escape isn't needed by _git anymore, I suspect it
> would simply disappear. As would __git_commits2, or whatnot.
Yes. The helpers are still in need of a clean-up. I have a rather
sizable todo-list still, but preciously little time.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-18 20:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-18 12:10 Use helper functions for git completion in my own completions Ansgar Burchardt
2011-10-18 14:58 ` Julien Nicoulaud
2011-10-18 18:50 ` Oliver Kiddle
2011-10-18 20:05 ` Benjamin R. Haskell
2011-10-18 20:28 ` Nikolai Weibull
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).