summaryrefslogtreecommitdiff
path: root/bash.go
diff options
context:
space:
mode:
Diffstat (limited to 'bash.go')
-rw-r--r--bash.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/bash.go b/bash.go
index 933281d..6d7b868 100644
--- a/bash.go
+++ b/bash.go
@@ -58,6 +58,27 @@ func Bash(argname string, autocomplete func([]string)) *BashAuto {
return myBash
}
+// also try to parse/send cur (?)
+func Bash2(argname string, autocomplete func(string, string, []string)) *BashAuto {
+ if len(os.Args) > 1 && os.Args[1] == "--bash" {
+ doBash(argname)
+ os.Exit(0)
+ }
+
+ if len(os.Args) > 1 && os.Args[1] == "--auto-complete" {
+ autocomplete(os.Args[0], os.Args[1], os.Args[2:])
+ os.Exit(0)
+ }
+
+ 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