completions/git: fix completions for "git config"

We don't provide completions on "git config " because we require
"fish_is_nth_token 3". Confusingly, fish_is_nth_token only counts
tokens *before* the cursor, so 2 is the right number here.

While at it, fix a typo and delete an unused completion entry (it
ran conditional on __fish_is_first_arg, which is always false for a
git subcommand).
This commit is contained in:
Johannes Altmanninger 2021-12-27 14:23:57 +01:00
parent 2e6bfe5c68
commit ee3a26d849

View File

@ -2076,9 +2076,8 @@ complete -F -c git -n '__fish_git_using_command config' -s f -l file -d 'Read co
complete -F -c git -n '__fish_git_using_command config' -l blob -d 'Read config from blob' -r
# If no argument is specified, it's as if --get was used
# Use -k with `__fish_git_config_keys` so that user defined valeus are shown first
complete -c git -n '__fish_git_using_command config; and fish_is_nth_token 3' -kfa '(__fish_git_config_keys)'
complete -f -c git -n '__fish_git_using_command config; and __fish_is_first_arg' -l get -d 'Get config with name' -kra '(__fish_git_config_keys)'
# Use -k with `__fish_git_config_keys` so that user defined values are shown first
complete -c git -n '__fish_git_using_command config; and fish_is_nth_token 2' -kfa '(__fish_git_config_keys)'
complete -f -c git -n '__fish_git_using_command config' -l get -d 'Get config with name' -kra '(__fish_git_config_keys)'
complete -f -c git -n '__fish_git_using_command config' -l get-all -d 'Get all values matching key' -ka '(__fish_git_config_keys)'
complete -f -c git -n '__fish_git_using_command config' -l get-urlmatch -d 'Get value specific for the section url' -r