From 9f067d592ac6e3190206c6e7232ce95a04e7c25a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 17 Sep 2025 01:09:03 -0500 Subject: [PATCH] working on a better routine --- bash.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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