forked from docker-flow/docker-flow-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
args.go
25 lines (21 loc) · 757 Bytes
/
args.go
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
package main
import (
"fmt"
"github.com/jessevdk/go-flags"
"os"
)
type Args struct{}
var NewArgs = func() Args {
return Args{}
}
func (a Args) Parse() error {
parser := flags.NewParser(nil, flags.Default)
parser.AddCommand("server", "Runs the server", "Runs the server", &server)
parser.AddCommand("run", "Runs the proxy", "Runs the proxy", &run)
parser.AddCommand("reconfigure", "Reconfigures the proxy", "Reconfigures the proxy using information stored in Consul", &reconfigure)
parser.AddCommand("remove", "Removes a service from the proxy", "Removes a service from the proxy", &remove)
if _, err := parser.ParseArgs(os.Args[1:]); err != nil {
return fmt.Errorf("Could not parse command line arguments\n%s", err.Error())
}
return nil
}