-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
44 lines (38 loc) · 848 Bytes
/
Copy pathmain.go
File metadata and controls
44 lines (38 loc) · 848 Bytes
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
package main
import (
"errors"
"log"
"os"
"syscall"
"github.com/Metronlab/genius/internal/geniuserr"
"gopkg.in/urfave/cli.v2"
)
const flagDryRun = "dry"
func main() {
app := cli.App{
Name: "genius",
Version: "v1.0.0",
Usage: "various generation commands, refer to each command help for usage",
Commands: []*cli.Command{
Tmpl,
},
Flags: []cli.Flag{
&cli.BoolFlag{
Name: flagDryRun,
EnvVars: []string{"GENIUS_DRY"},
Usage: "Enable dry run to ensure resulting file is matching freshly generated one without modification. " +
"Mismatch will result in error with status code 2",
Value: false,
},
},
EnableShellCompletion: true,
}
err := app.Run(os.Args)
if err != nil {
log.Println(err)
if errors.Is(err, geniuserr.ErrDryMismatch) {
syscall.Exit(2)
}
syscall.Exit(1)
}
}