From 5d2788edbc203fdb3b99d073e507962cb0f0e6ac Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 14 Oct 2025 04:11:53 -0500 Subject: killed erronous output on error --- theMagicOfAutocomplete.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/theMagicOfAutocomplete.go b/theMagicOfAutocomplete.go index eadffb6..1eeedd1 100644 --- a/theMagicOfAutocomplete.go +++ b/theMagicOfAutocomplete.go @@ -6,6 +6,7 @@ package prep import ( "errors" "os" + "strings" "time" "go.wit.com/dev/alexflint/arg" @@ -120,14 +121,22 @@ func Autocomplete(dest any) *Auto { if s == "--autodebug" { continue } + if strings.TrimSpace(s) == "" { + // skip anything blank + continue + } flags = append(flags, s) } // use go-args to parse the structs so we can use them here myAuto.pp, err = arg.ParseFlags(flags, dest) - if err != nil { - // users has command line arguments that won't parse with go-args - pb.Debugf("DEBUG: Parse error: %v flags(%v)", err, flags) + if len(flags) == 0 { + // error is normal if there are no command line args + } else { + if err != nil { + // users has command line arguments that won't parse with go-args + pb.Debugf("DEBUG: Parse error: %v flags%v", err, flags) + } } if myAuto.pp == nil { -- cgit v1.2.3