From ed5857af77edb5a8369fc0a9fb4e93c282fa5664 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 7 Feb 2024 15:24:59 -0600 Subject: [PATCH] trying to debug box direction Signed-off-by: Jeff Carr --- Makefile | 6 +++++- args.go | 30 ++++++++++++++++++++++++++ main.go | 5 +++++ repolist.go | 62 +++++++++++++++++++++++++++++------------------------ 4 files changed, 74 insertions(+), 29 deletions(-) create mode 100644 args.go diff --git a/Makefile b/Makefile index 4d90029..e6b74bf 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,11 @@ stderr: build goimports: goimports -w *.go # // to globally reset paths: - # // gofmt -w -r "go.wit.com/gui -> go.wit.com/gui/gui" . + # // gofmt -w -r '"go.wit.com/gui/gadgets" -> "go.wit.com/lib/gadgets"' *.go + +gocui: build + reset + ./autotypist --gui gocui --tmp-log build: echo "build it!" diff --git a/args.go b/args.go new file mode 100644 index 0000000..0f45f70 --- /dev/null +++ b/args.go @@ -0,0 +1,30 @@ +package main + +/* + this parses the command line arguements + + this enables command line options from other packages like 'gui' and 'log' +*/ + +import ( + "go.wit.com/dev/alexflint/arg" + "go.wit.com/lib/debugger" + "go.wit.com/log" +) + + // GadgetDisplay string `arg:"env:DISPLAY"` + // GadgetTmpLog bool `arg:"--tmp-log" help:"automatically send STDOUT to /tmp"` + // GadgetVerboseDNS bool `arg:"--verbose" help:"debug your dns settings"` +var args struct { + TmpLog bool `arg:"--tmp-log" help:"automatically send STDOUT to /tmp"` +} + +func init() { + arg.MustParse(&args) + + if debugger.ArgDebug() { + log.Info("cmd line --debugger == true") + } else { + log.Info("cmd line --debugger == false") + } +} diff --git a/main.go b/main.go index 7e60afd..753013d 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,11 @@ func main() { me = new(autoType) me.allrepos = make(map[string]*repo) + if args.TmpLog { + // send all log() output to a file in /tmp + log.SetTmp() + } + me.myGui = gui.New() me.myGui.InitEmbed(resToolkit) // me.myGui.LoadToolkit("nocui") diff --git a/repolist.go b/repolist.go index c99e97f..ab1aa5f 100644 --- a/repolist.go +++ b/repolist.go @@ -197,41 +197,47 @@ func repolistWindow() { func repoAllButtons(box *gui.Node) { // reposbox.SetExpand(false) group1 := box.NewGroup("Run on all repos:") - grid1 := group1.NewGrid("test", 6, 1) - grid1.NewButton("merge all user to devel", func() { - reposwin.Disable() - if !mergeAllUserToDevel() { - return - } - reposwin.Enable() - }) + hbox := group1.Box() + // hbox.Horizontal() + hbox.Vertical() - grid1.NewButton("merge all devel to main", func() { - reposwin.Disable() - if !mergeAllDevelToMain() { - return - } - reposwin.Enable() - }) - - grid1.NewButton("merge it all", func() { - reposwin.Disable() - if !mergeAllUserToDevel() { - return - } - if !mergeAllDevelToMain() { - return - } - reposwin.Enable() - }) - - grid1.NewButton("status.Update() all", func() { + box1 := hbox.Box().Vertical() + box1.NewButton("status.Update() all", func() { for _, repo := range me.allrepos { repo.status.Update() repo.newScan() } }) + + box2 := hbox.Box().Vertical() + box2.NewButton("merge all user to devel", func() { + reposwin.Disable() + if !mergeAllUserToDevel() { + return + } + reposwin.Enable() + }) + + box2.NewButton("merge all devel to main", func() { + reposwin.Disable() + if !mergeAllDevelToMain() { + return + } + reposwin.Enable() + }) + + box2.NewButton("merge it all", func() { + reposwin.Disable() + if !mergeAllUserToDevel() { + return + } + if !mergeAllDevelToMain() { + return + } + reposwin.Enable() + }) + } func mergeAllDevelToMain() bool {