summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--argv.go25
-rwxr-xr-xbuild4
-rw-r--r--main.go6
-rw-r--r--structs.go3
4 files changed, 22 insertions, 16 deletions
diff --git a/argv.go b/argv.go
index 50936c0..727a063 100644
--- a/argv.go
+++ b/argv.go
@@ -4,8 +4,9 @@
package main
import (
- "fmt"
"os"
+
+ "go.wit.com/lib/gui/prep"
)
/*
@@ -42,15 +43,19 @@ and with the right geometries. TODO: restore the bash working paths
`
}
-func (a args) DoAutoComplete(argv []string) {
- switch argv[0] {
- case "dump":
- fmt.Println("--terminals")
- default:
- if argv[0] == ARGNAME {
- // list the subcommands here
- fmt.Println("--restore save dump dumpx list")
- }
+/*
+ handles shell autocomplete
+*/
+
+func (args) Appname() string {
+ return ARGNAME
+}
+
+func (a args) DoAutoComplete(pb *prep.Auto) {
+ if pb.Cmd == "" {
+ pb.Autocomplete3([]string{"--restore", "save", "dump", "dumpx", "list"})
+ } else {
+ pb.SubCommand(pb.Argv...)
}
os.Exit(0)
}
diff --git a/build b/build
new file mode 100755
index 0000000..73061de
--- /dev/null
+++ b/build
@@ -0,0 +1,4 @@
+#!/bin/bash -x
+
+mkdir -p files/usr/share/bash-completion/completions/
+startxplacement --bash > files/usr/share/bash-completion/completions/startxplacement
diff --git a/main.go b/main.go
index d2bebf7..9b7bacd 100644
--- a/main.go
+++ b/main.go
@@ -8,7 +8,6 @@ package main
import (
"fmt"
- "go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/gui/prep"
"go.wit.com/log"
)
@@ -27,9 +26,8 @@ var configFile string = "/home/jcarr/.config/startxplacement.out"
func main() {
me = new(mainType)
- prep.Bash(ARGNAME, argv.DoAutoComplete) // todo: this line should be: prep.Bash(argv)
- me.myGui = prep.Gui() // prepares the GUI package for go-args
- me.pp = arg.MustParse(&argv)
+ me.myGui = prep.Gui() // prepares the GUI package for go-args
+ me.auto = prep.Bash3(&argv) // add support for bash autocomplete with go-arg
if argv.DumpX != nil {
doDumpX()
diff --git a/structs.go b/structs.go
index 6251719..42b51c8 100644
--- a/structs.go
+++ b/structs.go
@@ -4,7 +4,6 @@
package main
import (
- "go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/gui/prep"
)
@@ -12,6 +11,6 @@ var me *mainType
// this app's variables
type mainType 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 toolkit handle
}