Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions pkg/cmd/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,21 @@ func NewCommandCLI(name, fullName string) *cobra.Command {
func NewCmdKubectl(name string) *cobra.Command {
flags := pflag.NewFlagSet("", pflag.ContinueOnError)
f := clientcmd.New(flags)
cmd := kubecmd.NewKubectlCommand(f.Factory, os.Stdin, os.Stdout, os.Stderr)
cmd.Aliases = []string{"kubectl"}
cmd.Use = name
cmd.Short = "Kubernetes cluster management via kubectl"
cmd.Long = cmd.Long + "\n\nThis command is provided for direct management of the Kubernetes cluster OpenShift runs on."
out := os.Stdout
cmds := kubecmd.NewKubectlCommand(f.Factory, os.Stdin, os.Stdout, os.Stderr)
cmds.Aliases = []string{"kubectl"}
cmds.Use = name
cmds.Short = "Kubernetes cluster management via kubectl"
cmds.Long = cmds.Long + "\n\nThis command is provided for direct management of the Kubernetes cluster OpenShift runs on."
flags.VisitAll(func(flag *pflag.Flag) {
if f := cmd.PersistentFlags().Lookup(flag.Name); f == nil {
cmd.PersistentFlags().AddFlag(flag)
if f := cmds.PersistentFlags().Lookup(flag.Name); f == nil {
cmds.PersistentFlags().AddFlag(flag)
} else {
glog.V(6).Infof("already registered flag %s", flag.Name)
}
})
return cmd
cmds.AddCommand(cmd.NewCmdOptions(f, out))
return cmds
}

// applyToCreate injects the deprecation notice about for 'apply' command into
Expand Down
3 changes: 3 additions & 0 deletions pkg/cmd/openshift/openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/openshift/origin/pkg/cmd/admin"
"github.com/openshift/origin/pkg/cmd/cli"
"github.com/openshift/origin/pkg/cmd/cli/cmd"
"github.com/openshift/origin/pkg/cmd/experimental/buildchain"
"github.com/openshift/origin/pkg/cmd/experimental/bundlesecret"
"github.com/openshift/origin/pkg/cmd/experimental/generate"
Expand Down Expand Up @@ -125,6 +126,7 @@ func newExperimentalCommand(parentName, name string) *cobra.Command {
}

f := clientcmd.New(experimental.PersistentFlags())
out := os.Stdout

subName := fmt.Sprintf("%s %s", parentName, name)
experimental.AddCommand(project.NewCmdNewProject(f, subName, "new-project"))
Expand All @@ -135,5 +137,6 @@ func newExperimentalCommand(parentName, name string) *cobra.Command {
experimental.AddCommand(exregistry.NewCmdRegistry(f, subName, "registry", os.Stdout))
experimental.AddCommand(buildchain.NewCmdBuildChain(f, subName, "build-chain"))
experimental.AddCommand(bundlesecret.NewCmdBundleSecret(f, subName, "bundle-secret", os.Stdout))
experimental.AddCommand(cmd.NewCmdOptions(f, out))
return experimental
}