-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathmain.go
More file actions
44 lines (33 loc) · 1.06 KB
/
main.go
File metadata and controls
44 lines (33 loc) · 1.06 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
package main
import (
"os"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
"github.com/opendatahub-io/odh-cli/cmd/lint"
"github.com/opendatahub-io/odh-cli/cmd/version"
)
func main() {
flags := genericclioptions.NewConfigFlags(true).WithDeprecatedPasswordFlag()
cmd := &cobra.Command{
Use: "kubectl-odh",
Short: "kubectl plugin for ODH/RHOAI",
}
// Add kubectl-style flags to root command (inherited by subcommands).
// This exposes standard authentication flags: --server, --username, --password,
// --token, --kubeconfig, --context, --cluster, --certificate-authority,
// --client-certificate, --client-key, --insecure-skip-tls-verify, etc.
flags.AddFlags(cmd.PersistentFlags())
version.AddCommand(cmd, flags)
if err := lint.AddCommand(cmd, flags); err != nil {
if _, writeErr := os.Stderr.WriteString(err.Error() + "\n"); writeErr != nil {
os.Exit(1)
}
os.Exit(1)
}
if err := cmd.Execute(); err != nil {
if _, writeErr := os.Stderr.WriteString(err.Error() + "\n"); writeErr != nil {
os.Exit(1)
}
os.Exit(1)
}
}