diff options
| author | Eyal Posener <[email protected]> | 2017-05-06 19:47:27 +0300 |
|---|---|---|
| committer | Eyal Posener <[email protected]> | 2017-05-06 19:51:33 +0300 |
| commit | dc4c327ae8cd5602ae10eeabde9bdf6fa5624286 (patch) | |
| tree | 8ebacce9b6e90c650a0f0557426b5526abfe0705 /command.go | |
| parent | 60345dc6db8d1247fef2fb456d2f18f3300651ac (diff) | |
Use local completion files and directories according to typed command
Diffstat (limited to 'command.go')
| -rw-r--r-- | command.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -17,11 +17,11 @@ func (c *Command) options(args []string) (options []Option, only bool) { // remove the first argument, which is the command name args = args[1:] - + last := last(args) // if prev has something that needs to follow it, // it is the most relevant completion - if predicate, ok := c.Flags[last(args)]; ok && predicate != nil { - return predicate.predict(), true + if predicate, ok := c.Flags[last]; ok && predicate != nil { + return predicate.predict(last), true } sub, options, only := c.searchSub(args) @@ -41,7 +41,7 @@ func (c *Command) options(args []string) (options []Option, only bool) { } // add additional expected argument of the command - options = append(options, c.Args.predict()...) + options = append(options, c.Args.predict(last)...) return } |
