diff options
Diffstat (limited to 'parse.go')
| -rw-r--r-- | parse.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -168,6 +168,7 @@ type Parser struct { config Config version string description string + match func() bool epilogue string // the following field changes during processing of command line arguments @@ -190,6 +191,12 @@ type Described interface { Description() string } +// will let the application provide matches for autocomplete +type Matched interface { + // the application should return true if it's happy with itself + Match() bool +} + // Epilogued is the interface that the destination struct should implement to // add an epilogue string at the bottom of the help message. type Epilogued interface { @@ -300,6 +307,9 @@ func NewParser(config Config, dests ...interface{}) (*Parser, error) { if dest, ok := dest.(Described); ok { p.description = dest.Description() } + if dest, ok := dest.(Matched); ok { + p.match = dest.Match + } if dest, ok := dest.(Epilogued); ok { p.epilogue = dest.Epilogue() } |
