diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-05-28 11:17:08 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-05-28 11:17:08 -0700 |
| commit | 7a40196328b5dc94da846cb8354e605508180faf (patch) | |
| tree | 4364b3c05d200faf61c168f4fdd032a21285ce9e /contrib/completion/git-completion.bash | |
| parent | 6e95dce712f1ec7cda64faf9348ff2daf903f538 (diff) | |
| parent | 5dd5007f8936f8d37cf95119e83039bd9237a3c5 (diff) | |
| download | git-7a40196328b5dc94da846cb8354e605508180faf.tar.gz | |
Merge branch 'ps/complete-config-w-subcommands'
The command line completion script (in contrib/) has been adjusted
to the recent update to "git config" that adopted subcommand based
UI.
* ps/complete-config-w-subcommands:
completion: adapt git-config(1) to complete subcommands
Diffstat (limited to 'contrib/completion/git-completion.bash')
| -rw-r--r-- | contrib/completion/git-completion.bash | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 5c0ddeb3d4..60a22d619a 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2989,22 +2989,42 @@ __git_complete_config_variable_name_and_value () _git_config () { - case "$prev" in - --get|--get-all|--unset|--unset-all) - __gitcomp_nl "$(__git_config_get_set_variables)" + local subcommands subcommand + + __git_resolve_builtins "config" + + subcommands="$___git_resolved_builtins" + subcommand="$(__git_find_subcommand "$subcommands")" + + if [ -z "$subcommand" ] + then + __gitcomp "$subcommands" return - ;; - *.*) - __git_complete_config_variable_value + fi + + case "$cur" in + --*) + __gitcomp_builtin "config_$subcommand" return ;; esac - case "$cur" in - --*) - __gitcomp_builtin config + + case "$subcommand" in + get) + __gitcomp_nl "$(__git_config_get_set_variables)" ;; - *) - __git_complete_config_variable_name + set) + case "$prev" in + *.*) + __git_complete_config_variable_value + ;; + *) + __git_complete_config_variable_name + ;; + esac + ;; + unset) + __gitcomp_nl "$(__git_config_get_set_variables)" ;; esac } |
