summaryrefslogtreecommitdiff
path: root/argv.go
diff options
context:
space:
mode:
Diffstat (limited to 'argv.go')
-rw-r--r--argv.go36
1 files changed, 26 insertions, 10 deletions
diff --git a/argv.go b/argv.go
index 0efa3c9..58a7f2b 100644
--- a/argv.go
+++ b/argv.go
@@ -9,14 +9,17 @@ package main
*/
import (
- "go.wit.com/dev/alexflint/arg"
+ "os"
+
+ "go.wit.com/lib/gui/prep"
"go.wit.com/log"
)
var argv args
type args struct {
- Test *EmptyCmd `arg:"subcommand:test" help:"New to forge? This is for you.'"`
+ Status *EmptyCmd `arg:"subcommand:status" help:"should display something"`
+ Test *EmptyCmd `arg:"subcommand:test" help:"test stuff"`
Daemon bool `arg:"--daemon" default:"false" help:"run in daemon mode"`
Port int `arg:"--port" default:"2521" help:"port to run on"`
URL string `arg:"--url" help:"url to use"`
@@ -25,14 +28,6 @@ type args struct {
type EmptyCmd struct {
}
-func (args) Version() string {
- return "zood " + VERSION + " Built on: " + BUILDTIME
-}
-
-func init() {
- arg.MustParse(&argv)
-}
-
func (a args) Description() string {
return `
this daemon talks to zookeeper
@@ -53,3 +48,24 @@ func init() {
PING = log.NewFlag("PING", false, full, short, "show pings to the zookeeper")
WARN = log.NewFlag("WARN", true, full, short, "bad things")
}
+
+func (args) Version() string {
+ return ARGNAME + " " + VERSION + " Built on " + BUILDTIME
+}
+
+func (args) Buildtime() (string, string) {
+ return BUILDTIME, VERSION
+}
+
+func (args) Appname() string {
+ return ARGNAME
+}
+
+func (a args) DoAutoComplete(pb *prep.Auto) {
+ if pb.Cmd == "" {
+ pb.Autocomplete3([]string{"status", "test", "--version", "--daemon"})
+ } else {
+ pb.SubCommand(pb.Goargs...)
+ }
+ os.Exit(0)
+}