diff options
| author | Jeff Carr <[email protected]> | 2025-10-05 05:42:22 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-05 05:44:12 -0500 |
| commit | e8e842929fb05149c83ec8e585e3b4470f7d6abc (patch) | |
| tree | f2c116440e1d8cdd8db29511de50b841feef3a73 /argv.go | |
| parent | 96ea43517957c1bab0ef563e003455df7117c468 (diff) | |
adding new argvv0.22.122
Diffstat (limited to 'argv.go')
| -rw-r--r-- | argv.go | 41 |
1 files changed, 30 insertions, 11 deletions
@@ -1,27 +1,46 @@ package main +import ( + "os" + + "go.wit.com/lib/gui/prep" +) + /* this parses the command line arguements this enables command line options from other packages like 'gui' and 'log' */ -import ( - "go.wit.com/dev/alexflint/arg" -) - var argv args type args struct { - ListRepos bool `arg:"--list-repos" help:"list all repositories"` - Port int `arg:"--port" default:"2520" help:"port to run on"` - RepoMap string `arg:"--repomap" default:"/etc/gowebd/repomap" help:"repomap file"` - Hostname string `arg:"--hostname" default:"go.wit.com" help:"hostname to use"` + Test *EmptyCmd `arg:"subcommand:test" help:"test repomap"` + ListRepos bool `arg:"--list-repos" help:"list all repositories"` + Port int `arg:"--port" default:"2520" help:"port to run on"` + RepoMap string `arg:"--repomap" default:"/etc/gowebd/repomap" help:"repomap file"` + Hostname string `arg:"--hostname" default:"go.wit.com" help:"hostname to use"` +} + +type EmptyCmd struct { } func (args) Version() string { - return "gowebd " + VERSION + " Built on " + BUILDTIME + return ARGNAME + " " + VERSION + " Built on " + BUILDTIME +} + +func (args) Buildtime() (string, string) { + return BUILDTIME, VERSION +} + +func (args) Appname() string { + return ARGNAME } -func init() { - arg.MustParse(&argv) +func (a args) DoAutoComplete(pb *prep.Auto) { + if pb.Cmd == "" { + pb.Autocomplete3([]string{"test", "--version", "--force"}) + } else { + pb.SubCommand(pb.Goargs...) + } + os.Exit(0) } |
