-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdppctl.go
68 lines (54 loc) · 1.33 KB
/
dppctl.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// File: https://github.com/data-engineering-helpers/dppctl/blob/main/dppctl.go
//
package main
import (
"flag"
"log"
"os"
"gopkg.in/yaml.v3"
"github.com/data-engineering-helpers/dppctl/utilities"
"github.com/data-engineering-helpers/dppctl/workflow"
)
const AppVersion = "0.0.2-alpha.1"
var (
versionFlag bool
specFilepath string
command string
)
func init() {
flag.BoolVar(&versionFlag, "v", false, "Shows the current version")
flag.StringVar(&specFilepath, "f", "depl/aws-dev-sample.yaml",
"The `name` of the deployment YAML specification file.")
flag.StringVar(&command, "c", "check",
"The command to perform.")
}
func main() {
// Set properties of the predefined Logger, including
// the log entry prefix and a flag to disable printing
// the time, source file, and line number.
log.SetPrefix("[dppctl] ")
log.SetFlags(0)
//
flag.Parse()
if versionFlag {
log.Println(AppVersion)
os.Exit(0)
}
// Specification of the deployment
deplSpec, err := utilities.ReadSpecFile(specFilepath)
if err != nil {
log.Print(err)
}
log.Println("Parsed spec file: ", deplSpec)
deplSpecStruct, err := yaml.Marshal(&deplSpec)
if err != nil {
log.Fatalf("error: %v", err)
}
log.Println("Spec file dump:\n", string(deplSpecStruct))
//
switch command {
case "check":
workflow.Check(deplSpec)
}
}