diff options
| author | Jeff Carr <[email protected]> | 2025-10-19 04:45:20 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-19 04:45:20 -0500 | 
| commit | 7698e54f512f95991d1c9a441d300300db29ea4a (patch) | |
| tree | 97a802304942622fa9a0a8473e35dea717aec078 | |
| parent | f9a62d1c3aeb9e99214cc16a664705d9a517fac3 (diff) | |
minor tweaks
| -rw-r--r-- | argv.struct.go | 3 | ||||
| -rw-r--r-- | argv.template.go | 2 | ||||
| -rw-r--r-- | doTest.go | 46 | ||||
| -rw-r--r-- | resources/TESTVERSION | 1 | 
4 files changed, 32 insertions, 20 deletions
diff --git a/argv.struct.go b/argv.struct.go index ae0d1f9..ce2e56a 100644 --- a/argv.struct.go +++ b/argv.struct.go @@ -48,7 +48,8 @@ type DropletCmd struct {  }  type TestCmd struct { -	Version *EmptyCmd `arg:"subcommand:version"         help:"clean out stuff and power off vm"` +	Version *EmptyCmd `arg:"subcommand:version"         help:"test with cmd --version"` +	Copy    bool      `arg:"--copy"                        help:"re-copy argv.template.go"`  }  type LinuxCmd struct { diff --git a/argv.template.go b/argv.template.go index 5ac7060..e7a9948 100644 --- a/argv.template.go +++ b/argv.template.go @@ -63,7 +63,7 @@ func (args) InitGui() error {  func (args) Exit() {  	gui.UnloadToolkits() -	if argv.Verbose { +	if me.argv.Verbose() {  		log.Info("argv.Exit() called", APPNAME+".Exit()")  	}  	// remove this from the template for your app (or make one for youself if you need it) @@ -15,11 +15,12 @@ import (  func doTest() (string, error) {  	var s string -	var err error +	var allerr error + +	initForge()  	if argv.Test.Version != nil { -		var data []byte -		data, err = resources.ReadFile("resources/TESTVERSION") +		data, err := resources.ReadFile("resources/TESTVERSION")  		if err != nil {  			s = "open repomap failed"  			log.Info(s, err) @@ -30,7 +31,6 @@ func doTest() (string, error) {  			log.Info(s, err)  			return s, config.ErrEmpty  		} -		var broken string  		for _, line := range strings.Split(string(data), "\n") {  			line := strings.TrimSpace(line)  			if line == "" { @@ -38,23 +38,33 @@ func doTest() (string, error) {  			}  			parts := strings.Fields(line)  			cmdname := parts[len(parts)-1] -			log.Info("LINE=", cmdname) -			r := shell.Run([]string{cmdname, "--version"}) -			if r.Error != nil { -				return cmdname + " version test failed", r.Error -			} -			if len(r.Stdout) != 1 { -				for _, line := range r.Stderr { -					log.Info("STDERR:", line) -				} -				for _, line := range r.Stdout { -					log.Info("STDOUT:", line) +			if argv.Test.Copy { +				// find cmdname repo +				for repo := range me.forge.IterByMode() { +					if !strings.HasPrefix(repo.Namespace, "go.wit.com") { +						continue +					} +					if !strings.HasSuffix(repo.Namespace, cmdname) { +						continue +					} +					if cmdname == "forge" { +						continue +					} +					if cmdname == "autogenpb" { +						continue +					} +					cmd := []string{"cp", "-f", "argv.template.go", repo.FullPath + "/"} +					shell.RunVerbose(cmd)  				} -				broken += cmdname + " " +				continue +			} +			if argv.Test.Version != nil { +				log.Info("LINE=", cmdname) +				allerr = errors.Join(allerr, doTestVersion(cmdname))  			}  		} -		if broken != "" { -			return "version tests failed", errors.New(broken) +		if allerr != nil { +			return "version tests failed", allerr  		}  		return "all version tests passed", nil  	} diff --git a/resources/TESTVERSION b/resources/TESTVERSION index 92bb4ed..77d6291 100644 --- a/resources/TESTVERSION +++ b/resources/TESTVERSION @@ -1,3 +1,4 @@ +-rwxr-xr-x 1 jcarr jcarr  19014488 Oct 18 11:15 autogenpb  -rwxr-xr-x 1 jcarr jcarr  19014488 Oct 18 11:15 basicwindow  -rwxr-xr-x 1 jcarr jcarr  24416080 Oct 18 11:13 forge  -rwxr-xr-x 1 jcarr jcarr  24309824 Oct 18 11:11 wit  | 
