-
Notifications
You must be signed in to change notification settings - Fork 1
/
it.go
65 lines (60 loc) · 1.5 KB
/
it.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
package main
import (
"github.com/blueben82/imagetools/commands"
"github.com/urfave/cli"
"os"
)
func main() {
app := cli.NewApp()
app.Name = "imagetools"
app.Version = "0.0.5"
app.Usage = "A tiny helper library, written in golang, that serves some utilities that can be used to build more robust docker containers"
app.Commands = []cli.Command{
{
Name: "logs",
Usage: "Super easy logging",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "debug",
},
cli.BoolFlag{
Name: "info",
},
},
Action: commands.Logs,
},
{
Name: "requires",
Usage: "Validates environment variables and terminates script if they dont match your expectations. By default it expects the given env variable to be a not empty string.",
Flags: []cli.Flag{
cli.StringFlag{
Name: "validate",
Usage: "Select one of int, float, bool, string or regex as validator",
},
cli.StringFlag{
Name: "min",
Usage: "The minimum accepted value for int or float",
},
cli.StringFlag{
Name: "max",
Usage: "The maximum accepted value for int or float",
},
cli.StringFlag{
Name: "pattern",
Usage: "The regex pattern used to validate the value",
},
cli.StringFlag{
Name: "example",
Usage: "An example value to be used in error message",
},
},
Action: commands.Requires,
},
{
Name: "waits-for",
Usage: "Waits for an external service to become available.",
Action: commands.WaitsFor,
},
}
app.Run(os.Args)
}