2024-01-15 08:11:08 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.wit.com/log"
|
2024-01-18 00:58:14 -06:00
|
|
|
"strings"
|
2024-01-15 08:11:08 -06:00
|
|
|
|
2024-01-18 00:58:14 -06:00
|
|
|
"go.wit.com/lib/gui/repostatus"
|
2024-01-15 08:11:08 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
var repopath string = "/home/jcarr/"
|
|
|
|
|
2024-01-15 13:53:44 -06:00
|
|
|
// if dryRun == true, then it just prints out the values
|
|
|
|
// but doesn't do anything
|
|
|
|
func goMake(dryRun string) bool {
|
2024-01-15 12:43:08 -06:00
|
|
|
var workingPath string = "go/src"
|
2024-01-16 04:46:17 -06:00
|
|
|
for _, line := range me.script {
|
2024-01-15 12:43:08 -06:00
|
|
|
if len(line) == 0 {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
if line[0] == "cd" {
|
2024-01-18 00:58:14 -06:00
|
|
|
switch len(line) {
|
2024-01-15 12:43:08 -06:00
|
|
|
case 1:
|
2024-01-18 00:58:14 -06:00
|
|
|
log.Verbose("do cmdPwd() to go root", repopath+"go/src")
|
2024-01-15 12:43:08 -06:00
|
|
|
workingPath = ""
|
|
|
|
case 2:
|
|
|
|
log.Verbose("do cmdPwd() here", line)
|
|
|
|
workingPath = line[1]
|
|
|
|
default:
|
|
|
|
log.Warn("bad cd", line)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
cmd := line[0]
|
|
|
|
s := strings.Join(line[1:], " ")
|
|
|
|
path := repopath + workingPath
|
2024-01-15 23:24:33 -06:00
|
|
|
log.Warn("NEED TO RUN path =", path, "cmd =", cmd, s)
|
2024-01-15 13:53:44 -06:00
|
|
|
if dryRun == "--dry-run" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
if dryRun == "--doit" {
|
2024-01-15 23:24:33 -06:00
|
|
|
log.Warn("Actually RUN path =", path, "cmd =", cmd, s)
|
2024-01-16 04:46:17 -06:00
|
|
|
err, b, output := repostatus.RunCmd(path, line)
|
2024-01-15 13:53:44 -06:00
|
|
|
if err != nil {
|
|
|
|
log.Info("ABEND EXECUTION")
|
|
|
|
log.Info("error =", err)
|
|
|
|
log.Info("b =", b)
|
|
|
|
log.Info("output =", output)
|
|
|
|
return false
|
|
|
|
}
|
2024-01-16 04:46:17 -06:00
|
|
|
// log.Warn("output was =", output)
|
2024-01-15 13:53:44 -06:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
log.Warn("don't know what to do. dryRun ==", dryRun)
|
|
|
|
return false
|
2024-01-15 12:43:08 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2024-01-16 04:46:17 -06:00
|
|
|
func setGitCommands() {
|
|
|
|
var tmp []string
|
|
|
|
// convert to displayable to the user text
|
|
|
|
for _, line := range me.script {
|
|
|
|
s := strings.Join(line, " ")
|
|
|
|
log.Warn("s =", s)
|
|
|
|
tmp = append(tmp, s)
|
|
|
|
}
|
|
|
|
cmds.Set(strings.Join(tmp, "\n"))
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
func runCommandsOld() bool {
|
|
|
|
for _, line := range me.script {
|
2024-01-15 08:11:08 -06:00
|
|
|
s := strings.Join(line, " ")
|
|
|
|
log.Warn("NEED TO RUN:", s)
|
|
|
|
err, b, output := repostatus.RunCmd(repopath, line)
|
|
|
|
if err != nil {
|
|
|
|
log.Warn("ABEND EXECUTION")
|
|
|
|
log.Warn("error =", err)
|
|
|
|
log.Warn("output =", output)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
log.Warn("Returned with b =", b)
|
|
|
|
log.Warn("output was =", output)
|
|
|
|
log.Warn("RUN DONE")
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
2024-01-16 04:46:17 -06:00
|
|
|
*/
|