From a72d983788e44cccdaa0f7310f8350355e7c32b3 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 29 Oct 2025 02:47:50 -0500 Subject: new argv --- complete.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/complete.go b/complete.go index 07147d2..265890d 100644 --- a/complete.go +++ b/complete.go @@ -17,34 +17,34 @@ var APPNAME string = "go-mod-clean" func (a args) Description() string { return ` -go-mod-clean will try to verify your go.* files are using the newest package versions +go-mod-clean helps forge with the publishing of GO packages -* Recreate go.* with 'go mod init' and 'go mod tidy' -* Set your required go in go.mod (default is go1.21 -* Check that the most recent master branch versions are used -* Try to trim go.sum of non-existent entries + * Recreate go.* with 'go mod init' and 'go mod tidy' + * Check that the most recent master branch versions are used + * can trim go.sum of non-existent entries ` } func (args) MustParse() error { - me.pp = arg.MustParse(&argv) + me.pp = arg.MustParseArgv(&argv) return nil } // sends the strings to bash or zsh that will be your options func (a args) DoAutoComplete() error { + var err error + me.pp, err = arg.ParseFlagsArgv(&argv) + if err != nil { + fmt.Fprintf(argvpb.Stddbg, "go-args parseFlagsArgv(%v) finished autocomplete\n", err) + } + return err +} + +func (args) Match() bool { if argvpb.PB.GetCmd() == "" { matches := []string{"strict", "--restore", "purge", "lax", "--version"} fmt.Fprintf(argvpb.Stdout, " %s", strings.Join(matches, " ")) - return nil - } - var err error - if me.pp == nil { - me.pp, err = arg.ParseFlagsArgv(&argv) - if err != nil { - return err - } + return true } - err = me.pp.WriteHelpForAutocomplete(argvpb.PB.Partial, argvpb.PB.Real...) - return err + return false } -- cgit v1.2.3