From afcf7f87aa8f35ca2fe69c54373d28788ba03f84 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 18 Jan 2024 13:46:25 -0600 Subject: [PATCH] cmd shortcut to ignore errors Signed-off-by: Jeff Carr --- .gitignore | 1 + globalBuildOptions.go | 40 ++++++++++++++++++++++++++++++++++++++++ globalResetOptions.go | 23 ----------------------- 3 files changed, 41 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 96dab88..508415e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*.swp /resources/*.so myrepos autotypist diff --git a/globalBuildOptions.go b/globalBuildOptions.go index 39bc467..db6e676 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -21,6 +21,25 @@ func doesExist(path string) bool { return true } +// only errors on bad errors +func quickCmd(fullpath string, cmd []string) bool { + var err error + var b bool + var output string + + cmd = []string{"mkdir", "-p", "go.wit.com/apps/"} + if err != nil { + err, b, output = repostatus.RunCmd(fullpath, cmd) + log.Error(err, b, string(output)) + return false + } else if ! b { + log.Error(err, b, string(output)) + return true + } + log.Warn("output = ", string(output)) + return true +} + func globalBuildOptions(box *gui.Node) { var setCurrentBranch *gui.Node group1 := box.NewGroup("Global Build Options") @@ -53,6 +72,27 @@ func globalBuildOptions(box *gui.Node) { setCurrentBranch.Set("set all branches to " + me.toMoveToBranch) me.mainBranch.Disable() } + + groupvbox.NewButton("rebuild autotypist", func() { + fullpath := "/home/jcarr/go/src" + quickCmd(fullpath, []string{"mkdir", "-p", "go.wit.com/apps/"}) + + fullpath = "/home/jcarr/go/src/go.wit.com/apps/autotypist" + cmd := []string{"go", "get", "-v", "-u", "go.wit.com/apps/autotypist"} + err, b, output := repostatus.RunCmd(fullpath, cmd) + log.Warn(err, b, string(output)) + + cmd = []string{"go", "get", "-v", "-u", "go.wit.com/toolkits/debian"} + err, b, output = repostatus.RunCmd(fullpath, cmd) + log.Warn(err, b, string(output)) + + fullpath = "/home/jcarr/go/src/go.wit.com/toolkits/debian" + + cmd = []string{"make"} + err, b, output = repostatus.RunCmd(fullpath, cmd) + log.Warn(err, b, string(output)) + }) + me.rerunGoMod = groupvbox.NewButton("re-run go mod & go tidy", func() { me.rerunGoMod.Disable() log.Warn("scanning allrepos") diff --git a/globalResetOptions.go b/globalResetOptions.go index 61e6a0c..bd2f61a 100644 --- a/globalResetOptions.go +++ b/globalResetOptions.go @@ -70,29 +70,6 @@ func globalResetOptions(box *gui.Node) { setGitCommands() }) - buildOptions.NewLabel("rebuild autotypist") - buildOptions.NewButton("go get", func() { - var newCmds [][]string - newCmds = append(newCmds, []string{"cd", "."}) - newCmds = append(newCmds, []string{"mkdir", "-p", "go/src/go.wit.com/apps/"}) - newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/"}) - newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "go.wit.com/apps/autotypist"}) - newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/autotypist"}) - newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "."}) - newCmds = append(newCmds, []string{"go", "get", "-v", "go.wit.com/gui/toolkits"}) - newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/gui/toolkits/andlabs"}) - newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "."}) - newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/gui/toolkits/gocui"}) - newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "."}) - newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/gui/toolkits"}) - newCmds = append(newCmds, []string{"make"}) - newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/myrepos"}) - newCmds = append(newCmds, []string{"make"}) - me.script = newCmds - setGitCommands() - doit.Enable() - }) - buildOptions.NewSeparator("endStatusScans") buildOptions.NewSeparator("endStatusScans")