summaryrefslogtreecommitdiff
path: root/quickCmd.go
diff options
context:
space:
mode:
Diffstat (limited to 'quickCmd.go')
-rw-r--r--quickCmd.go52
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
+}