summaryrefslogtreecommitdiff
path: root/complete.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-26 10:38:08 -0500
committerJeff Carr <[email protected]>2025-10-26 10:38:08 -0500
commitdee05f9efde26a1b3a781781262cd49a6750f6bc (patch)
treeeda9bce04fae397254b9e91af6ba743fe96eda1e /complete.go
parentc8b4bfc00ff9f2c6d5a8502f0e93f05a641ebc57 (diff)
finally working again argvHEADv0.0.54v0.0.53masterdevel
Diffstat (limited to 'complete.go')
-rw-r--r--complete.go63
1 files changed, 63 insertions, 0 deletions
diff --git a/complete.go b/complete.go
new file mode 100644
index 0000000..2e2f7c3
--- /dev/null
+++ b/complete.go
@@ -0,0 +1,63 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+package main
+
+import (
+ "fmt"
+ "strings"
+
+ "go.wit.com/dev/alexflint/arg"
+ "go.wit.com/lib/protobuf/argvpb"
+ "go.wit.com/log"
+)
+
+var VERSION string
+var BUILDTIME string
+
+var APPNAME string = "gus"
+
+func (a args) Description() string {
+ return `
+ "Phantastic Gus" your network squirrel
+
+ * Meet [the Phantastic squirrel Gus](https://www.youtube.com/watch?v=hFZFjoX2cGg)
+`
+}
+
+var NOW *log.LogFlag
+var INFO *log.LogFlag
+var PING *log.LogFlag
+var WARN *log.LogFlag
+
+func init() {
+ full := "go.wit.com/lib/daemon/gus"
+ short := "zood"
+
+ NOW = log.NewFlag("NOW", true, full, short, "useful while doing debugging")
+ INFO = log.NewFlag("INFO", false, full, short, "general gus")
+ WARN = log.NewFlag("WARN", true, full, short, "bad things")
+}
+
+func (args) MustParse() error {
+ me.pp = arg.MustParse(&argv)
+ return nil
+}
+
+// sends the strings to bash or zsh that will be your options
+func (a args) DoAutoComplete() error {
+ if argvpb.PB.GetCmd() == "" {
+ matches := []string{"--bash", "--me", "gui", "--daemon"}
+ fmt.Fprintf(argvpb.Stdout, " %s", strings.Join(matches, " "))
+ return nil
+ }
+ var err error
+ if me.pp == nil {
+ me.pp, err = arg.ParseFlagsArgv(&argv)
+ if err != nil {
+ return err
+ }
+ }
+ err = me.pp.WriteHelpForAutocomplete(argvpb.PB.Partial, argvpb.PB.Real...)
+ return err
+}