summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-19 13:17:34 -0500
committerJeff Carr <[email protected]>2025-10-19 13:17:34 -0500
commit81c1f68da6c63dfca51ac381a334d5900d5307a7 (patch)
tree658d4ea86e210096db6c50a7df8a5c44c7c027d8
parent4c9525596db4ee50f6b0cdcc4f694cd0feca8eac (diff)
fix more wrong stuff
-rw-r--r--Makefile2
-rw-r--r--doGit.go13
-rw-r--r--doTest.go32
3 files changed, 29 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index fd0c1bb..eb2075c 100644
--- a/Makefile
+++ b/Makefile
@@ -70,6 +70,8 @@ deb-with-commits:
rm -f ~/incoming/*.deb
forge commit --all
forge normal
+ wit build install
+ wit test version
wit build deb --force
deb-with-commits-all:
diff --git a/doGit.go b/doGit.go
index 1bd2cd6..5240643 100644
--- a/doGit.go
+++ b/doGit.go
@@ -10,6 +10,7 @@ import (
"path/filepath"
"strings"
+ "github.com/go-cmd/cmd"
"go.wit.com/lib/fhelp"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/gitpb"
@@ -36,13 +37,15 @@ func doGitCreate(namespace string) (string, error) {
return s, err
}
-func runCommand(cmd []string) (string, error) {
- var err error
- s := log.Sprintf("cmd= %v ", cmd)
+func runCommand(cmds []string) (string, error) {
+ var r cmd.Status
+ // var err error
+ s := log.Sprintf("cmd= %v ", cmds)
+ log.Info("GOING TO RUN?", s)
if fhelp.QuestionUser("Run " + s + " here") {
- _, err = shell.RunVerbose(cmd)
+ r = shell.Run(cmds)
}
- return "Ran " + s, err
+ return "Ran " + s, r.Error
}
func doGit() (string, error) {
diff --git a/doTest.go b/doTest.go
index 1247d94..c7610a7 100644
--- a/doTest.go
+++ b/doTest.go
@@ -8,6 +8,7 @@ import (
"strings"
"github.com/go-cmd/cmd"
+ "go.wit.com/lib/cobol"
"go.wit.com/lib/config"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
@@ -31,6 +32,7 @@ func doTest() (string, error) {
log.Info(s, err)
return s, config.ErrEmpty
}
+ var allver string
for _, line := range strings.Split(string(data), "\n") {
line := strings.TrimSpace(line)
if line == "" {
@@ -60,9 +62,12 @@ func doTest() (string, error) {
}
if argv.Test.Version != nil {
// log.Info("LINE=", cmdname)
- allerr = errors.Join(allerr, doTestVersion(cmdname))
+ s, err := doTestVersion(cmdname)
+ allver += s + "\n"
+ allerr = errors.Join(allerr, err)
}
}
+ cobol.DumbTable(allver)
if allerr != nil {
log.Printf("ALLERR=(%v)\n", allerr)
return "version tests failed", allerr
@@ -90,39 +95,40 @@ func versionStderr(cmdname string, r *cmd.Status) error {
return stderr
}
-func doTestVersion(cmdname string) error {
+func doTestVersion(cmdname string) (string, error) {
+ var good string
r := shell.Run([]string{cmdname, "--version"})
if r.Exit != 0 {
- return versionStderr(cmdname, &r)
+ return good, versionStderr(cmdname, &r)
}
if r.Error != nil {
- return versionStderr(cmdname, &r)
+ return good, versionStderr(cmdname, &r)
}
if len(r.Stdout) == 0 {
- return versionStderr(cmdname, &r)
+ return good, versionStderr(cmdname, &r)
}
if len(r.Stdout) == 1 {
line := r.Stdout[0]
if !strings.HasPrefix(line, cmdname) {
- return versionStderr(cmdname, &r)
+ return good, versionStderr(cmdname, &r)
}
- log.Info(line)
// probably okay
- return nil
+ good = line
+ return good, nil
}
if len(r.Stdout) == 2 {
line := r.Stdout[0]
if !strings.HasPrefix(line, "APPNAME=") {
- return versionStderr(cmdname, &r)
+ return good, versionStderr(cmdname, &r)
}
line = r.Stdout[1]
if !strings.HasPrefix(line, cmdname) {
- return versionStderr(cmdname, &r)
+ return good, versionStderr(cmdname, &r)
}
- log.Info(line)
// probably okay
- return nil
+ good = line
+ return good, nil
}
- return versionStderr(cmdname, &r)
+ return good, versionStderr(cmdname, &r)
}