-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
45 lines (36 loc) · 1.3 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
// Copyright (c) 2024 Alexej Disterhoft
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
//
// SPDX-License-Identifier: MIT
// Package main implements the main entry point for the kubectl-mapr-ticket CLI. It is responsible for
// creating the root command and executing it.
//
// The root command is responsible for creating the subcommands and executing them. The subcommands
// are responsible for the actual work.
//
// If you are interested in the actual plugin documentation, please refer to the README.md file.
package main
import (
"os"
"github.com/spf13/pflag"
"github.com/nobbs/kubectl-mapr-ticket/cmd/root"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/cli-runtime/pkg/genericiooptions"
)
const (
// Name of the CLI
cliName = "kubectl mapr-ticket"
)
func main() {
// Create a set of flags to pass to the CLI
flags := pflag.NewFlagSet(cliName, pflag.ExitOnError)
pflag.CommandLine = flags
// Create a set of default Kubernetes flags and IOStreams
kubernetesConfigFlags := genericclioptions.NewConfigFlags(true)
streams := genericiooptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr}
// Create the root command and execute it
root := root.NewCmd(kubernetesConfigFlags, streams)
if err := root.Execute(); err != nil {
os.Exit(1)
}
}