summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-17 16:29:45 -0500
committerJeff Carr <[email protected]>2025-10-17 16:29:45 -0500
commite4f3c02a6f97810aa69a85e81a994c12b33a8ca8 (patch)
tree51141336fda0e0a9e65ad13abb3594b64643c80e
parentc9e79a11c7caeabc8a6f7b2d2217a3af80c4797c (diff)
renamed lib to argvpb
-rw-r--r--argv.go16
-rw-r--r--main.go5
-rw-r--r--structs.go16
3 files changed, 19 insertions, 18 deletions
diff --git a/argv.go b/argv.go
index ac5e3eb..6d9e4ba 100644
--- a/argv.go
+++ b/argv.go
@@ -11,7 +11,7 @@ package main
import (
"os"
- "go.wit.com/lib/gui/prep"
+ "go.wit.com/lib/protobuf/argvpb"
)
var argv args
@@ -37,10 +37,6 @@ type args struct {
type EmptyCmd struct {
}
-func (args) Version() string {
- return ARGNAME + " " + VERSION + " Built on " + BUILDTIME
-}
-
/*
handles shell autocomplete
*/
@@ -53,9 +49,15 @@ func (args) Buildtime() (string, string) {
return BUILDTIME, VERSION
}
-func (a args) DoAutoComplete(pb *prep.Auto) {
+func (args) Version() string {
+ return argvpb.StandardVersion(ARGNAME, VERSION, BUILDTIME)
+}
+
+// sends the strings to bash or zsh that will be your options
+func (a args) SendCompletionStrings(pb *argvpb.Argv) {
if pb.Cmd == "" {
- pb.Autocomplete3([]string{"drives", "gui", "--version"})
+ base := []string{"drives", "gui", "--version"}
+ pb.SendStrings(base)
} else {
pb.SubCommand(pb.Goargs...)
}
diff --git a/main.go b/main.go
index 2351110..81033dc 100644
--- a/main.go
+++ b/main.go
@@ -12,7 +12,7 @@ import (
"plugin"
"unicode"
- "go.wit.com/lib/gui/prep"
+ "go.wit.com/lib/protobuf/argvpb"
"go.wit.com/log"
)
@@ -28,8 +28,7 @@ var resources embed.FS
func main() {
me = new(autoType)
- me.myGui = prep.Gui() // prepares the GUI package for go-args
- me.auto = prep.Bash3(&argv) // add support for bash autocomplete with go-arg
+ me.argv = argvpb.Autocomplete(&argv) // adds shell auto complete to go-args
me.pb = NewBlocks()
diff --git a/structs.go b/structs.go
index f978f24..e40c8a9 100644
--- a/structs.go
+++ b/structs.go
@@ -5,18 +5,18 @@ package main
import (
"go.wit.com/gui"
- "go.wit.com/lib/gui/prep"
+ "go.wit.com/lib/protobuf/argvpb"
)
var me *autoType
// this app's variables
type autoType struct {
- auto *prep.Auto // more experiments for bash handling
- myGui *prep.GuiPrep // the gui toolkit handle
- dd *gui.Node // the drives dropdown list
- parted *gui.Node // the current drive to run parted on
- currentDev *Block // the current dev entry to work on
- pb *Blocks // the block dev protobuf
- driveInfoBox *gui.Node // displays the drive info
+ argv *argvpb.Argv // shell autocomplete
+ myGui *argvpb.GuiPrep // the gui toolkit handle
+ dd *gui.Node // the drives dropdown list
+ parted *gui.Node // the current drive to run parted on
+ currentDev *Block // the current dev entry to work on
+ pb *Blocks // the block dev protobuf
+ driveInfoBox *gui.Node // displays the drive info
}