make a simple way to enable the debugger

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-12 08:27:39 -06:00
parent 6188281dda
commit 66694c1a09
3 changed files with 34 additions and 7 deletions

View File

@ -1,11 +1,12 @@
all: all:
go build -v -x GO111MODULE=off go build -v -x
./helloworld ./helloworld
push: gocui:
git add --all ./helloworld --gui gocui >/tmp/helloworld.stdout 2>&1
git commit -a
git push goimports:
goimports -w *.go
redomod: redomod:
rm -f go.* rm -f go.*

26
debugger.go Normal file
View File

@ -0,0 +1,26 @@
package main
/*
enables GUI options and the debugger in your application
*/
import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/debugger"
"go.wit.com/log"
)
var args struct {
}
func init() {
arg.MustParse(&args)
if debugger.ArgDebug() {
log.Info("cmd line --debugger == true")
go func() {
log.Sleep(2)
debugger.DebugWindow()
}()
}
}

View File

@ -15,6 +15,7 @@ func main() {
helloworld() helloworld()
// go will sit here until the window exits // go will sit here until the window exits
// intermittently, it will show toolkit statistics
gui.Watchdog() gui.Watchdog()
} }
@ -43,11 +44,10 @@ func helloworld() {
color.AddText("Cyan") color.AddText("Cyan")
color.AddText("Magenta") color.AddText("Magenta")
color.AddText("Yellow") color.AddText("Yellow")
color.Custom = func () { color.Custom = func() {
log.Info("color is now", color.String()) log.Info("color is now", color.String())
} }
check := grid.NewCheckbox("Checkers").SetProgName("CHECKERS") check := grid.NewCheckbox("Checkers").SetProgName("CHECKERS")
check.Custom = func() { check.Custom = func() {
log.Info("Checkers is now", check.Bool()) log.Info("Checkers is now", check.Bool())