From 34015f3d4ee487efe329d0387458f609343c2f9f Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 17 Oct 2025 17:18:27 -0500 Subject: new name 'argvpb' --- argv.go | 19 ++++++++++--------- main.go | 4 ++-- structs.go | 7 +++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/argv.go b/argv.go index e5b8e28..aba76e7 100644 --- a/argv.go +++ b/argv.go @@ -3,8 +3,7 @@ package main import ( "os" - "go.wit.com/lib/fhelp" - "go.wit.com/lib/gui/prep" + "go.wit.com/lib/protobuf/argvpb" "go.wit.com/log" ) @@ -62,10 +61,6 @@ This app talks to your hypervisors via the virtigod daemon. ` } -func (args) Version() string { - return ARGNAME + " " + VERSION + " Built on " + BUILDTIME -} - var INFO *log.LogFlag var POLL *log.LogFlag var WARN *log.LogFlag @@ -85,6 +80,10 @@ func init() { handles shell autocomplete */ +func (args) Version() string { + return argvpb.StandardVersion(ARGNAME, VERSION, BUILDTIME) +} + func (args) Appname() string { return ARGNAME } @@ -94,13 +93,15 @@ func (args) Buildtime() (string, string) { } func (args) ArgvGui() error { - me.myGui = fhelp.Gui() // adds the GUI package argv support + me.myGui = argvpb.Gui() // adds the GUI package argv support return nil } -func (a args) DoAutoComplete(pb *prep.Auto) { +// 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{"--version", "list", "droplet"}) + base := []string{"--version", "list", "droplet"} + pb.SendStrings(base) } else { pb.SubCommand(pb.Goargs...) } diff --git a/main.go b/main.go index 5975d77..a18b147 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,7 @@ import ( "path/filepath" "github.com/google/uuid" - "go.wit.com/lib/gui/prep" + "go.wit.com/lib/protobuf/argvpb" "go.wit.com/lib/protobuf/virtpb" "go.wit.com/log" ) @@ -25,7 +25,7 @@ var resources embed.FS func main() { me = new(virtigoT) - 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 if os.Getenv("VIRTIGO_HOME") == "" { homeDir, _ := os.UserHomeDir() diff --git a/structs.go b/structs.go index c156ad9..39a85b1 100644 --- a/structs.go +++ b/structs.go @@ -5,9 +5,8 @@ import ( "time" "go.wit.com/gui" - "go.wit.com/lib/fhelp" "go.wit.com/lib/gadgets" - "go.wit.com/lib/gui/prep" + "go.wit.com/lib/protobuf/argvpb" "go.wit.com/lib/protobuf/virtpb" ) @@ -25,8 +24,8 @@ func (b *virtigoT) Enable() { // this app's variables type virtigoT struct { - auto *prep.Auto // more experiments for bash handling - myGui *fhelp.GuiPrep // the gui toolkit handle + argv *argvpb.Argv // shell autocomplete + myGui *argvpb.GuiPrep // the gui toolkit handle e *virtpb.Events // virt protobuf events hmap map[*virtpb.Hypervisor]*HyperT // map to the local struct names []string // ? -- cgit v1.2.3