Skip to content

Commit

Permalink
allow subcommand_path to match even with flags
Browse files Browse the repository at this point in the history
With the old version flags between subcommands
weren't allowed (as it was doing exact match).
This solution is still not perfect (as it uses '.+')
and could potentially swallow other subcommands.
  • Loading branch information
0robustus1 committed May 22, 2019
1 parent 01850df commit 8edc57e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fish_completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ function __fish_%s_no_subcommand --description 'Test if %s has yet to be given t
return 0
end
function __fish_%s_seen_subcommand_path --description 'Test whether the full path of subcommands is the current path'
set -l cmd (commandline -opc)
set -e cmd[1]
return (test (string trim -- "$argv") = (string trim -- "$cmd"))
set -l cmd (commandline -opc)
set -e cmd[1]
set -l pattern (string replace -a " " ".+" "$argv")
string match -r "$pattern" (string trim -- "$cmd")
end
# borrowed from current fish-shell master, since it is not in current 2.7.1 release
function __fish_seen_argument
Expand Down

0 comments on commit 8edc57e

Please sign in to comment.