diff options
| author | Jeff Carr <[email protected]> | 2024-01-30 13:52:27 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-30 13:52:27 -0600 |
| commit | 9d7620df62adf0c35f27b0304cace077f8a9a7ad (patch) | |
| tree | dd8d83ceaa30f03bdde20bea8550bb0dd4113df1 /quickCmd.go | |
| parent | 0ca10f55534c057c651d136c89d096224a6f6461 (diff) | |
more code cleanup
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'quickCmd.go')
| -rw-r--r-- | quickCmd.go | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/quickCmd.go b/quickCmd.go new file mode 100644 index 0000000..2f250af --- /dev/null +++ b/quickCmd.go @@ -0,0 +1,52 @@ +// This is a simple example +package main + +import ( + "os" + + "go.wit.com/log" + + "go.wit.com/lib/gui/repostatus" +) + +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 +} |
