diff options
| author | Jeff Carr <[email protected]> | 2025-09-25 02:40:24 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-25 02:40:24 -0500 | 
| commit | 89c9b46f8b06c882dbc60d2cdf4c19b50397acbc (patch) | |
| tree | 1a7213fff73f0d9b7fcef82bc24be7348a66b745 | |
| parent | 8ab09243500576460a9e5b12cae0b997933d6577 (diff) | |
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | argv.go | 22 | ||||
| -rwxr-xr-x | build | 3 | ||||
| -rw-r--r-- | main.go | 11 | ||||
| -rw-r--r-- | structs.go | 3 | 
5 files changed, 20 insertions, 23 deletions
@@ -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}" @@ -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)  } @@ -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 @@ -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 { @@ -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  | 
