diff options
| author | Alex Dadgar <[email protected]> | 2017-08-23 13:58:31 -0700 |
|---|---|---|
| committer | Alex Dadgar <[email protected]> | 2017-08-23 13:58:31 -0700 |
| commit | d3c10410d6ceaf0874b5a646f02c88170be33d4c (patch) | |
| tree | 939f15bbcc1fdc41140f7918fc865fa7735cdf08 /command.go | |
| parent | f4461a52b6329c11190f11fe3384ec8aa964e21c (diff) | |
Fix a subcommand matching
This PR fixes an issue where a subcommand matches the current set of
commands being examined. Fixes issue
https://github.com/posener/complete/issues/46
Diffstat (limited to 'command.go')
| -rw-r--r-- | command.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -74,6 +74,12 @@ func (c *Command) predict(a Args) (options []string, only bool) { return } } + + // We matched so stop searching. Continuing to search can accidentally + // match a subcommand with current set of commands, see issue #46. + if subCommandFound { + break + } } // if last completed word is a global flag that we need to complete |
