本文整理汇总了Golang中github.com/openshift/origin/pkg/cmd/util/clientcmd.Factory类的典型用法代码示例。如果您正苦于以下问题:Golang Factory类的具体用法?Golang Factory怎么用?Golang Factory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Factory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: setupAppConfig
func setupAppConfig(f *clientcmd.Factory, c *cobra.Command, args []string, config *newcmd.AppConfig) error {
namespace, _, err := f.DefaultNamespace()
if err != nil {
return err
}
dockerClient, _, err := dockerutil.NewHelper().GetClient()
if err == nil {
if err = dockerClient.Ping(); err == nil {
config.SetDockerClient(dockerClient)
}
}
if err != nil {
glog.V(2).Infof("No local Docker daemon detected: %v", err)
}
osclient, _, err := f.Clients()
if err != nil {
return err
}
config.SetOpenShiftClient(osclient, namespace)
unknown := config.AddArguments(args)
if len(unknown) != 0 {
return cmdutil.UsageError(c, "Did not recognize the following arguments: %v", unknown)
}
return nil
}
开发者ID:patrykattc,项目名称:origin,代码行数:29,代码来源:newapp.go
示例2: Complete
// Complete verifies command line arguments and loads data from the command environment
func (o *RsyncOptions) Complete(f *clientcmd.Factory, cmd *cobra.Command, args []string) error {
switch n := len(args); {
case n == 0:
cmd.Help()
fallthrough
case n < 2:
return kcmdutil.UsageError(cmd, "SOURCE_DIR and POD:DESTINATION_DIR are required arguments")
case n > 2:
return kcmdutil.UsageError(cmd, "only SOURCE_DIR and POD:DESTINATION_DIR should be specified as arguments")
}
// Set main command arguments
var err error
o.Source, err = parsePathSpec(args[0])
if err != nil {
return err
}
o.Destination, err = parsePathSpec(args[1])
if err != nil {
return err
}
namespace, _, err := f.DefaultNamespace()
if err != nil {
return err
}
o.Namespace = namespace
o.Strategy, err = o.determineStrategy(f, cmd, o.StrategyName)
if err != nil {
return err
}
return nil
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:36,代码来源:rsync.go
示例3: NewCmdNewBuild
// NewCmdNewBuild implements the OpenShift cli new-build command
func NewCmdNewBuild(fullName string, f *clientcmd.Factory, in io.Reader, out io.Writer) *cobra.Command {
mapper, typer := f.Object()
clientMapper := f.ClientMapperForCommand()
config := newcmd.NewAppConfig(typer, mapper, clientMapper)
cmd := &cobra.Command{
Use: "new-build (IMAGE | IMAGESTREAM | PATH | URL ...)",
Short: "Create a new build configuration",
Long: newBuildLong,
Example: fmt.Sprintf(newBuildExample, fullName),
Run: func(c *cobra.Command, args []string) {
config.AddEnvironmentToBuild = true
err := RunNewBuild(fullName, f, out, in, c, args, config)
if err == errExit {
os.Exit(1)
}
cmdutil.CheckErr(err)
},
}
cmd.Flags().Var(&config.SourceRepositories, "code", "Source code in the build configuration.")
cmd.Flags().VarP(&config.ImageStreams, "image", "i", "Name of an image stream to to use as a builder.")
cmd.Flags().Var(&config.DockerImages, "docker-image", "Name of a Docker image to use as a builder.")
cmd.Flags().StringVar(&config.Name, "name", "", "Set name to use for generated build artifacts")
cmd.Flags().VarP(&config.Environment, "env", "e", "Specify key value pairs of environment variables to set into resulting image.")
cmd.Flags().StringVar(&config.Strategy, "strategy", "", "Specify the build strategy to use if you don't want to detect (docker|source).")
cmd.Flags().StringVarP(&config.Dockerfile, "dockerfile", "D", "", "Specify the contents of a Dockerfile to build directly, implies --strategy=docker. Pass '-' to read from STDIN.")
cmd.Flags().BoolVar(&config.OutputDocker, "to-docker", false, "Have the build output push to a Docker repository.")
cmd.Flags().StringP("labels", "l", "", "Label to set in all generated resources.")
cmdutil.AddPrinterFlags(cmd)
return cmd
}
开发者ID:vedlad,项目名称:origin,代码行数:34,代码来源:newbuild.go
示例4: NewCmdNewProject
// NewCmdNewProject implements the OpenShift cli new-project command
func NewCmdNewProject(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
options := &NewProjectOptions{}
cmd := &cobra.Command{
Use: name + " NAME [--display-name=DISPLAYNAME] [--description=DESCRIPTION]",
Short: "Create a new project",
Long: newProjectLong,
Run: func(cmd *cobra.Command, args []string) {
if err := options.complete(args); err != nil {
kcmdutil.CheckErr(kcmdutil.UsageError(cmd, err.Error()))
}
var err error
if options.Client, _, err = f.Clients(); err != nil {
kcmdutil.CheckErr(err)
}
// We can't depend on len(options.NodeSelector) > 0 as node-selector="" is valid
// and we want to populate node selector as project annotation only if explicitly set by user
useNodeSelector := cmd.Flag("node-selector").Changed
if err := options.Run(useNodeSelector); err != nil {
kcmdutil.CheckErr(err)
}
},
}
cmd.Flags().StringVar(&options.AdminRole, "admin-role", bootstrappolicy.AdminRoleName, "Project admin role name in the cluster policy")
cmd.Flags().StringVar(&options.AdminUser, "admin", "", "Project admin username")
cmd.Flags().StringVar(&options.DisplayName, "display-name", "", "Project display name")
cmd.Flags().StringVar(&options.Description, "description", "", "Project description")
cmd.Flags().StringVar(&options.NodeSelector, "node-selector", "", "Restrict pods onto nodes matching given label selector. Format: '<key1>=<value1>, <key2>=<value2>...'. Specifying \"\" means any node, not default. If unspecified, cluster default node selector will be used.")
return cmd
}
开发者ID:jhadvig,项目名称:origin,代码行数:36,代码来源:new_project.go
示例5: Complete
func (o *RoleModificationOptions) Complete(f *clientcmd.Factory, args []string, target *[]string, targetName string, isNamespaced bool) error {
if len(args) < 2 {
return fmt.Errorf("you must specify at least two arguments: <role> <%s> [%s]...", targetName, targetName)
}
o.RoleName = args[0]
*target = append(*target, args[1:]...)
osClient, _, err := f.Clients()
if err != nil {
return err
}
if isNamespaced {
roleBindingNamespace, _, err := f.DefaultNamespace()
if err != nil {
return err
}
o.RoleBindingAccessor = NewLocalRoleBindingAccessor(roleBindingNamespace, osClient)
} else {
o.RoleBindingAccessor = NewClusterRoleBindingAccessor(osClient)
}
return nil
}
开发者ID:abhgupta,项目名称:origin,代码行数:27,代码来源:modify_roles.go
示例6: Complete
// Complete turns a partially defined TopImagesOptions into a solvent structure
// which can be validated and used for showing limits usage.
func (o *TopImagesOptions) Complete(f *clientcmd.Factory, cmd *cobra.Command, args []string, out io.Writer) error {
osClient, kClient, err := f.Clients()
if err != nil {
return err
}
namespace := cmd.Flag("namespace").Value.String()
if len(namespace) == 0 {
namespace = kapi.NamespaceAll
}
o.out = out
allImages, err := osClient.Images().List(kapi.ListOptions{})
if err != nil {
return err
}
o.Images = allImages
allStreams, err := osClient.ImageStreams(namespace).List(kapi.ListOptions{})
if err != nil {
return err
}
o.Streams = allStreams
allPods, err := kClient.Pods(namespace).List(kapi.ListOptions{})
if err != nil {
return err
}
o.Pods = allPods
return nil
}
开发者ID:ncdc,项目名称:origin,代码行数:33,代码来源:images.go
示例7: Complete
func (o *MigrateImageReferenceOptions) Complete(f *clientcmd.Factory, c *cobra.Command, args []string) error {
var remainingArgs []string
for _, s := range args {
if !strings.Contains(s, "=") {
remainingArgs = append(remainingArgs, s)
continue
}
mapping, err := ParseMapping(s)
if err != nil {
return err
}
o.Mappings = append(o.Mappings, mapping)
}
o.UpdatePodSpecFn = f.UpdatePodSpecForObject
if len(remainingArgs) > 0 {
return fmt.Errorf("all arguments must be valid FROM=TO mappings")
}
o.ResourceOptions.SaveFn = o.save
if err := o.ResourceOptions.Complete(f, c); err != nil {
return err
}
osclient, _, err := f.Clients()
if err != nil {
return err
}
o.Client = osclient
return nil
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:33,代码来源:imagerefs.go
示例8: Run
func (o *NewApplicationOptions) Run(f *clientcmd.Factory) error {
application := &applicationapi.Application{}
namespace, _, err := f.DefaultNamespace()
if err != nil {
return err
}
_, err = o.Client.Applications(namespace).Get(o.Name)
if err == nil {
return errors.New(fmt.Sprintf("application %s already exists", o.Name))
}
application.Spec.Items = o.Items
application.Annotations = make(map[string]string)
application.Labels = map[string]string{}
application.Name = o.Name
application.GenerateName = o.Name
if _, err = o.Client.Applications(namespace).Create(application); err != nil {
return err
}
return nil
}
开发者ID:asiainfoLDP,项目名称:datafactory,代码行数:25,代码来源:application.go
示例9: NewCmdApplication
func NewCmdApplication(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
options := &NewApplicationOptions{}
options.Out = out
cmd := &cobra.Command{
Use: `new-application NAME [--items="KIND=KINDNAME,KIND=KINDNAME"]`,
Short: "create a new application",
Long: newApplicationLong,
Example: fmt.Sprintf(newApplicationExample, fullName),
Run: func(cmd *cobra.Command, args []string) {
var err error
if err = options.complete(cmd, f); err != nil {
kcmdutil.CheckErr(err)
return
}
if options.Client, _, err = f.Clients(); err != nil {
kcmdutil.CheckErr(err)
}
if err := options.Run(f); err != nil {
fmt.Printf("run err %s\n", err.Error())
} else {
fmt.Printf("create application %s success.\n", options.Name)
}
},
}
cmd.Flags().StringVar(&options.Item, "items", "", "application items")
return cmd
}
开发者ID:asiainfoLDP,项目名称:datafactory,代码行数:32,代码来源:application.go
示例10: RunGraph
// RunGraph contains all the necessary functionality for the OpenShift cli graph command
func RunGraph(f *clientcmd.Factory, out io.Writer) error {
client, kclient, err := f.Clients()
if err != nil {
return err
}
config, err := f.OpenShiftClientConfig.ClientConfig()
if err != nil {
return err
}
namespace, _, err := f.DefaultNamespace()
if err != nil {
return err
}
describer := &describe.ProjectStatusDescriber{K: kclient, C: client, Server: config.Host}
g, _, err := describer.MakeGraph(namespace)
if err != nil {
return err
}
data, err := dot.Marshal(g, namespace, "", " ", false)
if err != nil {
return err
}
fmt.Fprintf(out, "%s", string(data))
return nil
}
开发者ID:ncantor,项目名称:origin,代码行数:31,代码来源:status.go
示例11: Complete
func (o *NewServiceAccountTokenOptions) Complete(args []string, requestedLabels string, f *clientcmd.Factory, cmd *cobra.Command) error {
if len(args) != 1 {
return cmdutil.UsageError(cmd, fmt.Sprintf("expected one service account name as an argument, got %q", args))
}
o.SAName = args[0]
if len(requestedLabels) > 0 {
labels, err := kubectl.ParseLabels(requestedLabels)
if err != nil {
return cmdutil.UsageError(cmd, err.Error())
}
o.Labels = labels
}
client, err := f.Client()
if err != nil {
return err
}
namespace, _, err := f.DefaultNamespace()
if err != nil {
return fmt.Errorf("could not retrieve default namespace: %v", err)
}
o.SAClient = client.ServiceAccounts(namespace)
o.SecretsClient = client.Secrets(namespace)
return nil
}
开发者ID:RomainVabre,项目名称:origin,代码行数:29,代码来源:newtoken.go
示例12: RunStatus
// RunStatus contains all the necessary functionality for the OpenShift cli status command
func RunStatus(f *clientcmd.Factory, out io.Writer) error {
client, kclient, err := f.Clients()
if err != nil {
return err
}
config, err := f.OpenShiftClientConfig.ClientConfig()
if err != nil {
return err
}
namespace, _, err := f.DefaultNamespace()
if err != nil {
return err
}
describer := &describe.ProjectStatusDescriber{K: kclient, C: client, Server: config.Host}
s, err := describer.Describe(namespace, "")
if err != nil {
return err
}
fmt.Fprintf(out, s)
return nil
}
开发者ID:ncantor,项目名称:origin,代码行数:26,代码来源:status.go
示例13: RunWhoAmI
func RunWhoAmI(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, args []string, o *WhoAmIOptions) error {
if kcmdutil.GetFlagBool(cmd, "token") {
cfg, err := f.OpenShiftClientConfig.ClientConfig()
if err != nil {
return err
}
if len(cfg.BearerToken) == 0 {
return fmt.Errorf("no token is currently in use for this session")
}
fmt.Fprintf(out, "%s\n", cfg.BearerToken)
return nil
}
if kcmdutil.GetFlagBool(cmd, "context") {
cfg, err := f.OpenShiftClientConfig.RawConfig()
if err != nil {
return err
}
if len(cfg.CurrentContext) == 0 {
return fmt.Errorf("no context has been set")
}
fmt.Fprintf(out, "%s\n", cfg.CurrentContext)
return nil
}
client, _, err := f.Clients()
if err != nil {
return err
}
o.UserInterface = client.Users()
o.Out = out
_, err = o.WhoAmI()
return err
}
开发者ID:cjnygard,项目名称:origin,代码行数:35,代码来源:whoami.go
示例14: RunReconcileSCCs
// RunReconcileSCCs contains the functionality for the reconcile-sccs command for making or
// previewing changes.
func (o *ReconcileSCCOptions) RunReconcileSCCs(cmd *cobra.Command, f *clientcmd.Factory) error {
// get sccs that need updated
changedSCCs, err := o.ChangedSCCs()
if err != nil {
return err
}
if len(changedSCCs) == 0 {
return nil
}
if !o.Confirmed {
list := &kapi.List{}
for _, item := range changedSCCs {
list.Items = append(list.Items, item)
}
mapper, _ := f.Object(false)
fn := cmdutil.VersionedPrintObject(f.PrintObject, cmd, mapper, o.Out)
if err := fn(list); err != nil {
return err
}
}
if o.Confirmed {
return o.ReplaceChangedSCCs(changedSCCs)
}
return nil
}
开发者ID:php-coder,项目名称:origin,代码行数:30,代码来源:reconcile_sccs.go
示例15: NewCmdNewBuild
// NewCmdNewBuild implements the OpenShift cli new-build command
func NewCmdNewBuild(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
mapper, typer := f.Object()
clientMapper := f.ClientMapperForCommand()
config := newcmd.NewAppConfig(typer, mapper, clientMapper)
cmd := &cobra.Command{
Use: "new-build (IMAGE | IMAGESTREAM | PATH | URL ...)",
Short: "Create a new build configuration",
Long: newBuildLong,
Example: fmt.Sprintf(newBuildExample, fullName),
Run: func(c *cobra.Command, args []string) {
err := RunNewBuild(fullName, f, out, c, args, config)
if err == errExit {
os.Exit(1)
}
cmdutil.CheckErr(err)
},
}
cmd.Flags().Var(&config.SourceRepositories, "code", "Source code in the build configuration.")
cmd.Flags().VarP(&config.ImageStreams, "image", "i", "Name of an OpenShift image stream to to use as a builder.")
cmd.Flags().Var(&config.DockerImages, "docker-image", "Name of a Docker image to use as a builder.")
cmd.Flags().StringVar(&config.Name, "name", "", "Set name to use for generated build artifacts")
cmd.Flags().StringVar(&config.Strategy, "strategy", "", "Specify the build strategy to use if you don't want to detect (docker|source).")
cmd.Flags().BoolVar(&config.OutputDocker, "to-docker", false, "Force the Build output to be DockerImage.")
cmd.Flags().StringP("labels", "l", "", "Label to set in all generated resources.")
cmdutil.AddPrinterFlags(cmd)
return cmd
}
开发者ID:naheedmk,项目名称:origin,代码行数:31,代码来源:newbuild.go
示例16: Complete
// Complete sets any default behavior for the command
func (o *NewAppOptions) Complete(commandName string, f *clientcmd.Factory, c *cobra.Command, args []string, out io.Writer) error {
o.Out = out
o.ErrOut = c.Out()
o.Output = kcmdutil.GetFlagString(c, "output")
// Only output="" should print descriptions of intermediate steps. Everything
// else should print only some specific output (json, yaml, go-template, ...)
if len(o.Output) == 0 {
o.Config.Out = o.Out
} else {
o.Config.Out = ioutil.Discard
}
o.Config.ErrOut = o.ErrOut
o.Action.Out, o.Action.ErrOut = o.Out, o.ErrOut
o.Action.Bulk.Mapper = clientcmd.ResourceMapper(f)
o.Action.Bulk.Op = configcmd.Create
// Retry is used to support previous versions of the API server that will
// consider the presence of an unknown trigger type to be an error.
o.Action.Bulk.Retry = retryBuildConfig
o.Config.DryRun = o.Action.DryRun
o.CommandPath = c.CommandPath()
o.CommandName = commandName
mapper, _ := f.Object(false)
o.PrintObject = cmdutil.VersionedPrintObject(f.PrintObject, c, mapper, out)
o.LogsForObject = f.LogsForObject
if err := CompleteAppConfig(o.Config, f, c, args); err != nil {
return err
}
if err := setAppConfigLabels(c, o.Config); err != nil {
return err
}
return nil
}
开发者ID:legionus,项目名称:origin,代码行数:36,代码来源:newapp.go
示例17: Complete
func (o *ReconcileClusterRolesOptions) Complete(cmd *cobra.Command, f *clientcmd.Factory, args []string) error {
oclient, _, err := f.Clients()
if err != nil {
return err
}
o.RoleClient = oclient.ClusterRoles()
o.Output = kcmdutil.GetFlagString(cmd, "output")
mapper, _ := f.Object()
for _, resourceString := range args {
resource, name, err := osutil.ResolveResource(authorizationapi.Resource("clusterroles"), resourceString, mapper)
if err != nil {
return err
}
if resource != authorizationapi.Resource("clusterroles") {
return fmt.Errorf("%v is not a valid resource type for this command", resource)
}
if len(name) == 0 {
return fmt.Errorf("%s did not contain a name", resourceString)
}
o.RolesToReconcile = append(o.RolesToReconcile, name)
}
return nil
}
开发者ID:asiainfoLDP,项目名称:datafactory,代码行数:27,代码来源:reconcile_clusterroles.go
示例18: Complete
func (o *PruneOptions) Complete(whitelistFile, blacklistFile, configFile string, args []string, f *clientcmd.Factory) error {
var err error
o.Whitelist, err = buildOpenShiftGroupNameList(args, whitelistFile)
if err != nil {
return err
}
o.Blacklist, err = buildOpenShiftGroupNameList([]string{}, blacklistFile)
if err != nil {
return err
}
o.Config, err = decodeSyncConfigFromFile(configFile)
if err != nil {
return err
}
osClient, _, err := f.Clients()
if err != nil {
return err
}
o.GroupInterface = osClient.Groups()
return nil
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:25,代码来源:prune.go
示例19: NewCmdWhoCan
// NewCmdWhoCan implements the OpenShift cli who-can command
func NewCmdWhoCan(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
options := &whoCanOptions{}
cmd := &cobra.Command{
Use: name + " VERB RESOURCE [NAME]",
Short: "List who can perform the specified action on a resource",
Long: "List who can perform the specified action on a resource",
Run: func(cmd *cobra.Command, args []string) {
if err := options.complete(f, args); err != nil {
kcmdutil.CheckErr(kcmdutil.UsageError(cmd, err.Error()))
}
var err error
options.client, _, err = f.Clients()
kcmdutil.CheckErr(err)
options.bindingNamespace, _, err = f.DefaultNamespace()
kcmdutil.CheckErr(err)
err = options.run()
kcmdutil.CheckErr(err)
},
}
cmd.Flags().BoolVar(&options.allNamespaces, "all-namespaces", options.allNamespaces, "If present, list who can perform the specified action in all namespaces.")
return cmd
}
开发者ID:Xmagicer,项目名称:origin,代码行数:29,代码来源:who_can.go
示例20: NewCmdNewApplication
// NewCmdNewApplication implements the OpenShift cli new-app command
func NewCmdNewApplication(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
config := newcmd.NewAppConfig()
config.Deploy = true
cmd := &cobra.Command{
Use: "new-app (IMAGE | IMAGESTREAM | TEMPLATE | PATH | URL ...)",
Short: "Create a new application",
Long: fmt.Sprintf(newAppLong, fullName),
Example: fmt.Sprintf(newAppExample, fullName),
SuggestFor: []string{"app", "application"},
Run: func(c *cobra.Command, args []string) {
mapper, typer := f.Object()
config.Mapper = mapper
config.Typer = typer
config.ClientMapper = resource.ClientMapperFunc(f.ClientForMapping)
err := RunNewApplication(fullName, f, out, c, args, config)
if err == cmdutil.ErrExit {
os.Exit(1)
}
kcmdutil.CheckErr(err)
},
}
cmd.Flags().BoolVar(&config.AsTestDeployment, "as-test", config.AsTestDeployment, "If true create this application as a test deployment, which validates that the deployment succeeds and then scales down.")
cmd.Flags().StringSliceVar(&config.SourceRepositories, "code", config.SourceRepositories, "Source code to use to build this application.")
cmd.Flags().StringVar(&config.ContextDir, "context-dir", "", "Context directory to be used for the build.")
cmd.Flags().StringSliceVarP(&config.ImageStreams, "image", "", config.ImageStreams, "Name of an image stream to use in the app. (deprecated)")
cmd.Flags().MarkDeprecated("image", "use --image-stream instead")
cmd.Flags().StringSliceVarP(&config.ImageStreams, "image-stream", "i", config.ImageStreams, "Name of an image stream to use in the app.")
cmd.Flags().StringSliceVar(&config.DockerImages, "docker-image", config.DockerImages, "Name of a Docker image to include in the app.")
cmd.Flags().StringSliceVar(&config.Templates, "template", config.Templates, "Name of a stored template to use in the app.")
cmd.Flags().StringSliceVarP(&config.TemplateFiles, "file", "f", config.TemplateFiles, "Path to a template file to use for the app.")
cmd.MarkFlagFilename("file", "yaml", "yml", "json")
cmd.Flags().StringSliceVarP(&config.TemplateParameters, "param", "p", config.TemplateParameters, "Specify a list of key value pairs (e.g., -p FOO=BAR,BAR=FOO) to set/override parameter values in the template.")
cmd.Flags().StringSliceVar(&config.Groups, "group", config.Groups, "Indicate components that should be grouped together as <comp1>+<comp2>.")
cmd.Flags().StringSliceVarP(&config.Environment, "env", "e", config.Environment, "Specify key value pairs of environment variables to set into each container.")
cmd.Flags().StringVar(&config.Name, "name", "", "Set name to use for generated application artifacts")
cmd.Flags().StringVar(&config.Strategy, "strategy", "", "Specify the build strategy to use if you don't want to detect (docker|source).")
cmd.Flags().StringP("labels", "l", "", "Label to set in all resources for this application.")
cmd.Flags().BoolVar(&config.InsecureRegistry, "insecure-registry", false, "If true, indicates that the referenced Docker images are on insecure registries and should bypass certificate checking")
cmd.Flags().BoolVarP(&config.AsList, "list", "L", false, "List all local templates and image streams that can be used to create.")
cmd.Flags().BoolVarP(&config.AsSearch, "search", "S", false, "Search all templates, image streams, and Docker images that match the arguments provided.")
cmd.Flags().BoolVar(&config.AllowMissingImages, "allow-missing-images", false, "If true, indicates that referenced Docker images that cannot be found locally or in a registry should still be used.")
cmd.Flags().BoolVar(&config.AllowMissingImageStreamTags, "allow-missing-imagestream-tags", false, "If true, indicates that image stream tags that don't exist should still be used.")
cmd.Flags().BoolVar(&config.AllowSecretUse, "grant-install-rights", false, "If true, a component that requires access to your account may use your token to install software into your project. Only grant images you trust the right to run with your token.")
cmd.Flags().BoolVar(&config.SkipGeneration, "no-install", false, "Do not attempt to run images that describe themselves as being installable")
cmd.Flags().BoolVar(&config.DryRun, "dry-run", false, "If true, do not actually create resources.")
// TODO AddPrinterFlags disabled so that it doesn't conflict with our own "template" flag.
// Need a better solution.
// kcmdutil.AddPrinterFlags(cmd)
cmd.Flags().StringP("output", "o", "", "Output format. One of: json|yaml|template|templatefile.")
cmd.Flags().String("output-version", "", "Output the formatted object with the given version (default api-version).")
cmd.Flags().Bool("no-headers", false, "When using the default output, don't print headers.")
cmd.Flags().String("output-template", "", "Template string or path to template file to use when -o=template or -o=templatefile. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]")
cmd.MarkFlagFilename("output-template")
return cmd
}
开发者ID:poomsujarit,项目名称:origin,代码行数:61,代码来源:newapp.go
注:本文中的github.com/openshift/origin/pkg/cmd/util/clientcmd.Factory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论