diff options
| -rw-r--r-- | argv.go | 25 | ||||
| -rwxr-xr-x | build | 4 | ||||
| -rw-r--r-- | main.go | 6 | ||||
| -rw-r--r-- | structs.go | 3 |
4 files changed, 22 insertions, 16 deletions
@@ -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) } @@ -0,0 +1,4 @@ +#!/bin/bash -x + +mkdir -p files/usr/share/bash-completion/completions/ +startxplacement --bash > files/usr/share/bash-completion/completions/startxplacement @@ -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() @@ -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 } |
