本文整理汇总了Golang中github.com/openshift/origin/pkg/cmd/cli/cmd.NewCmdVersion函数的典型用法代码示例。如果您正苦于以下问题:Golang NewCmdVersion函数的具体用法?Golang NewCmdVersion怎么用?Golang NewCmdVersion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewCmdVersion函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: NewCommandDeployer
// NewCommandDeployer provides a CLI handler for deploy.
func NewCommandDeployer(name string) *cobra.Command {
cfg := &config{}
cmd := &cobra.Command{
Use: fmt.Sprintf("%s [--until=CONDITION]", name),
Short: "Run the deployer",
Long: deployerLong,
Run: func(c *cobra.Command, args []string) {
cfg.Out = os.Stdout
cfg.ErrOut = c.OutOrStderr()
err := cfg.RunDeployer()
if strategy.IsConditionReached(err) {
fmt.Fprintf(os.Stdout, "--> %s\n", err.Error())
return
}
kcmdutil.CheckErr(err)
},
}
cmd.AddCommand(ocmd.NewCmdVersion(name, nil, os.Stdout, ocmd.VersionOptions{}))
flag := cmd.Flags()
flag.StringVar(&cfg.rcName, "deployment", util.Env("OPENSHIFT_DEPLOYMENT_NAME", ""), "The deployment name to start")
flag.StringVar(&cfg.Namespace, "namespace", util.Env("OPENSHIFT_DEPLOYMENT_NAMESPACE", ""), "The deployment namespace")
flag.StringVar(&cfg.Until, "until", "", "Exit the deployment when this condition is met. See help for more details")
return cmd
}
开发者ID:pweil-,项目名称:origin,代码行数:29,代码来源:deployer.go
示例2: NewCommandF5Router
// NewCommandF5Router provides CLI handler for the F5 router sync plugin.
func NewCommandF5Router(name string) *cobra.Command {
options := &F5RouterOptions{
Config: clientcmd.NewConfig(),
}
options.Config.FromFile = true
cmd := &cobra.Command{
Use: fmt.Sprintf("%s%s", name, clientcmd.ConfigSyntax),
Short: "Start an F5 route synchronizer",
Long: f5Long,
Run: func(c *cobra.Command, args []string) {
options.RouterSelection.Namespace = cmdutil.GetFlagString(c, "namespace")
cmdutil.CheckErr(options.Complete())
cmdutil.CheckErr(options.Validate())
cmdutil.CheckErr(options.Run())
},
}
cmd.AddCommand(ocmd.NewCmdVersion(name, nil, os.Stdout, ocmd.VersionOptions{}))
flag := cmd.Flags()
options.Config.Bind(flag)
options.F5Router.Bind(flag)
options.RouterSelection.Bind(flag)
return cmd
}
开发者ID:mffiedler,项目名称:origin,代码行数:28,代码来源:f5.go
示例3: NewCommandDockerBuilder
// NewCommandDockerBuilder provides a CLI handler for Docker build type
func NewCommandDockerBuilder(name string) *cobra.Command {
cmd := &cobra.Command{
Use: name,
Short: "Run a Docker build",
Long: dockerBuilderLong,
Run: func(c *cobra.Command, args []string) {
err := cmd.RunDockerBuild(c.Out())
kcmdutil.CheckErr(err)
},
}
cmd.AddCommand(ocmd.NewCmdVersion(name, nil, os.Stdout, ocmd.VersionOptions{}))
return cmd
}
开发者ID:Xmagicer,项目名称:origin,代码行数:14,代码来源:builder.go
示例4: NewCommandS2IBuilder
// NewCommandS2IBuilder provides a CLI handler for S2I build type
func NewCommandS2IBuilder(name string) *cobra.Command {
cmd := &cobra.Command{
Use: name,
Short: "Run a Source-to-Image build",
Long: s2iBuilderLong,
Run: func(c *cobra.Command, args []string) {
err := cmd.RunS2IBuild(c.OutOrStderr())
kcmdutil.CheckErr(err)
},
}
cmd.AddCommand(ocmd.NewCmdVersion(name, nil, os.Stdout, ocmd.VersionOptions{}))
return cmd
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:15,代码来源:builder.go
示例5: NewCommandOpenShift
// 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
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:47,代码来源:openshift.go
示例6: NewCommand
func NewCommand(name, fullName string, out, errOut io.Writer) *cobra.Command {
cmds := &cobra.Command{
Use: name,
Short: "Kubernetes server components",
Long: fmt.Sprintf(kubernetesLong),
Run: kcmdutil.DefaultSubCommandRun(errOut),
}
cmds.AddCommand(NewAPIServerCommand("apiserver", fullName+" apiserver", out))
cmds.AddCommand(NewControllersCommand("controller-manager", fullName+" controller-manager", out))
cmds.AddCommand(NewKubeletCommand("kubelet", fullName+" kubelet", out))
cmds.AddCommand(NewProxyCommand("proxy", fullName+" proxy", out))
cmds.AddCommand(NewSchedulerCommand("scheduler", fullName+" scheduler", out))
if "hyperkube" == fullName {
cmds.AddCommand(cmd.NewCmdVersion(fullName, nil, out, cmd.VersionOptions{}))
}
return cmds
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:19,代码来源:kubernetes.go
示例7: NewCommand
func NewCommand(name, fullName string, out io.Writer) *cobra.Command {
cmds := &cobra.Command{
Use: name,
Short: "Kubernetes server components",
Long: fmt.Sprintf(kubernetesLong),
Run: func(c *cobra.Command, args []string) {
c.SetOutput(os.Stdout)
c.Help()
},
}
cmds.AddCommand(NewAPIServerCommand("apiserver", fullName+" apiserver", out))
cmds.AddCommand(NewControllersCommand("controller-manager", fullName+" controller-manager", out))
cmds.AddCommand(NewKubeletCommand("kubelet", fullName+" kubelet", out))
cmds.AddCommand(NewProxyCommand("proxy", fullName+" proxy", out))
cmds.AddCommand(NewSchedulerCommand("scheduler", fullName+" scheduler", out))
if "hyperkube" == fullName {
cmds.AddCommand(cmd.NewCmdVersion(fullName, nil, out, cmd.VersionOptions{}))
}
return cmds
}
开发者ID:Xmagicer,项目名称:origin,代码行数:22,代码来源:kubernetes.go
示例8: NewCommandAdmin
//.........这里部分代码省略.........
Long: fmt.Sprintf(adminLong),
Run: kcmdutil.DefaultSubCommandRun(out),
}
f := clientcmd.New(cmds.PersistentFlags())
groups := templates.CommandGroups{
{
Message: "Component Installation:",
Commands: []*cobra.Command{
router.NewCmdRouter(f, fullName, "router", out, errout),
exipfailover.NewCmdIPFailoverConfig(f, fullName, "ipfailover", out, errout),
registry.NewCmdRegistry(f, fullName, "registry", out, errout),
},
},
{
Message: "Security and Policy:",
Commands: []*cobra.Command{
project.NewCmdNewProject(project.NewProjectRecommendedName, fullName+" "+project.NewProjectRecommendedName, f, out),
policy.NewCmdPolicy(policy.PolicyRecommendedName, fullName+" "+policy.PolicyRecommendedName, f, out, errout),
groups.NewCmdGroups(groups.GroupsRecommendedName, fullName+" "+groups.GroupsRecommendedName, f, out, errout),
cert.NewCmdCert(cert.CertRecommendedName, fullName+" "+cert.CertRecommendedName, out, errout),
admin.NewCommandOverwriteBootstrapPolicy(admin.OverwriteBootstrapPolicyCommandName, fullName+" "+admin.OverwriteBootstrapPolicyCommandName, fullName+" "+admin.CreateBootstrapPolicyFileCommand, out),
},
},
{
Message: "Node Management:",
Commands: []*cobra.Command{
admin.NewCommandNodeConfig(admin.NodeConfigCommandName, fullName+" "+admin.NodeConfigCommandName, out),
node.NewCommandManageNode(f, node.ManageNodeCommandName, fullName+" "+node.ManageNodeCommandName, out, errout),
cmdutil.ReplaceCommandName("kubectl", fullName, templates.Normalize(kubectl.NewCmdCordon(f, out))),
cmdutil.ReplaceCommandName("kubectl", fullName, templates.Normalize(kubectl.NewCmdUncordon(f, out))),
cmdutil.ReplaceCommandName("kubectl", fullName, templates.Normalize(kubectl.NewCmdDrain(f, out, errout))),
cmdutil.ReplaceCommandName("kubectl", fullName, templates.Normalize(kubectl.NewCmdTaint(f, out))),
network.NewCmdPodNetwork(network.PodNetworkCommandName, fullName+" "+network.PodNetworkCommandName, f, out, errout),
},
},
{
Message: "Maintenance:",
Commands: []*cobra.Command{
diagnostics.NewCmdDiagnostics(diagnostics.DiagnosticsRecommendedName, fullName+" "+diagnostics.DiagnosticsRecommendedName, out),
prune.NewCommandPrune(prune.PruneRecommendedName, fullName+" "+prune.PruneRecommendedName, f, out, errout),
buildchain.NewCmdBuildChain(name, fullName+" "+buildchain.BuildChainRecommendedCommandName, f, out),
migrate.NewCommandMigrate(
migrate.MigrateRecommendedName, fullName+" "+migrate.MigrateRecommendedName, f, out, errout,
// Migration commands
migrateimages.NewCmdMigrateImageReferences("image-references", fullName+" "+migrate.MigrateRecommendedName+" image-references", f, in, out, errout),
migratestorage.NewCmdMigrateAPIStorage("storage", fullName+" "+migrate.MigrateRecommendedName+" storage", f, in, out, errout),
),
top.NewCommandTop(top.TopRecommendedName, fullName+" "+top.TopRecommendedName, f, out, errout),
},
},
{
Message: "Configuration:",
Commands: []*cobra.Command{
admin.NewCommandCreateKubeConfig(admin.CreateKubeConfigCommandName, fullName+" "+admin.CreateKubeConfigCommandName, out),
admin.NewCommandCreateClient(admin.CreateClientCommandName, fullName+" "+admin.CreateClientCommandName, out),
admin.NewCommandCreateBootstrapProjectTemplate(f, admin.CreateBootstrapProjectTemplateCommand, fullName+" "+admin.CreateBootstrapProjectTemplateCommand, out),
admin.NewCommandCreateBootstrapPolicyFile(admin.CreateBootstrapPolicyFileCommand, fullName+" "+admin.CreateBootstrapPolicyFileCommand, out),
admin.NewCommandCreateLoginTemplate(f, admin.CreateLoginTemplateCommand, fullName+" "+admin.CreateLoginTemplateCommand, out),
admin.NewCommandCreateProviderSelectionTemplate(f, admin.CreateProviderSelectionTemplateCommand, fullName+" "+admin.CreateProviderSelectionTemplateCommand, out),
admin.NewCommandCreateErrorTemplate(f, admin.CreateErrorTemplateCommand, fullName+" "+admin.CreateErrorTemplateCommand, out),
},
},
}
groups.Add(cmds)
templates.ActsAsRootCommand(cmds, []string{"options"}, groups...)
// Deprecated commands that are bundled with the binary but not displayed to end users directly
deprecatedCommands := []*cobra.Command{
admin.NewCommandCreateMasterCerts(admin.CreateMasterCertsCommandName, fullName+" "+admin.CreateMasterCertsCommandName, out),
admin.NewCommandCreateKeyPair(admin.CreateKeyPairCommandName, fullName+" "+admin.CreateKeyPairCommandName, out),
admin.NewCommandCreateServerCert(admin.CreateServerCertCommandName, fullName+" "+admin.CreateServerCertCommandName, out),
admin.NewCommandCreateSignerCert(admin.CreateSignerCertCommandName, fullName+" "+admin.CreateSignerCertCommandName, out),
}
for _, cmd := range deprecatedCommands {
// Unsetting Short description will not show this command in help
cmd.Short = ""
cmd.Deprecated = fmt.Sprintf("Use '%s ca' instead.", fullName)
cmds.AddCommand(cmd)
}
cmds.AddCommand(
// part of every root command
cmd.NewCmdConfig(fullName, "config", out, errout),
cmd.NewCmdCompletion(fullName, f, out),
// hidden
cmd.NewCmdOptions(out),
)
if name == fullName {
cmds.AddCommand(cmd.NewCmdVersion(fullName, f, out, cmd.VersionOptions{}))
}
return cmds
}
开发者ID:xgwang-zte,项目名称:origin,代码行数:101,代码来源:admin.go
示例9: NewCommandCLI
//.........这里部分代码省略.........
rollout.NewCmdRollout(fullName, f, out),
cmd.NewCmdDeploy(fullName, f, out),
cmd.NewCmdRollback(fullName, f, out),
cmd.NewCmdNewBuild(cmd.NewBuildRecommendedCommandName, fullName, f, in, out),
cmd.NewCmdStartBuild(fullName, f, in, out),
cmd.NewCmdCancelBuild(cmd.CancelBuildRecommendedCommandName, fullName, f, in, out),
cmd.NewCmdImportImage(fullName, f, out, errout),
cmd.NewCmdTag(fullName, f, out),
},
},
{
Message: "Application Management Commands:",
Commands: []*cobra.Command{
cmd.NewCmdGet(fullName, f, out, errout),
cmd.NewCmdDescribe(fullName, f, out, errout),
cmd.NewCmdEdit(fullName, f, out, errout),
set.NewCmdSet(fullName, f, in, out, errout),
cmd.NewCmdLabel(fullName, f, out),
cmd.NewCmdAnnotate(fullName, f, out),
cmd.NewCmdExpose(fullName, f, out),
cmd.NewCmdDelete(fullName, f, out),
cmd.NewCmdScale(fullName, f, out),
cmd.NewCmdAutoscale(fullName, f, out),
secretcmds,
sa.NewCmdServiceAccounts(sa.ServiceAccountsRecommendedName, fullName+" "+sa.ServiceAccountsRecommendedName, f, out),
},
},
{
Message: "Troubleshooting and Debugging Commands:",
Commands: []*cobra.Command{
cmd.NewCmdLogs(cmd.LogsRecommendedCommandName, fullName, f, out),
cmd.NewCmdRsh(cmd.RshRecommendedName, fullName, f, in, out, errout),
rsync.NewCmdRsync(rsync.RsyncRecommendedName, fullName, f, out, errout),
cmd.NewCmdPortForward(fullName, f, out, errout),
cmd.NewCmdDebug(fullName, f, in, out, errout),
cmd.NewCmdExec(fullName, f, in, out, errout),
cmd.NewCmdProxy(fullName, f, out),
cmd.NewCmdAttach(fullName, f, in, out, errout),
cmd.NewCmdRun(fullName, f, in, out, errout),
},
},
{
Message: "Advanced Commands:",
Commands: []*cobra.Command{
admin.NewCommandAdmin("adm", fullName+" "+"adm", in, out, errout),
cmd.NewCmdCreate(fullName, f, out),
cmd.NewCmdReplace(fullName, f, out),
cmd.NewCmdApply(fullName, f, out),
cmd.NewCmdPatch(fullName, f, out),
cmd.NewCmdProcess(fullName, f, out),
cmd.NewCmdExport(fullName, f, in, out),
cmd.NewCmdExtract(fullName, f, in, out, errout),
observe.NewCmdObserve(fullName, f, out, errout),
policy.NewCmdPolicy(policy.PolicyRecommendedName, fullName+" "+policy.PolicyRecommendedName, f, out),
cmd.NewCmdConvert(fullName, f, out),
importer.NewCmdImport(fullName, f, in, out, errout),
},
},
{
Message: "Settings Commands:",
Commands: []*cobra.Command{
login.NewCmdLogout("logout", fullName+" logout", fullName+" login", f, in, out),
cmd.NewCmdConfig(fullName, "config"),
cmd.NewCmdWhoAmI(cmd.WhoAmIRecommendedCommandName, fullName+" "+cmd.WhoAmIRecommendedCommandName, f, out),
cmd.NewCmdCompletion(fullName, f, out),
},
},
}
groups.Add(cmds)
filters := []string{
"options",
// These commands are deprecated and should not appear in help
moved(fullName, "set env", cmds, set.NewCmdEnv(fullName, f, in, out)),
moved(fullName, "set volume", cmds, set.NewCmdVolume(fullName, f, out, errout)),
moved(fullName, "logs", cmds, cmd.NewCmdBuildLogs(fullName, f, out)),
moved(fullName, "secrets link", secretcmds, secrets.NewCmdLinkSecret("add", fullName, f.Factory, out)),
}
changeSharedFlagDefaults(cmds)
templates.ActsAsRootCommand(cmds, filters, groups...).
ExposeFlags(loginCmd, "certificate-authority", "insecure-skip-tls-verify", "token")
// experimental commands are those that are bundled with the binary but not displayed to end users
// directly
experimental := &cobra.Command{
Use: "ex", // Because this command exposes no description, it will not be shown in help
}
experimental.AddCommand(
dockerbuild.NewCmdDockerbuild(fullName, f, out, errout),
)
cmds.AddCommand(experimental)
if name == fullName {
cmds.AddCommand(cmd.NewCmdVersion(fullName, f, out, cmd.VersionOptions{PrintClientFeatures: true}))
}
cmds.AddCommand(cmd.NewCmdOptions(out))
return cmds
}
开发者ID:pweil-,项目名称:origin,代码行数:101,代码来源:cli.go
注:本文中的github.com/openshift/origin/pkg/cmd/cli/cmd.NewCmdVersion函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论