mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 02:13:38 +08:00
Teach git completion about difftool. Change __fish_git_ranges to output branches as designed.
This commit is contained in:
parent
5ed5d637b8
commit
5cebd3abf7
|
@ -18,13 +18,13 @@ function __fish_git_remotes
|
|||
end
|
||||
|
||||
function __fish_git_ranges
|
||||
set from (commandline -ot | perl -ne 'my @parts = split(/\.\./); print $parts[0]')
|
||||
set to (commandline -ot | perl -ne 'my @parts = split(/\.\./); print $parts[1]')
|
||||
if [ "$from" = "" ]
|
||||
set -l from (commandline -ot | perl -ne 'if (index($_, "..") > 0) { my @parts = split(/\.\./); print $parts[0]; }')
|
||||
if test -z "$from"
|
||||
__fish_git_branches
|
||||
return 0
|
||||
end
|
||||
|
||||
set -l to (commandline -ot | perl -ne 'if (index($_, "..") > 0) { my @parts = split(/\.\./); print $parts[1]; }')
|
||||
for from_ref in (__fish_git_heads | grep -e "$from")
|
||||
for to_ref in (__fish_git_heads | grep -e "$to")
|
||||
printf "%s..%s\n" $from_ref $to_ref
|
||||
|
@ -146,6 +146,13 @@ complete -c git -n '__fish_git_using_command diff' -a '(__fish_git_ranges)' -d '
|
|||
complete -c git -n '__fish_git_using_command diff' -l cached -d 'Show diff of changes in the index'
|
||||
# TODO options
|
||||
|
||||
### difftool
|
||||
complete -c git -n '__fish_git_needs_command' -a difftool -d 'Open diffs in a visual tool'
|
||||
complete -c git -n '__fish_git_using_command difftool' -a '(__fish_git_ranges)' -d 'Branch'
|
||||
complete -c git -n '__fish_git_using_command difftool' -l cached -d 'Visually show diff of changes in the index'
|
||||
# TODO options
|
||||
|
||||
|
||||
### grep
|
||||
complete -c git -n '__fish_git_needs_command' -a grep -d 'Print lines matching a pattern'
|
||||
# TODO options
|
||||
|
|
Loading…
Reference in New Issue
Block a user