-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
49 lines (40 loc) · 1.11 KB
/
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
48
49
package main
import (
"flag"
"fmt"
"log"
"os"
"github.com/aztfmod/caflint/lint"
)
var cafLintconfig string = "./.caflint.hcl"
func main() {
logger := log.New(os.Stderr, "", 0)
exiter := lint.NewExiter(os.Exit)
lzPath := flag.String("lz", "", "path to the landing zone")
configPath := flag.String("var-folder", "", "path to caf configs")
showAll := flag.Bool("show-all", false, "show all available configurations")
flag.Parse()
var cafConfig lint.CafConfig
if _, err := os.Stat(cafLintconfig); err == nil {
config, err := lint.ParseCafLintFile(cafLintconfig)
if err != nil {
panic(err)
}
cafConfig = *config
}
var landingZonePath string = *lzPath
var configurationPath string = *configPath
if *lzPath == "" {
landingZonePath = cafConfig.LandingZonePath
}
if *configPath == "" {
configurationPath = cafConfig.ConfigPath
}
if *showAll {
fmt.Printf("Landing Zone: %s\n", landingZonePath)
fmt.Printf("Available Configurations:\n-------------------------\n")
lint.ShowAll(logger, exiter, landingZonePath)
} else {
lint.CafLint(logger, exiter, landingZonePath, configurationPath)
}
}