diff options
author | Fabian Homborg <FHomborg@gmail.com> | 2016-05-11 14:56:36 +0200 |
---|---|---|
committer | Fabian Homborg <FHomborg@gmail.com> | 2016-05-11 15:03:04 +0200 |
commit | 76d24aa1bc423d906167470bf3b68e9c1ef0ea91 (patch) | |
tree | dc7be3693fdb4ac9a4326241b0a65920f0cbac76 /share/completions | |
parent | a7605d584b91e0caf7fa5454dbd3fa1e4204dc7e (diff) |
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.
Diffstat (limited to 'share/completions')
-rw-r--r-- | share/completions/git.fish | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/share/completions/git.fish b/share/completions/git.fish index ac4d8249..e2c53251 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -94,6 +94,7 @@ function __fish_git_needs_command return 1 # We assume that any other token that's not an argument to a general option is a command case "*" + echo $c return 1 end end @@ -103,19 +104,14 @@ function __fish_git_needs_command end function __fish_git_using_command - set cmd (commandline -opc) - if [ (count $cmd) -gt 1 ] - if [ $argv[1] = $cmd[2] ] - return 0 - end + set -l cmd (__fish_git_needs_command) + test -z "$cmd"; and return 1 + contains -- $cmd $argv; and return 0 # aliased command - set -l aliased (command git config --get "alias.$cmd[2]" ^ /dev/null | string split " ") - if [ $argv[1] = "$aliased[1]" ] - return 0 - end - end - return 1 + set -l aliased (command git config --get "alias.$cmd" ^/dev/null | string split " ") + contains -- "$aliased[1]" $argv; and return 0 + return 1 end function __fish_git_stash_using_command |