-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.go
79 lines (74 loc) · 1.57 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package main
import (
"fmt"
"os"
"github.com/codegangsta/cli"
"github.com/kohei-kimura/stopho/command"
)
var GlobalFlags = []cli.Flag{
cli.BoolFlag{
Name: "japan, jp, j",
Usage: "Enable Japan mode",
},
}
var Commands = []cli.Command{
{
Name: "list",
ShortName: "l",
Usage: "List available stock photo web sites",
Action: command.CmdList,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "japan, j",
Usage: "Enable Japan mode",
},
cli.BoolFlag{
Name: "quiet, q",
Usage: "Only display URLs of stock photo sites",
},
},
},
{
Name: "version",
ShortName: "v",
Usage: "Print the stopho version",
Action: command.CmdVersion,
Flags: []cli.Flag{},
},
{
Name: "search",
ShortName: "s",
Usage: "Generate search URLs from stock photos web sites",
Action: command.CmdSearch,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "japan, j",
Usage: "Enable Japan mode",
},
cli.BoolFlag{
Name: "quiet, q",
Usage: "Display only URLs of stock photo sites",
},
cli.StringFlag{
Name: "site, s",
Usage: "Display only sites matched `value`",
},
},
},
{
Name: "open",
ShortName: "o",
Usage: "Open search URLs from stock photos web sites",
Action: command.CmdOpen,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "japan, j",
Usage: "Enable Japan mode",
},
},
},
}
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)
}