-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
47 lines (37 loc) · 823 Bytes
/
main.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
package main
import (
"os"
"github.com/fatih/color"
"github.com/kensodev/bashir"
"github.com/urfave/cli"
)
func main() {
app := cli.NewApp()
app.Version = "0.4.0"
var configFileLocation string
app.Commands = []cli.Command{
{
Name: "run",
Usage: "Run commands from a bashir configuration file",
Flags: []cli.Flag{
cli.StringFlag{
Name: "config, c",
Usage: "Load configuration from `FILE`",
Destination: &configFileLocation,
},
},
Action: func(c *cli.Context) error {
parser := bashir.NewParser(configFileLocation)
config, err := parser.ParseConfigurationFile()
if err != nil {
color.Red(err.Error())
return err
}
runner := bashir.NewRunner(config)
runner.RunCommands()
return nil
},
},
}
app.Run(os.Args)
}