From 4721184398013ac30160bc5bbde5244256f15d88 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 20 Jan 2025 05:08:52 -0600 Subject: [PATCH] attempt to embedded gocui plugin toolkit --- Makefile | 6 +++++- doGui.go | 6 ++++++ main.go | 6 ++++++ resources/forge.text | 25 +++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 resources/forge.text diff --git a/Makefile b/Makefile index 2fcfecb..e97f825 100644 --- a/Makefile +++ b/Makefile @@ -14,10 +14,14 @@ verbose: GO111MODULE=off go build -v -x \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" -install: goimports vet +install: goimports vet plugin GO111MODULE=off go install \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" +plugin: + rm -f resources/*.so + cp ~/go/lib/gocui.so resources/ + goimports: reset goimports -w *.go diff --git a/doGui.go b/doGui.go index d80e53c..d7d328c 100644 --- a/doGui.go +++ b/doGui.go @@ -26,7 +26,13 @@ func debug() { } func doGui() { + if me.forge.Config.GetDefaultGui() == "" { + me.forge.Config.DefaultGui = "gocui" + me.forge.ConfigSave() + } me.myGui = gui.New() + me.myGui.InitEmbed(resources) + me.myGui.SetAppDefaultPlugin(me.forge.Config.DefaultGui) // sets the default GUI plugin to use me.myGui.Default() // debug() diff --git a/main.go b/main.go index 49dcb8d..73bab4b 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main // An app to submit patches for the 30 GO GUI repos import ( + "embed" "os" "strings" @@ -17,6 +18,11 @@ import ( var VERSION string var BUILDTIME string +// this optionally can store the GUI plugins +// +//go:embed resources/* +var resources embed.FS + // used for shell auto completion var ARGNAME string = "forge" diff --git a/resources/forge.text b/resources/forge.text new file mode 100644 index 0000000..3ad9842 --- /dev/null +++ b/resources/forge.text @@ -0,0 +1,25 @@ +# this file is automatically re-generated from forge.pb, however, +# if you want to edit it by hand, you can: +# stop forge; remove forge.pb; edit forge.text; start forge +# this will cause the default behavior to fallback to parsing this file for the config + +# this file is intended to be used to customize settings on what +# git repos you have write access to. That is, where you can run 'git push' + +ForgeConfigs: { + goPath: "go.wit.com" + writable: true + directory: true +} +repos: { + goPath: "go.wit.com/apps/zookeeper" + debName: "zookeeper-go" +} +xterm: "xterm" +xtermArgv: "-bg" +xtermArgv: "black" +xtermArgv: "-fg" +xtermArgv: "white" +xtermArgv: "-geometry" +xtermArgv: "140x32" +xtermArgv: "-e"