summaryrefslogtreecommitdiff
path: root/viewTempWindow.go
diff options
context:
space:
mode:
Diffstat (limited to 'viewTempWindow.go')
-rw-r--r--viewTempWindow.go62
1 files changed, 61 insertions, 1 deletions
diff --git a/viewTempWindow.go b/viewTempWindow.go
index 1d66992..cdd1080 100644
--- a/viewTempWindow.go
+++ b/viewTempWindow.go
@@ -1,6 +1,9 @@
package repolist
-import "go.wit.com/gui"
+import (
+ "go.wit.com/gui"
+ "go.wit.com/log"
+)
// This creates a view of the repos
// you can only have one at this point
@@ -29,3 +32,60 @@ func TempWindowView(parent *gui.Node) *RepoList {
tmp.duration = me.blind.NewLabel("duration")
return tmp
}
+
+func (r *RepoList) ShowRepo(repo *RepoRow) error {
+ // this is the gui grid. all the widgets get added here
+ // at the end we tell the grid go to NextRow()
+ grid := r.reposgrid
+
+ // make a new row of gui widgets
+ newRow := new(RepoRow)
+ newRow.Status = repo.Status
+
+ newRow.pLabel = grid.NewLabel(repo.Status.Path())
+ newRow.targetV = grid.NewLabel(repo.Status.GetTargetVersion())
+ newRow.lastTag = grid.NewLabel(repo.Status.LastTag())
+
+ newRow.currentName = grid.NewLabel(repo.Status.GetCurrentBranchName())
+ newRow.currentVersion = grid.NewLabel(repo.Status.GetCurrentVersion())
+
+ newRow.gitState = grid.NewLabel(repo.Status.GitState())
+ newRow.masterVersion = grid.NewLabel(repo.Status.GetMasterVersion())
+ newRow.develVersion = grid.NewLabel(repo.Status.GetDevelVersion())
+ newRow.userVersion = grid.NewLabel(repo.Status.GetUserVersion())
+
+ newRow.endBox = grid.NewHorizontalBox("HBOX")
+ newRow.endBox.NewButton("Repo Window", func() {
+ newRow.Status.Toggle()
+ })
+
+ newRow.endBox.NewButton("show diff", func() {
+ log.Log(REPOWARN, "show diff currentName =", newRow.currentName.String())
+ log.Log(REPOWARN, "show diff masterVersion =", newRow.masterVersion.String())
+ // newRow.Status.XtermNohup([]string{"git diff"})
+ newRow.Status.Xterm("git diff; bash")
+ })
+
+ newRow.endBox.NewButton("commit all", func() {
+ if !newRow.Status.IsUserBranch() {
+ log.Log(REPOWARN, "can not commit on non user branch")
+ return
+ }
+ // restore anything staged so everything can be reviewed
+ newRow.Status.RunCmd([]string{"git", "restore", "--staged", "."})
+ newRow.Status.XtermWait("git diff")
+ newRow.Status.XtermWait("git add --all")
+ newRow.Status.XtermWait("git commit -a")
+ newRow.Status.XtermWait("git push")
+ if newRow.Status.CheckDirty() {
+ // commit was not done, restore diff
+ newRow.Status.RunCmd([]string{"git", "restore", "--staged", "."})
+ } else {
+ newRow.NewScan()
+ }
+ })
+
+ newRow.hidden = false
+ r.reposgrid.NextRow()
+ return nil
+}