summaryrefslogtreecommitdiff
path: root/argv.custom.go
diff options
context:
space:
mode:
Diffstat (limited to 'argv.custom.go')
-rw-r--r--argv.custom.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/argv.custom.go b/argv.custom.go
new file mode 100644
index 0000000..f49adcd
--- /dev/null
+++ b/argv.custom.go
@@ -0,0 +1,50 @@
+package main
+
+import (
+ "os"
+
+ "go.wit.com/lib/protobuf/argvpb"
+ "go.wit.com/log"
+)
+
+// sent via -ldflags
+var VERSION string
+var BUILDTIME string
+
+var APPNAME string = "virtigo"
+
+func (a args) Description() string {
+ return `
+ virtigo: control your cluster
+
+This maintains a master list of all your vm's (aka 'droplets')
+in your homelab cloud. You can import libvirt xml files.
+This app talks to your hypervisors via the virtigod daemon.
+`
+}
+
+var INFO *log.LogFlag
+var POLL *log.LogFlag
+var WARN *log.LogFlag
+var EVENT *log.LogFlag
+
+func init() {
+ full := "go.wit.com/apps/virtigo"
+ short := "virtigo"
+
+ INFO = log.NewFlag("INFO", false, full, short, "general virtigo")
+ POLL = log.NewFlag("POLL", false, full, short, "virtigo polling")
+ WARN = log.NewFlag("WARN", true, full, short, "bad things")
+ EVENT = log.NewFlag("EVENT", true, full, short, "hypeprvisor/droplet events")
+}
+
+// sends the strings to bash or zsh that will be your options
+func (a args) SendCompletionStrings(pb *argvpb.Argv) {
+ if pb.Cmd == "" {
+ base := []string{"--version", "list", "droplet"}
+ pb.SendStrings(base)
+ } else {
+ pb.SubCommand(pb.Goargs...)
+ }
+ os.Exit(0)
+}