[git completions] Minor cleanup

This commit is contained in:
Fabian Homborg 2018-03-13 13:45:37 +01:00
parent bc976a913c
commit 4057cfdce5

View file

@ -171,7 +171,7 @@ function __fish_git_ranges
return 0 return 0
end end
set -l to (set -q both[2]; and echo $both[2]) set -l to $both[2]
# Remove description from the from-ref, not the to-ref. # Remove description from the from-ref, not the to-ref.
for from_ref in (__fish_git_refs | string match "$from" | string replace -r \t'.*$' '') for from_ref in (__fish_git_refs | string match "$from" | string replace -r \t'.*$' '')
for to_ref in (__fish_git_refs | string match "*$to*") # if $to is empty, this correctly matches everything for to_ref in (__fish_git_refs | string match "*$to*") # if $to is empty, this correctly matches everything
@ -182,10 +182,8 @@ end
function __fish_git_needs_command function __fish_git_needs_command
set cmd (commandline -opc) set cmd (commandline -opc)
if [ (count $cmd) -eq 1 ]
return 0
else
set -l skip_next 1 set -l skip_next 1
set -q cmd[2]; or return 0
# Skip first word because it's "git" or a wrapper # Skip first word because it's "git" or a wrapper
for c in $cmd[2..-1] for c in $cmd[2..-1]
test $skip_next -eq 0 test $skip_next -eq 0
@ -213,8 +211,6 @@ function __fish_git_needs_command
end end
return 0 return 0
end end
return 1
end
# HACK: Aliases # HACK: Aliases
@ -906,8 +902,7 @@ complete -f -c git -n '__fish_git_using_command tag' -s v -l verify -d 'Verify s
complete -f -c git -n '__fish_git_using_command tag' -s f -l force -d 'Force overwriting exising tag' complete -f -c git -n '__fish_git_using_command tag' -s f -l force -d 'Force overwriting exising tag'
complete -f -c git -n '__fish_git_using_command tag' -s l -l list -d 'List tags' complete -f -c git -n '__fish_git_using_command tag' -s l -l list -d 'List tags'
complete -f -c git -n '__fish_git_using_command tag' -l contains -xa '(__fish_git_commits)' -d 'List tags that contain a commit' complete -f -c git -n '__fish_git_using_command tag' -l contains -xa '(__fish_git_commits)' -d 'List tags that contain a commit'
complete -f -c git -n '__fish_git_using_command tag; and __fish_contains_opt -s d' -a '(__fish_git_tags)' -d 'Tag' complete -f -c git -n '__fish_git_using_command tag; and __fish_contains_opt -s d delete -s v verify' -a '(__fish_git_tags)' -d 'Tag'
complete -f -c git -n '__fish_git_using_command tag; and __fish_contains_opt -s v' -a '(__fish_git_tags)' -d 'Tag'
# TODO options # TODO options
### stash ### stash