mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-04 07:06:39 +08:00
git completion: Allow more than one arg to using_command
Now we can easily add an option to multiple commmands. This should also fix some edgecases.
This commit is contained in:
parent
a7605d584b
commit
76d24aa1bc
@ -94,6 +94,7 @@ function __fish_git_needs_command
|
|||||||
return 1
|
return 1
|
||||||
# We assume that any other token that's not an argument to a general option is a command
|
# We assume that any other token that's not an argument to a general option is a command
|
||||||
case "*"
|
case "*"
|
||||||
|
echo $c
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -103,19 +104,14 @@ function __fish_git_needs_command
|
|||||||
end
|
end
|
||||||
|
|
||||||
function __fish_git_using_command
|
function __fish_git_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (__fish_git_needs_command)
|
||||||
if [ (count $cmd) -gt 1 ]
|
test -z "$cmd"; and return 1
|
||||||
if [ $argv[1] = $cmd[2] ]
|
contains -- $cmd $argv; and return 0
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
# aliased command
|
# aliased command
|
||||||
set -l aliased (command git config --get "alias.$cmd[2]" ^ /dev/null | string split " ")
|
set -l aliased (command git config --get "alias.$cmd" ^/dev/null | string split " ")
|
||||||
if [ $argv[1] = "$aliased[1]" ]
|
contains -- "$aliased[1]" $argv; and return 0
|
||||||
return 0
|
return 1
|
||||||
end
|
|
||||||
end
|
|
||||||
return 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_git_stash_using_command
|
function __fish_git_stash_using_command
|
||||||
|
Loading…
x
Reference in New Issue
Block a user