-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
57 lines (47 loc) · 1.61 KB
/
Copy pathmain.go
File metadata and controls
57 lines (47 loc) · 1.61 KB
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
package main
import (
"context"
"flag"
"fmt"
"io"
"os"
"github.com/krateoplatformops/krateoctl/internal/cmd/gencrd"
"github.com/krateoplatformops/krateoctl/internal/cmd/genschema"
"github.com/krateoplatformops/krateoctl/internal/cmd/get"
"github.com/krateoplatformops/krateoctl/internal/cmd/install"
"github.com/krateoplatformops/krateoctl/internal/cmd/patch"
"github.com/krateoplatformops/krateoctl/internal/cmd/users"
"github.com/krateoplatformops/krateoctl/internal/subcommands"
"k8s.io/client-go/rest"
)
const (
appName = "krateoctl"
// Category names for subcommands
categoryInstallation = "installation management"
categoryUtilities = "utilities"
)
var (
version = "dev"
commit = "none"
)
func main() {
tool := subcommands.NewCommander(flag.CommandLine, appName)
tool.Banner = func(w io.Writer) {
fmt.Fprintf(w, "┬┌─┬─┐┌─┐┌┬┐┌─┐┌─┐Platform\n")
fmt.Fprintf(w, "├┴┐├┬┘├─┤ │ ├┤ │ │ Ops\n")
fmt.Fprintf(w, "┴ ┴┴└─┴ ┴ ┴ └─┘└─┘\n")
fmt.Fprintf(w, " CTL (ver: %s, bld: %s)\n\n", version, commit)
}
// Installation management commands
tool.Register(install.Command(), categoryInstallation)
// Utilities
tool.Register(genschema.Command(), categoryUtilities)
tool.Register(gencrd.Command(), categoryUtilities)
tool.Register(get.Command(), categoryUtilities)
tool.Register(patch.Command(), categoryUtilities)
tool.Register(users.AddCommand(), categoryUtilities)
flag.Parse()
rest.SetDefaultWarningHandler(rest.NoWarnings{})
ctx := context.Background()
os.Exit(int(tool.Execute(ctx)))
}