add a 'docs' section box
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
6c595d32f7
commit
464dcfa28e
|
@ -10,7 +10,6 @@ import (
|
|||
"go.wit.com/lib/gui/gowit"
|
||||
"go.wit.com/lib/gui/logsettings"
|
||||
"go.wit.com/log"
|
||||
// "go.wit.com/gui/gadgets"
|
||||
)
|
||||
|
||||
func globalDisplaySetRepoState() {
|
||||
|
|
1
main.go
1
main.go
|
@ -26,6 +26,7 @@ func main() {
|
|||
|
||||
vbox1 := box.NewVerticalBox("BOX1")
|
||||
globalDisplayOptions(vbox1)
|
||||
docsBox(vbox1)
|
||||
if debugger.ArgDebug() {
|
||||
debuggerBox(vbox1)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
)
|
||||
|
||||
func docsBox(vbox *gui.Node) {
|
||||
group := vbox.NewGroup("Docs")
|
||||
|
||||
group.NewButton("make 'go.work' file", func() {
|
||||
me.autotypistWindow.Disable()
|
||||
|
||||
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, ")")
|
||||
|
||||
me.autotypistWindow.Enable()
|
||||
})
|
||||
|
||||
group.NewButton("run pkgsite", func() {
|
||||
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"})
|
||||
})
|
||||
|
||||
group.NewButton("send docs to browser (localhost:8080)", func() {
|
||||
me.autotypistWindow.Disable()
|
||||
defer me.autotypistWindow.Enable()
|
||||
|
||||
shell.OpenBrowser("http://localhost:8080")
|
||||
})
|
||||
}
|
|
@ -1,19 +1,13 @@
|
|||
// This is a simple example
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/log"
|
||||
// "go.wit.com/gui/gadgets"
|
||||
)
|
||||
|
||||
type develSummary struct {
|
||||
|
@ -46,39 +40,6 @@ func summaryBox(box *gui.Node) *develSummary {
|
|||
}
|
||||
})
|
||||
|
||||
s.docsB = s.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")
|
||||
})
|
||||
s.grid.NextRow()
|
||||
|
||||
s.totalOL = gadgets.NewOneLiner(s.grid, "Total")
|
||||
|
@ -116,7 +77,11 @@ func (s *develSummary) Update() {
|
|||
s.allp = make([]*patch, 0, 0)
|
||||
s.allp = append(s.allp, allp...)
|
||||
}
|
||||
if dirty == 0 {
|
||||
s.totalPatchesOL.SetText(strconv.Itoa(p) + " patches")
|
||||
} else {
|
||||
s.totalPatchesOL.SetText(strconv.Itoa(p) + " patches + ? dirty")
|
||||
}
|
||||
}
|
||||
|
||||
type patch struct {
|
||||
|
|
Loading…
Reference in New Issue