-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.go
48 lines (43 loc) · 927 Bytes
/
commands.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"fmt"
"os"
"github.com/codegangsta/cli"
"github.com/koemu/go-http-max-connections-demo/command"
)
var GlobalFlags = []cli.Flag{}
var Commands = []cli.Command{
{
Name: "default",
Usage: "Default commection mode.",
Action: command.CmdDefault,
Flags: []cli.Flag{
cli.IntFlag{
Name: "port, p",
Value: 8080,
Usage: "Set httpd listen port",
},
},
},
{
Name: "limited",
Usage: "Limited connection mode.",
Action: command.CmdLimited,
Flags: []cli.Flag{
cli.IntFlag{
Name: "port, p",
Value: 8080,
Usage: "Set httpd listen port",
},
cli.IntFlag{
Name: "max-connections, m",
Value: 5,
Usage: "Set httpd max connections",
},
},
},
}
func CommandNotFound(c *cli.Context, command string) {
fmt.Fprintf(os.Stderr, "%s: '%s' is not a %s command. See '%s --help'.", c.App.Name, command, c.App.Name, c.App.Name)
os.Exit(2)
}