blob: e1756cc7f9eb89d0e21514c1ad69a61a3fbbc9ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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'
*/
var argv args
type args struct {
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 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{"test", "--version", "--force"})
} else {
pb.SubCommand(pb.Goargs...)
}
os.Exit(0)
}
|