Skip to content

Commit 6b7c45e

Browse files
rohiebgitster
authored andcommitted
completion: add docs on how to add subcommand completions
Signed-off-by: Roland Hieber <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d13a295 commit 6b7c45e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

contrib/completion/git-completion.bash

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
# Note that "git" is optional --- '!f() { : commit; ...}; f' would complete
3232
# just like the 'git commit' command.
3333
#
34+
# To add completion for git subcommands that are implemented in external
35+
# scripts, define a function of the form '_git_${subcommand}' while replacing
36+
# all dashes with underscores, and the main git completion will make use of it.
37+
# For example, to add completion for 'git do-stuff' (which could e.g. live
38+
# in /usr/bin/git-do-stuff), name the completion function '_git_do_stuff'.
39+
# See _git_show, _git_bisect etc. below for more examples.
40+
#
3441
# If you have a shell command that is not part of git (and is not called as a
3542
# git subcommand), but you would still like git-style completion for it, use
3643
# __git_complete. For example, to use the same completion as for 'git log' also

0 commit comments

Comments
 (0)