diff options
Diffstat (limited to 'summaryBox.go')
| -rw-r--r-- | summaryBox.go | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/summaryBox.go b/summaryBox.go new file mode 100644 index 0000000..3bf0cd5 --- /dev/null +++ b/summaryBox.go @@ -0,0 +1,57 @@ +// This is a simple example +package main + +import ( + "fmt" + "os" + "path/filepath" + + "go.wit.com/gui" + "go.wit.com/lib/gui/shell" + "go.wit.com/log" + // "go.wit.com/gui/gadgets" +) + +func summaryBox(box *gui.Node) { + group1 := box.NewGroup("Repository Summary") + grid := group1.RawGrid() + + grid.NewButton("Show Repository Window", func() { + globalDisplaySetRepoState() + // reposwin.Toggle() + }) + + grid.NewButton("open docs (localhost:8080)", func() { + me.autotypistWindow.Disable() + defer me.autotypistWindow.Enable() + + goSrcDir := me.goSrcPwd.String() + filename := filepath.Join(goSrcDir, "go.work") + + f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0600) + if err != nil { + return + } + defer f.Close() + fmt.Fprintln(f, "go 1.21.4") + fmt.Fprintln(f, "") + fmt.Fprintln(f, "use (") + for _, repo := range me.allrepos { + if repo.status.Exists("go.mod") { + fmt.Fprintln(f, "\t"+repo.String()) + } else { + log.Info("missing go.mod for", repo.String()) + repo.status.MakeRedomod() + } + } + fmt.Fprintln(f, ")") + tmp := me.userHomePwd.String() + tmpDir := filepath.Join(tmp, "go/src") + os.Chdir(tmpDir) + pkgsite := filepath.Join(tmp, "go/bin", "pkgsite") + os.Unsetenv("GO111MODULE") + go shell.Run([]string{pkgsite}) + shell.Run([]string{"ping", "-c", "3", "git.wit.org"}) + shell.OpenBrowser("http://localhost:8080") + }) +} |
