// NewCommandOpenShift creates the standard OpenShift command func NewCommandOpenShift(name string) *cobra.Command { in, out, errout := os.Stdin, term.NewResponsiveWriter(os.Stdout), os.Stderr root := &cobra.Command{ Use: name, Short: "Build, deploy, and manage your cloud applications", Long: fmt.Sprintf(openshiftLong, name, cmdutil.GetPlatformName(name), cmdutil.GetDistributionName(name)), Run: kcmdutil.DefaultSubCommandRun(out), } f := clientcmd.New(pflag.NewFlagSet("", pflag.ContinueOnError)) startAllInOne, _ := start.NewCommandStartAllInOne(name, out, errout) root.AddCommand(startAllInOne) root.AddCommand(admin.NewCommandAdmin("admin", name+" admin", in, out, errout)) root.AddCommand(cli.NewCommandCLI("cli", name+" cli", in, out, errout)) root.AddCommand(cli.NewCmdKubectl("kube", out)) root.AddCommand(newExperimentalCommand("ex", name+" ex")) root.AddCommand(newCompletionCommand("completion", name+" completion")) root.AddCommand(cmd.NewCmdVersion(name, f, out, cmd.VersionOptions{PrintEtcdVersion: true, IsServer: true})) // infra commands are those that are bundled with the binary but not displayed to end users // directly infra := &cobra.Command{ Use: "infra", // Because this command exposes no description, it will not be shown in help } infra.AddCommand( irouter.NewCommandTemplateRouter("router"), irouter.NewCommandF5Router("f5-router"), deployer.NewCommandDeployer("deploy"), recycle.NewCommandRecycle("recycle", out), builder.NewCommandS2IBuilder("sti-build"), builder.NewCommandDockerBuilder("docker-build"), diagnostics.NewCommandPodDiagnostics("diagnostic-pod", out), diagnostics.NewCommandNetworkPodDiagnostics("network-diagnostic-pod", out), ) root.AddCommand(infra) root.AddCommand(cmd.NewCmdOptions(out)) // TODO: add groups templates.ActsAsRootCommand(root, []string{"options"}) return root }
// NewCommandOpenShift creates the standard OpenShift command func NewCommandOpenShift(name string) *cobra.Command { in, out, errout := os.Stdin, os.Stdout, os.Stderr root := &cobra.Command{ Use: name, Short: "Build, deploy, and manage your cloud applications", Long: fmt.Sprintf(openshiftLong, name, cmdutil.GetPlatformName(name), cmdutil.GetDistributionName(name)), Run: cmdutil.DefaultSubCommandRun(out), } startAllInOne, _ := start.NewCommandStartAllInOne(name, out) root.AddCommand(startAllInOne) root.AddCommand(admin.NewCommandAdmin("admin", name+" admin", out)) root.AddCommand(cli.NewCommandCLI("cli", name+" cli", in, out, errout)) root.AddCommand(cli.NewCmdKubectl("kube", out)) root.AddCommand(newExperimentalCommand("ex", name+" ex")) root.AddCommand(version.NewVersionCommand(name, true)) // infra commands are those that are bundled with the binary but not displayed to end users // directly infra := &cobra.Command{ Use: "infra", // Because this command exposes no description, it will not be shown in help } infra.AddCommand( irouter.NewCommandTemplateRouter("router"), irouter.NewCommandF5Router("f5-router"), deployer.NewCommandDeployer("deploy"), builder.NewCommandSTIBuilder("sti-build"), builder.NewCommandDockerBuilder("docker-build"), diagnostics.NewCommandPodDiagnostics("diagnostic-pod", out), ) root.AddCommand(infra) root.AddCommand(cmd.NewCmdOptions(out)) // TODO: add groups templates.ActsAsRootCommand(root) return root }