summaryrefslogtreecommitdiff
path: root/command.go
diff options
context:
space:
mode:
Diffstat (limited to 'command.go')
-rw-r--r--command.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/command.go b/command.go
index 253f8e7..7bc0fc5 100644
--- a/command.go
+++ b/command.go
@@ -2,13 +2,13 @@ package complete
type Commands map[string]Command
-type Flags map[string]Predicate
+type Flags map[string]*Predicate
type Command struct {
Name string
Sub Commands
Flags Flags
- Args Predicate
+ Args *Predicate
}
// options returns all available complete options for the given command
@@ -20,7 +20,7 @@ func (c *Command) options(args []string) (options []Option, only bool) {
// if prev has something that needs to follow it,
// it is the most relevant completion
- if predicate, ok := c.Flags[last(args)]; ok && !predicate.ExpectsNothing {
+ if predicate, ok := c.Flags[last(args)]; ok && predicate != nil {
return predicate.predict(), true
}
@@ -41,9 +41,7 @@ func (c *Command) options(args []string) (options []Option, only bool) {
}
// add additional expected argument of the command
- if !c.Args.ExpectsNothing {
- options = append(options, c.Args.predict()...)
- }
+ options = append(options, c.Args.predict()...)
return
}