completion: introduce __git_find_subcommand
commit3fec482b5f7f2f13c7465cf79062440a84233d14
authorRubén Justo <rjusto@gmail.com>
Sat, 2 Mar 2024 15:51:08 +0000 (2 16:51 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 Mar 2024 22:21:38 +0000 (3 14:21 -0800)
tree7d2afc6f9f98a324dc209b4bca866203ef6c273a
parentc689c38bc2dceac3f8fe975472f12c0dbe473537
completion: introduce __git_find_subcommand

Let's have a function to get the current subcommand when completing
commands that follow the syntax:

    git <command> <subcommand>

As a convenience, let's allow an optional "default subcommand" to be
returned if none is found.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash