Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Use helper functions for git completion in my own completions

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.

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.


Messages sorted by: Reverse Date, Date, Thread, Author