diff options
| author | Jeff Carr <[email protected]> | 2024-11-07 13:30:17 -0600 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-07 13:30:17 -0600 | 
| commit | 161f3934ceab7943445389daf199ad3901c091e8 (patch) | |
| tree | ffa77b7304ed745589506f6cb1d4d6baf0f331c4 | |
| parent | bc01313a04ddb0cfe5eae72a0e04995765a53c84 (diff) | |
update to also embed toolkit plugins in the binaryv0.21.1
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | .gitignore | 14 | ||||
| -rw-r--r-- | Makefile | 27 | ||||
| -rw-r--r-- | README.md | 6 | ||||
| -rw-r--r-- | argv.go | 38 | ||||
| -rw-r--r-- | debugger.go | 6 | ||||
| -rw-r--r-- | main.go | 10 | ||||
| -rw-r--r-- | resources/blank.so | 0 | 
7 files changed, 77 insertions, 24 deletions
@@ -1,5 +1,9 @@ -* -!.gitignore -!Makefile -!*.go -!LICENSE +*.swp +go.mod +go.sum + +/files/* +/*.deb +/resources/* + +gadgetwindow @@ -1,5 +1,19 @@ +VERSION = $(shell git describe --tags) +  all: build -	reset +	./gadgetwindow + +build: +	-rm -f gadgetwindow +	-rm resources/*.so +	touch resources/blank.so +	-cp -a ~/go/src/go.wit.com/toolkits/*.so resources/    # embed the toolkit plugins in the binary +	GO111MODULE=off go build -v -x \ +		    -ldflags "-X main.VERSION=${VERSION}" + +install: +	GO111MODULE=off go install -v -x \ +		    -ldflags "-X main.VERSION=${VERSION}"  	./gadgetwindow  nocui: build @@ -18,17 +32,6 @@ debugger: build  	reset  	./gadgetwindow --debugger -build: -ifeq ($(GO111MODULE),) -	@echo -	@echo In GO, to build here you must export GO111MODULE=off -	@echo -	@false -else -	-rm -f gadgetwindow -	go build -v -x -endif -  goimports:  	goimports -w *.go diff --git a/README.md b/README.md new file mode 100644 index 0000000..600fd6a --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# gadgetwindow +This simple 'gui' demo also embedds the plugins into the binary + +## Install go-glone + +	go build go.wit.com/apps/gadgetwindow@latest @@ -0,0 +1,38 @@ +package main + +import ( +	"os" + +	"github.com/alexflint/go-arg" +) + +/* +	this parses the command line arguements +	this enables command line options from other packages like 'gui' and 'log' +*/ + +var argv args + +type args struct { +	Demo string `arg:"positional"                   help:"this is just a demo"` +} + +func (a args) Description() string { +	return ` +This basicwindow example demonstrates multiple windows +` +} + +func init() { +	pp := arg.MustParse(&argv) + +	// for very new users or users unfamilar with the command line, this may help them +	if argv.Demo == "version" || argv.Demo == "help" || argv.Demo == "?" { +		pp.WriteHelp(os.Stdout) +		os.Exit(0) +	} +} + +func (args) Version() string { +	return "basicwindow " + VERSION +} diff --git a/debugger.go b/debugger.go index 116d549..f7a6aca 100644 --- a/debugger.go +++ b/debugger.go @@ -5,17 +5,11 @@ package main  */  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() { @@ -1,7 +1,8 @@ -// This creates a simple hello world window  package main  import ( +	"embed" +  	"go.wit.com/gui"  	"go.wit.com/lib/debugger"  	"go.wit.com/lib/gadgets" @@ -9,9 +10,15 @@ import (  	"go.wit.com/log"  ) +// sent via -ldflags +var VERSION string +  // This is the beginning of the binary tree of widgets  var myGui *gui.Node +//go:embed resources/* +var resources embed.FS +  // this is the primary window. If you close it, the program will exit  var mainWindow *gui.Node @@ -28,6 +35,7 @@ func main() {  		log.ShowFlags()  	}  	myGui = gui.New() +	myGui.InitEmbed(resources)  	myGui.Default()  	helloworld() diff --git a/resources/blank.so b/resources/blank.so new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/resources/blank.so  | 
