Some checks failed
CodeQL / Analyze (csharp) (push) Has been cancelled
Close Stale Issues / close_stale_issues (push) Has been cancelled
repo-sync / repo-sync (push) Has been cancelled
auto-deploy-tencent-scf / pre-check (push) Has been cancelled
auto-deploy-tencent-scf / deploy serverless (push) Has been cancelled
40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package cmd
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/spf13/cobra"
|
|
"k8s.io/cli-runtime/pkg/genericclioptions"
|
|
)
|
|
|
|
const (
|
|
biliproDesc = `Manage and deploy bilibili pro tools on k8s`
|
|
kubeconfig = "kubeconfig"
|
|
)
|
|
|
|
var (
|
|
confPath string
|
|
rootCmd = &cobra.Command{
|
|
Use: "bilipro",
|
|
Long: biliproDesc,
|
|
SilenceUsage: true,
|
|
}
|
|
)
|
|
|
|
func init() {
|
|
rootCmd.PersistentFlags().StringVar(&confPath, kubeconfig, "", "Custom kubeconfig path")
|
|
|
|
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
|
|
}
|
|
|
|
// New creates a new root command for kubectl-bilipro
|
|
func NewExecutor(streams genericclioptions.IOStreams) *cobra.Command {
|
|
cobra.EnableCommandSorting = false
|
|
rootCmd.AddCommand(newInitCmd(rootCmd.OutOrStdout(), rootCmd.ErrOrStderr()))
|
|
// If you want to update, just init again
|
|
rootCmd.AddCommand(newGetCmd(rootCmd.OutOrStdout(), rootCmd.ErrOrStderr()))
|
|
rootCmd.AddCommand(newDeleteCmd(rootCmd.OutOrStdout(), rootCmd.ErrOrStderr()))
|
|
rootCmd.AddCommand(newVersionCmd(rootCmd.OutOrStdout(), rootCmd.ErrOrStderr()))
|
|
return rootCmd
|
|
}
|