forked from thomaspoignant/go-feature-flag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
36 lines (31 loc) · 779 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
package main
import (
"fmt"
"log"
"os"
"github.com/jessevdk/go-flags"
)
func main() {
var opts struct {
InputFile string `short:"f" long:"input-file" description:"Location of the flag file you want to lint." required:"true"` //nolint: lll
InputFormat string `long:"input-format" description:"Format of your input file (YAML, JSON or TOML)" required:"true"` //nolint: lll
}
_, err := flags.Parse(&opts)
if flags.WroteHelp(err) {
os.Exit(0)
}
if err != nil {
log.Fatal("impossible to parse command line parameters", err)
}
linter := Linter{
InputFile: opts.InputFile,
InputFormat: opts.InputFormat,
}
errs := linter.Lint()
if len(errs) > 0 {
for _, err := range errs {
fmt.Fprintf(os.Stderr, "%s\n", err)
}
os.Exit(len(errs))
}
}