summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-25 02:40:24 -0500
committerJeff Carr <[email protected]>2025-09-25 02:40:24 -0500
commit89c9b46f8b06c882dbc60d2cdf4c19b50397acbc (patch)
tree1a7213fff73f0d9b7fcef82bc24be7348a66b745
parent8ab09243500576460a9e5b12cae0b997933d6577 (diff)
new argv bash completionv0.0.38v0.0.37v0.0.36v0.0.35v0.0.34
-rw-r--r--Makefile4
-rw-r--r--argv.go22
-rwxr-xr-xbuild3
-rw-r--r--main.go11
-rw-r--r--structs.go3
5 files changed, 20 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 1caa794..a4ab61b 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,10 @@ build: goimports vet
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
install: goimports vet
+ GO111MODULE=off go install \
+ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
+
+install-verbose: goimports vet
GO111MODULE=off go install -v -x \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
diff --git a/argv.go b/argv.go
index deffbb2..dd84d38 100644
--- a/argv.go
+++ b/argv.go
@@ -9,9 +9,9 @@ package main
*/
import (
- "fmt"
"os"
+ "go.wit.com/lib/gui/prep"
"go.wit.com/log"
)
@@ -60,17 +60,15 @@ func init() {
handles shell autocomplete
*/
-func (a args) DoAutoComplete(argv []string) {
- switch argv[0] {
- case "playback":
- fmt.Println("long --uuid purge last submit")
- case "clean":
- fmt.Println("")
- default:
- if argv[0] == ARGNAME {
- // list the subcommands here
- fmt.Println("--json interact playback clean")
- }
+func (args) Appname() string {
+ return ARGNAME
+}
+
+func (a args) DoAutoComplete(pb *prep.Auto) {
+ if pb.Cmd == "" {
+ pb.Autocomplete3([]string{"--bash", "--me", "gui", "--daemon"})
+ } else {
+ pb.SubCommand(pb.Argv...)
}
os.Exit(0)
}
diff --git a/build b/build
index 26ff29a..cd7381d 100755
--- a/build
+++ b/build
@@ -6,3 +6,6 @@ cp gus.service files/lib/systemd/system/
mkdir -p files/usr/lib/gus/
cp Makefile.help files/usr/lib/gus/Makefile
+
+mkdir -p files/usr/share/bash-completion/completions/
+gus --bash > files/usr/share/bash-completion/completions/gus
diff --git a/main.go b/main.go
index 4c507bf..80030d1 100644
--- a/main.go
+++ b/main.go
@@ -17,7 +17,6 @@ import (
"github.com/svent/go-nbreader"
"github.com/google/uuid"
- "go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/gui/prep"
"go.wit.com/log"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
@@ -33,17 +32,11 @@ var resources embed.FS
func main() {
me = new(gusconf)
- prep.Bash(ARGNAME, argv.DoAutoComplete) // this line should be: prep.Bash(argv)
- me.myGui = prep.Gui() // prepares the GUI package for go-args
- me.pp = arg.MustParse(&argv)
+ me.myGui = prep.Gui() // prepares the GUI package for go-args
+ me.auto = prep.Bash3(&argv) // add support for bash autocomplete with go-arg
- if me.pp == nil {
- me.pp.WriteHelp(os.Stdout)
- os.Exit(0)
- }
log.Info("tmp hack", uuid.New().String())
- me = new(gusconf)
me.pollDelay = 10 * time.Second
if argv.UseME {
diff --git a/structs.go b/structs.go
index 63d1c53..e555300 100644
--- a/structs.go
+++ b/structs.go
@@ -7,7 +7,6 @@ import (
sync "sync"
"time"
- "go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/prep"
@@ -17,7 +16,7 @@ var me *gusconf
// this app's variables
type gusconf struct {
- pp *arg.Parser // for parsing the command line args. Yay to alexf lint!
+ auto *prep.Auto // more experiments for bash handling
myGui *prep.GuiPrep // the base of the gui
portmaps *Portmaps // the portmap window
portwin *stdTableWin // the portwin window