summaryrefslogtreecommitdiff
path: root/argv.custom.go
diff options
context:
space:
mode:
Diffstat (limited to 'argv.custom.go')
-rw-r--r--argv.custom.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/argv.custom.go b/argv.custom.go
index 066d80a..1e8abac 100644
--- a/argv.custom.go
+++ b/argv.custom.go
@@ -1,5 +1,11 @@
package main
+import (
+ "os"
+
+ "go.wit.com/lib/protobuf/argvpb"
+)
+
// this is where to customize argv for your application
var APPNAME string = "basicwindow"
@@ -13,3 +19,16 @@ func (a args) Description() string {
This basicwindow example demonstrates multiple windows
`
}
+
+// sends the strings to bash or zsh that will be your options
+func (a args) SendCompletionStrings(pb *argvpb.Argv) {
+ if pb.Cmd == "" {
+ // these are base autocomplete strings
+ matches := []string{"--bash", "--version", "demo", "gui"}
+ pb.SendStrings(matches)
+ } else {
+ // autogenerate the strings for the subcommand using github.com/alexflint/go-arg
+ pb.GenerateSubCommandStrings(pb.Goargs...)
+ }
+ os.Exit(0)
+}