summaryrefslogtreecommitdiff
path: root/bash.orig.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-18 08:54:33 -0500
committerJeff Carr <[email protected]>2025-09-18 08:54:33 -0500
commit763b1a60fcc9c6c0e6751859a6c06c81372d0268 (patch)
tree79182bf9098fb841942890747dec866edf2eff6d /bash.orig.go
parentfec80aca170e85e9bb8c122ae2c6c2283930f252 (diff)
still working on how this should work
Diffstat (limited to 'bash.orig.go')
-rw-r--r--bash.orig.go32
1 files changed, 13 insertions, 19 deletions
diff --git a/bash.orig.go b/bash.orig.go
index e0d23bd..2d32a05 100644
--- a/bash.orig.go
+++ b/bash.orig.go
@@ -13,35 +13,32 @@ import (
"go.wit.com/log"
)
-var argBash ArgsBash
-
/*
This struct can be used with the go-arg package. These
are the generic default command line arguments for the 'GUI' package
*/
+var argBash ArgsBash
+
type ArgsBash struct {
Bash bool `arg:"--bash" help:"generate bash completion"`
}
-var myBash *BashAuto
+// try this struct out (?)
+var myAuto *AutoArgs
-type BashAuto struct {
+type AutoArgs struct {
id int // should be unique
hidden bool // don't update the toolkits when it's hidden
Auto func([]string)
- appName string // a good way to track the name of the binary ?
+ appName string // a good way to track the name of the binary ?
+ pp *arg.Parser // for parsing the command line args. Yay to alexf lint!
}
-/*
-func dumpjunk() {
- fmt.Fprintln(os.Stderr, "")
- fmt.Fprintln(os.Stderr, os.Args)
- os.Exit(0)
-}
-*/
-
// argname is the name of the executable
-func Bash(argname string, autocomplete func([]string)) *BashAuto {
+func Bash(argname string, autocomplete func([]string)) *AutoArgs {
+ myAuto = new(AutoArgs)
+ myAuto.appName = argname
+
if len(os.Args) > 1 && os.Args[1] == "--bash" {
doBash(argname)
os.Exit(0)
@@ -54,11 +51,8 @@ func Bash(argname string, autocomplete func([]string)) *BashAuto {
arg.Register(&argBash)
- myBash = new(BashAuto)
- myBash.appName = argname
-
// parse go.Arg here?
- return myBash
+ return myAuto
}
// print out auto complete debugging info
@@ -84,7 +78,7 @@ func GetLast(cur string, argv []string) string {
// returns the name of the executable registered for shell autocomplete
func AppName() string {
- return myBash.appName
+ return myAuto.appName
}
// makes a bash autocomplete file for your command