From ad6d1a1e535a489ce5e9e602d07ac4c03d753f80 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 28 Oct 2025 05:30:12 -0500 Subject: rm junk. add Match() --- parse.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'parse.go') diff --git a/parse.go b/parse.go index 4c47316..cc2161e 100644 --- a/parse.go +++ b/parse.go @@ -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() } -- cgit v1.2.3