-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
45 lines (41 loc) · 810 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
package main
import (
"io/ioutil"
"os"
"github.com/luthermonson/quiso/cmd"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Name: "quiso",
Usage: "Quick CloudInit ISOs",
Action: cmd.Build,
Commands: cmd.Commands(),
Before: func(ctx *cli.Context) error {
if ctx.Bool("debug") {
logrus.SetLevel(logrus.DebugLevel)
}
if ctx.Bool("quiet") {
logrus.SetOutput(ioutil.Discard)
}
return nil
},
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "debug",
Aliases: []string{"d"},
Usage: "Turn on verbose debug logging",
},
&cli.BoolFlag{
Name: "quiet",
Aliases: []string{"q"},
Usage: "Turn on off all logging",
},
},
}
err := app.Run(os.Args)
if err != nil {
logrus.Fatal(err)
}
}