new autocomplete method
This commit is contained in:
parent
dcac6d6608
commit
5f2f877001
39
argv.go
39
argv.go
|
@ -1,9 +1,9 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
|
||||||
|
"go.wit.com/lib/gui/prep"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -52,34 +52,15 @@ func (args) Version() string {
|
||||||
handles shell autocomplete
|
handles shell autocomplete
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func (a args) DoAutoComplete(argv []string) {
|
func (args) Appname() string {
|
||||||
switch argv[0] {
|
return ARGNAME
|
||||||
case "checkout":
|
|
||||||
usr, _ := user.Current()
|
|
||||||
fmt.Println("user devel master " + usr.Username)
|
|
||||||
case "commit":
|
|
||||||
fmt.Println("--all")
|
|
||||||
case "config":
|
|
||||||
fmt.Println("add fix list delete")
|
|
||||||
case "list":
|
|
||||||
fmt.Println("--all --mine --favorites --private")
|
|
||||||
case "pull":
|
|
||||||
fmt.Println("--all --mine --favorites --private")
|
|
||||||
case "patch":
|
|
||||||
fmt.Println("--list --submit --show")
|
|
||||||
case "dirty":
|
|
||||||
fmt.Println("--show-files")
|
|
||||||
case "user":
|
|
||||||
fmt.Println("--force")
|
|
||||||
case "devel":
|
|
||||||
fmt.Println("--force")
|
|
||||||
case "master":
|
|
||||||
fmt.Println("--force")
|
|
||||||
default:
|
|
||||||
if argv[0] == ARGNAME {
|
|
||||||
// list the subcommands here
|
|
||||||
fmt.Println("--bash quick")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a args) DoAutoComplete(pb *prep.Auto) {
|
||||||
|
if pb.Cmd == "" {
|
||||||
|
pb.Autocomplete3([]string{"--bash", "quick"})
|
||||||
|
} else {
|
||||||
|
pb.SubCommand(pb.Argv...)
|
||||||
}
|
}
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
4
main.go
4
main.go
|
@ -7,7 +7,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"go.wit.com/dev/alexflint/arg"
|
|
||||||
"go.wit.com/lib/fhelp"
|
"go.wit.com/lib/fhelp"
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/lib/gui/prep"
|
"go.wit.com/lib/gui/prep"
|
||||||
|
@ -27,9 +26,8 @@ var argv args
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
me = new(autoType)
|
me = new(autoType)
|
||||||
prep.Bash(ARGNAME, argv.DoAutoComplete) // this line should be: prep.Bash(argv)
|
|
||||||
me.myGui = prep.Gui() // prepares the GUI package for go-args
|
me.myGui = prep.Gui() // prepares the GUI package for go-args
|
||||||
me.pp = arg.MustParse(&argv)
|
me.auto = prep.Bash3(&argv) // this line should be: prep.Bash(&argv)
|
||||||
|
|
||||||
me.forge = forgepb.Init()
|
me.forge = forgepb.Init()
|
||||||
me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
|
me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go.wit.com/dev/alexflint/arg"
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/lib/gui/prep"
|
"go.wit.com/lib/gui/prep"
|
||||||
|
@ -13,7 +12,7 @@ import (
|
||||||
var me *autoType
|
var me *autoType
|
||||||
|
|
||||||
type autoType struct {
|
type autoType struct {
|
||||||
pp *arg.Parser // for parsing the command line args. Yay to alexf lint!
|
auto *prep.Auto // more experiments for bash handling
|
||||||
myGui *prep.GuiPrep // the gui handle itself
|
myGui *prep.GuiPrep // the gui handle itself
|
||||||
releaseReasonS string // = "gocui dropdown select"
|
releaseReasonS string // = "gocui dropdown select"
|
||||||
release releaseStruct // notsure
|
release releaseStruct // notsure
|
||||||
|
|
Loading…
Reference in New Issue