diff options
| author | Jeff Carr <[email protected]> | 2024-12-23 11:15:16 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-23 11:15:16 -0600 |
| commit | c5fcb2a6c05293cd6e14b3bd1e91237013508d44 (patch) | |
| tree | c8fee2b5bf4ba790b14edab2638f418936260323 /windowMain.go | |
| parent | b7a6001ba450de82e1aa216410f236f516f50a17 (diff) | |
start work on an apply patchset window
Diffstat (limited to 'windowMain.go')
| -rw-r--r-- | windowMain.go | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/windowMain.go b/windowMain.go new file mode 100644 index 0000000..5f7a71b --- /dev/null +++ b/windowMain.go @@ -0,0 +1,91 @@ +package main + +import ( + "os" + "os/user" + "path/filepath" + + "go.wit.com/gui" + "go.wit.com/lib/gadgets" + "go.wit.com/lib/gui/shell" + "go.wit.com/log" +) + +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 { + if me.autoDryRun.Checked() { + log.Warn("RUN --dry-run", fullpath, cmd) + return false + } else { + log.Warn("RUN:", fullpath, cmd) + } + + result := shell.PathRun(fullpath, cmd) + if result.Error != nil { + log.Warn("quickCmd() cmd =", cmd) + log.Warn("quickCmd() err =", result.Error) + log.Warn("quickCmd() b =", result.Exit) + log.Warn("quickCmd() output =", result.Stdout) + return false + } else if result.Exit != 0 { + log.Warn("quickCmd() b =", result.Exit) + log.Warn("quickCmd() output =", result.Stdout) + return true + } + log.Warn("quickCmd() output = ", result.Stdout) + return true +} + +func globalBuildOptions(vbox *gui.Node) { + group1 := vbox.NewGroup("Forge Settings") + grid := group1.NewGrid("buildOptions", 0, 0) + + // me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)") + me.userHomePwd = gadgets.NewOneLiner(grid, "user home") + grid.NextRow() + me.goSrcPwd = gadgets.NewOneLiner(grid, "go src home") + grid.NextRow() + + usr, _ := user.Current() + homeDir, err := os.UserHomeDir() + if err != nil { + log.Warn("Error getting home directory:", err) + homeDir = "/home/autotypist" + } + me.userHomePwd.SetText(homeDir) + srcDir := filepath.Join(homeDir, "go/src") + me.goSrcPwd.SetText(srcDir) + + // select the branch you want to test, build and develop against + // this lets you select your user branch, but, when you are happy + // you can merge everything into the devel branch and make sure it actually + // works. Then, when that is good, merge and version everything in master + me.setBranchB = grid.NewButton("set current branch to:", func() { + targetName := me.newBranch.String() + log.Warn("setting all branches to", targetName) + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() + repo.Status.CheckoutBranch(targetName) + repo.Scan() + } + }) + me.newBranch = grid.NewCombobox() + me.newBranch.AddText("master") + me.newBranch.AddText("devel") + me.newBranch.AddText(usr.Username) + me.newBranch.SetText(usr.Username) + + // checking this will automatically make the branches off of devel + me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true) + grid.NextRow() +} |
