working on a better routine
This commit is contained in:
parent
0c004de022
commit
9f067d592a
21
bash.go
21
bash.go
|
@ -58,6 +58,27 @@ func Bash(argname string, autocomplete func([]string)) *BashAuto {
|
||||||
return myBash
|
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
|
// returns the name of the executable registered for shell autocomplete
|
||||||
func AppName() string {
|
func AppName() string {
|
||||||
return myBash.appName
|
return myBash.appName
|
||||||
|
|
Loading…
Reference in New Issue