/
main.go
46 lines (37 loc) · 1.09 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
package main
import (
"log"
"os"
"github.com/spf13/pflag"
_ "k8s.io/client-go/plugin/pkg/client/auth/exec"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
"github.com/theketchio/ketch/cmd/ketch/configuration"
"github.com/theketchio/ketch/internal/pack"
)
var (
// version is set by goreleaser.
version = "dev"
)
func main() {
// Remove any flags that were added by libraries automatically.
pflag.CommandLine = pflag.NewFlagSet("ketch", pflag.ExitOnError)
out := os.Stdout
packSvc, err := pack.New(out)
if err != nil {
log.Fatalf("couldn't create pack service %q", err)
}
cmd := newRootCmd(&configuration.Configuration{}, out, packSvc, getKetchConfig())
if err := cmd.Execute(); err != nil {
log.Fatalf("execution failed %q", err)
}
}
// the KetchConfig is optional and in the event it is not found an empty one is returned
func getKetchConfig() configuration.KetchConfig {
path, err := configuration.DefaultConfigPath()
if err != nil {
log.Println(err)
return configuration.KetchConfig{}
}
return configuration.Read(path)
}