summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-12 10:12:41 -0500
committerJeff Carr <[email protected]>2025-09-12 10:12:41 -0500
commit0c004de022cdedf04239f029b03bff1dfe3d7b30 (patch)
tree13258f4393b018d99b728166d95b17cd278c3507
parent2d811f1796f8075c1e3618d54bfd3118d3590899 (diff)
track the application name used by bash autocompletev0.0.7v0.0.6
-rw-r--r--bash.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/bash.go b/bash.go
index 51f39a7..933281d 100644
--- a/bash.go
+++ b/bash.go
@@ -25,9 +25,10 @@ type ArgsBash struct {
var myBash *BashAuto
type BashAuto struct {
- id int // should be unique
- hidden bool // don't update the toolkits when it's hidden
- Auto func([]string)
+ 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 ?
}
func dumpjunk() {
@@ -51,11 +52,17 @@ func Bash(argname string, autocomplete func([]string)) *BashAuto {
arg.Register(&argBash)
myBash = new(BashAuto)
+ myBash.appName = argname
// parse go.Arg here?
return myBash
}
+// returns the name of the executable registered for shell autocomplete
+func AppName() string {
+ return myBash.appName
+}
+
// makes a bash autocomplete file for your command
func doBash(argname string) {
fmt.Println(makeBashCompletionText(argname))