compiles and runs, gui is borked

This commit is contained in:
Jeff Carr 2024-11-29 22:22:16 -06:00
parent c0a5055793
commit 6b8cd96636
7 changed files with 18 additions and 85 deletions

View File

@ -56,6 +56,7 @@ redomod:
rm -f go.*
GO111MODULE= go mod init
GO111MODULE= go mod tidy
go mod edit -go=1.20
curl-help:
curl --silent http://localhost:9419/help

View File

@ -1,27 +0,0 @@
package main
// this initializes the repos
import (
"strings"
"go.wit.com/lib/gui/repostatus"
"go.wit.com/log"
)
func (r *repoWindow) initRepoList() {
r.View.InitRepoList(".config/autotypist")
if myargv.OnlyMe {
log.Info("not scanning everything")
} else {
log.Info("scanning everything in ~/go/src")
for i, path := range repostatus.ListGitDirectories() {
// log.Info("addRepo()", i, path)
path = strings.TrimPrefix(path, me.goSrcPwd.String())
path = strings.Trim(path, "/")
log.Info("addRepo()", i, path)
r.View.NewRepo(path)
}
}
}

12
main.go
View File

@ -2,8 +2,11 @@ package main
import (
"embed"
"os"
"go.wit.com/lib/debugger"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/gui/repolist"
"go.wit.com/log"
"go.wit.com/gui"
@ -18,7 +21,10 @@ var myargv argv
func main() {
me = new(autoType)
standardMachineInit()
// load the ~/.config/forge/ config
me.forge = forgepb.Init()
me.forge.ConfigPrintTable()
os.Setenv("REPO_WORK_PATH", me.forge.GetGoSrc())
log.DaemonMode(false)
me.myGui = gui.New()
@ -50,8 +56,8 @@ func main() {
me.repos = makeRepoView()
// parse config file and scan for .git repos
me.repos.initRepoList()
me.repos.View = repolist.Init(me.forge, me.myGui)
me.repos.View.Enable()
// reads in the State of all the repos
// TODO: should not really be necessary directly after init()

View File

View File

@ -56,12 +56,14 @@ func makeRepoView() *repoWindow {
r.topbox = r.repoMenu()
/*
r.View = repolist.AutotypistView(r.box)
showncount := r.View.MirrorShownCount()
r.topbox.Append(showncount)
duration := r.View.MirrorScanDuration()
r.topbox.Append(duration)
*/
return r
}

View File

@ -1,45 +0,0 @@
package main
import (
"os"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/log"
)
// does a standard forgepb & zoopb init
func standardMachineInit() {
var err error
me.forge.Init()
me.forge.ConfigPrintTable()
// load the ~/.config/forge/ machine file from zoopb
if err = me.machine.ConfigLoad(); err != nil {
log.Warn("zoopb.ConfigLoad() failed", err)
os.Exit(-1)
}
me.machine.InitWit()
// list all packages from mirrors.wit.com
/*
loop := me.machine.Wit.SortByName()
for loop.Scan() {
p := loop.Package()
log.Info("package:", p.Name, p.Version, p.PkgName)
}
*/
// use ~/go/src unless we find a go.work file in a parent directory
if me.goSrcPath, err = forgepb.FindGoSrc(); err != nil {
log.Info(err)
os.Exit(-1)
}
// this ENV value is used by the repolist and repostatus packages
if me.goSrcPath != "" {
os.Setenv("REPO_WORK_PATH", me.goSrcPath)
}
}

View File

@ -4,7 +4,6 @@ import (
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/zoopb"
)
var me *autoType
@ -20,14 +19,11 @@ func (b *autoType) Enable() {
// this app's variables
type autoType struct {
// your customized repo preferences and settings
forge forgepb.Forge
forge *forgepb.Forge
// where your ~/go/src is
goSrcPath string
// use zookeeper to get the list of installed packages
machine zoopb.Machine
// allrepos map[string]*repo
myGui *gui.Node