2024-01-30 13:52:27 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"go.wit.com/lib/gui/repostatus"
|
2024-02-09 11:50:16 -06:00
|
|
|
"go.wit.com/log"
|
2024-01-30 13:52:27 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
func doesExist(path string) bool {
|
|
|
|
if _, err := os.Stat(path); err != nil {
|
|
|
|
if os.IsNotExist(err) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
// only errors on bad errors
|
|
|
|
func quickCmd(fullpath string, cmd []string) bool {
|
|
|
|
var err error
|
|
|
|
var b bool
|
|
|
|
var output string
|
|
|
|
|
|
|
|
if me.autoWorkingPwd.String() != fullpath {
|
|
|
|
me.autoWorkingPwd.SetValue(fullpath)
|
|
|
|
}
|
|
|
|
|
|
|
|
if me.autoDryRun.Checked() {
|
|
|
|
log.Warn("RUN --dry-run", fullpath, cmd)
|
|
|
|
return false
|
|
|
|
} else {
|
|
|
|
log.Warn("RUN:", fullpath, cmd)
|
|
|
|
}
|
|
|
|
|
|
|
|
err, b, output = repostatus.RunCmd(fullpath, cmd)
|
|
|
|
if err != nil {
|
|
|
|
log.Warn("cmd =", cmd)
|
|
|
|
log.Warn("err =", err)
|
|
|
|
log.Warn("b =", b)
|
|
|
|
log.Warn("output =", string(output))
|
|
|
|
return false
|
|
|
|
} else if !b {
|
|
|
|
log.Warn("b =", b)
|
|
|
|
log.Warn("output =", string(output))
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
log.Warn("output = ", string(output))
|
|
|
|
return true
|
|
|
|
}
|