From 0e83fccb13f0c7d84fe6db01565d5c6a876d7320 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 28 Oct 2025 05:29:55 -0500 Subject: implement simple match() func --- complete.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/complete.go b/complete.go index 1bd4366..a1968bf 100644 --- a/complete.go +++ b/complete.go @@ -80,6 +80,27 @@ func (args) Examples() string { return out } +func (args) Match() bool { + if argvpb.PB.IsMatch("cache") { + matches, _ := matchCacheFiles() + fmt.Fprintf(argvpb.Stdout, "%s", matches) + return true + } + + if argvpb.PB.IsMatch("mode.--config") { + matches, _ := matchModeDirs() + fmt.Fprintf(argvpb.Stdout, "%s", matches) + return true + } + + if argvpb.PB.IsMatch("mode") { + matches := []string{"jwc", "false"} + fmt.Fprintf(argvpb.Stdout, "%s", " "+strings.Join(matches, " ")) + return true + } + return false +} + // sends the strings to bash or zsh that will be your options func (a args) DoAutoComplete() error { var err error -- cgit v1.2.3