update to the new autocomplete
This commit is contained in:
parent
6d670cc64f
commit
dada18c9a1
25
argv.go
25
argv.go
|
@ -1,8 +1,9 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"go.wit.com/lib/gui/prep"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -44,19 +45,15 @@ the repositories in the go.sum file using git clone`
|
||||||
handles shell autocomplete
|
handles shell autocomplete
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func (a args) DoAutoComplete(argv []string) {
|
func (args) Appname() string {
|
||||||
switch argv[0] {
|
return ARGNAME
|
||||||
case "arch":
|
}
|
||||||
fmt.Println("riscv64")
|
|
||||||
case "build":
|
func (a args) DoAutoComplete(pb *prep.Auto) {
|
||||||
fmt.Println("user devel release")
|
if pb.Cmd == "" {
|
||||||
case "--gui":
|
pb.Autocomplete3([]string{"arch", "build", "gui", "show"})
|
||||||
fmt.Println("nocui andlabs")
|
} else {
|
||||||
default:
|
pb.SubCommand(pb.Argv...)
|
||||||
if argv[0] == ARGNAME {
|
|
||||||
// list the subcommands here
|
|
||||||
fmt.Println("arch build gui show --gui")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash -x
|
||||||
|
|
||||||
|
mkdir -p files/usr/share/bash-completion/completions/
|
||||||
|
go-deb --bash > files/usr/share/bash-completion/completions/go-deb
|
6
main.go
6
main.go
|
@ -6,7 +6,6 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.wit.com/dev/alexflint/arg"
|
|
||||||
"go.wit.com/lib/gui/prep"
|
"go.wit.com/lib/gui/prep"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -24,9 +23,8 @@ var argv args
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
me = new(mainType)
|
me = new(mainType)
|
||||||
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.auto = prep.Bash3(&argv) // this line should be: prep.Bash(&argv)
|
||||||
me.pp = arg.MustParse(&argv)
|
|
||||||
|
|
||||||
wd, err := os.Getwd()
|
wd, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1,7 +1,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"
|
||||||
|
@ -12,7 +11,7 @@ var me *mainType
|
||||||
|
|
||||||
// this app's variables
|
// this app's variables
|
||||||
type mainType struct {
|
type mainType struct {
|
||||||
pp *arg.Parser // for parsing the command line args. Yay to alexf lint!
|
auto *prep.Auto // more experiments for bash handling
|
||||||
goSrc string // path to ~/go/src or go.work file
|
goSrc string // path to ~/go/src or go.work file
|
||||||
goPath string // the goPath to use for the package
|
goPath string // the goPath to use for the package
|
||||||
hasWork bool // true if using go.work file
|
hasWork bool // true if using go.work file
|
||||||
|
|
Loading…
Reference in New Issue