From 47fad87e322da702df4993434c73941d826097fe Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 16 Feb 2024 01:22:15 -0600 Subject: [PATCH] use common debugger code --- Makefile | 2 +- argv.go | 14 -------------- debugger.go | 26 ++++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 15 deletions(-) delete mode 100644 argv.go create mode 100644 debugger.go diff --git a/Makefile b/Makefile index e6ac9d0..b20aede 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ log: tail -f /tmp/witgui.* /tmp/guilogfile gocui: build - ./control-panel-digitalocean -gui gocui + ./control-panel-digitalocean -gui gocui >/tmp/control-panel-droplet 2>&1 quiet: ./control-panel-digitalocean >/tmp/witgui.log.stderr 2>&1 diff --git a/argv.go b/argv.go deleted file mode 100644 index be3fc67..0000000 --- a/argv.go +++ /dev/null @@ -1,14 +0,0 @@ -package main - -/* - this enables command line options from other packages like 'gui' and 'log' -*/ - -import ( - arg "github.com/alexflint/go-arg" -) - - -func init() { - arg.MustParse() -} diff --git a/debugger.go b/debugger.go new file mode 100644 index 0000000..116d549 --- /dev/null +++ b/debugger.go @@ -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() + }() + } +}