本文整理汇总了Golang中launchpad/net/gnuflag.FlagSet.StringVar方法的典型用法代码示例。如果您正苦于以下问题:Golang FlagSet.StringVar方法的具体用法?Golang FlagSet.StringVar怎么用?Golang FlagSet.StringVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类launchpad/net/gnuflag.FlagSet
的用法示例。
在下文中一共展示了FlagSet.StringVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SetFlags
// SetFlags implements Command.SetFlags, then calls the wrapped command's SetFlags.
func (w *sysCommandWrapper) SetFlags(f *gnuflag.FlagSet) {
if w.setFlags {
f.StringVar(&w.controllerName, "c", "", "juju controller to operate in")
f.StringVar(&w.controllerName, "controller", "", "")
}
w.ControllerCommand.SetFlags(f)
}
示例2: SetFlags
func (c *BootstrapCommand) SetFlags(f *gnuflag.FlagSet) {
c.EnvCommandBase.SetFlags(f)
f.Var(constraints.ConstraintsValue{&c.Constraints}, "constraints", "set environment constraints")
f.BoolVar(&c.UploadTools, "upload-tools", false, "upload local version of tools before bootstrapping")
f.Var(seriesVar{&c.Series}, "series", "upload tools for supplied comma-separated series list")
f.StringVar(&c.Source, "source", "", "local path to use as tools source")
}
示例3: SetFlags
func (c *toolsMetadataCommand) SetFlags(f *gnuflag.FlagSet) {
f.StringVar(&c.metadataDir, "d", "", "local directory in which to store metadata")
// If no stream is specified, we'll generate metadata for the legacy tools location.
f.StringVar(&c.stream, "stream", "", "simplestreams stream for which to generate the metadata")
f.BoolVar(&c.clean, "clean", false, "remove any existing metadata for the specified stream before generating new metadata")
f.BoolVar(&c.public, "public", false, "tools are for a public cloud, so generate mirrors information")
}
示例4: SetFlags
func (c *DestroyEnvironmentCommand) SetFlags(f *gnuflag.FlagSet) {
f.BoolVar(&c.assumeYes, "y", false, "Do not ask for confirmation")
f.BoolVar(&c.assumeYes, "yes", false, "")
f.BoolVar(&c.force, "force", false, "Forcefully destroy the environment, directly through the environment provider")
f.StringVar(&c.envName, "e", "", "juju environment to operate in")
f.StringVar(&c.envName, "environment", "", "juju environment to operate in")
}
示例5: SetFlags
func (c *UpgradeCharmCommand) SetFlags(f *gnuflag.FlagSet) {
c.EnvCommandBase.SetFlags(f)
f.BoolVar(&c.Force, "force", false, "upgrade all units immediately, even if in error state")
f.StringVar(&c.RepoPath, "repository", os.Getenv("JUJU_REPOSITORY"), "local charm repository path")
f.StringVar(&c.SwitchURL, "switch", "", "crossgrade to a different charm")
f.IntVar(&c.Revision, "revision", -1, "explicit revision of current charm")
}
示例6: SetFlags
func (w *environCommandWrapper) SetFlags(f *gnuflag.FlagSet) {
if !w.skipFlags {
f.StringVar(&w.envName, "e", "", "juju environment to operate in")
f.StringVar(&w.envName, "environment", "", "")
}
w.EnvironCommand.SetFlags(f)
}
示例7: SetFlags
// SetFlags implements Command.SetFlags, then calls the wrapped command's SetFlags.
func (w *sysCommandWrapper) SetFlags(f *gnuflag.FlagSet) {
if w.setFlags {
f.StringVar(&w.systemName, "s", "", "juju system to operate in")
f.StringVar(&w.systemName, "system", "", "")
}
w.SystemCommand.SetFlags(f)
}
示例8: SetFlags
func (w *modelCommandWrapper) SetFlags(f *gnuflag.FlagSet) {
if !w.skipFlags {
f.StringVar(&w.envName, "m", "", "juju model to operate in")
f.StringVar(&w.envName, "model", "", "")
}
w.ModelCommand.SetFlags(f)
}
示例9: SetFlags
func (c *UpgradeJujuCommand) SetFlags(f *gnuflag.FlagSet) {
c.EnvCommandBase.SetFlags(f)
f.StringVar(&c.vers, "version", "", "upgrade to specific version")
f.BoolVar(&c.Development, "dev", false, "allow development versions to be chosen")
f.BoolVar(&c.UploadTools, "upload-tools", false, "upload local version of tools")
f.Var(seriesVar{&c.Series}, "series", "upload tools for supplied comma-separated series list")
}
示例10: AddFlags
// AddFlags injects common agent flags into f.
func (c *agentConf) AddFlags(f *gnuflag.FlagSet) {
// TODO(dimitern) 2014-02-19 bug 1282025
// We need to pass a config location here instead and
// use it to locate the conf and the infer the data-dir
// from there instead of passing it like that.
f.StringVar(&c.dataDir, "data-dir", util.DataDir, "directory for juju data")
}
示例11: SetFlags
func (c *BootstrapCommand) SetFlags(f *gnuflag.FlagSet) {
c.AgentConf.AddFlags(f)
yamlBase64Var(f, &c.EnvConfig, "env-config", "", "initial environment configuration (yaml, base64 encoded)")
f.Var(constraints.ConstraintsValue{Target: &c.Constraints}, "constraints", "initial environment constraints (space-separated strings)")
f.Var(&c.Hardware, "hardware", "hardware characteristics (space-separated strings)")
f.StringVar(&c.InstanceId, "instance-id", "", "unique instance-id for bootstrap machine")
}
示例12: Init
func (c *RemoteCommand) Init(f *gnuflag.FlagSet, args []string) error {
f.StringVar(&c.msg, "error", "", "if set, fail")
if err := f.Parse(true, args); err != nil {
return err
}
return cmd.CheckEmpty(f.Args())
}
示例13: SetFlags
func (c *BootstrapCommand) SetFlags(f *gnuflag.FlagSet) {
f.Var(constraints.ConstraintsValue{Target: &c.Constraints}, "constraints", "set environment constraints")
f.BoolVar(&c.UploadTools, "upload-tools", false, "upload local version of tools before bootstrapping")
f.Var(newSeriesValue(nil, &c.Series), "upload-series", "upload tools for supplied comma-separated series list")
f.Var(newSeriesValue(nil, &c.seriesOld), "series", "upload tools for supplied comma-separated series list (DEPRECATED, see --upload-series)")
f.StringVar(&c.MetadataSource, "metadata-source", "", "local path to use as tools and/or metadata source")
f.StringVar(&c.Placement, "to", "", "a placement directive indicating an instance to bootstrap")
}
示例14: AddFlags
// AddFlags adds appropriate flags to f.
func (l *Log) AddFlags(f *gnuflag.FlagSet) {
f.StringVar(&l.Path, "log-file", "", "path to write log to")
// TODO(thumper): rename verbose to --show-log
f.BoolVar(&l.Verbose, "v", false, "if set, log additional messages")
f.BoolVar(&l.Verbose, "verbose", false, "if set, log additional messages")
f.BoolVar(&l.Debug, "debug", false, "if set, log debugging messages")
f.StringVar(&l.Config, "log-config", "", "specify log levels for modules")
}
示例15: SetFlags
func (c *upgradeJujuCommand) SetFlags(f *gnuflag.FlagSet) {
f.StringVar(&c.vers, "version", "", "upgrade to specific version")
f.BoolVar(&c.UploadTools, "upload-tools", false, "upload local version of tools")
f.BoolVar(&c.DryRun, "dry-run", false, "don't change anything, just report what would change")
f.BoolVar(&c.ResetPrevious, "reset-previous-upgrade", false, "clear the previous (incomplete) upgrade status (use with care)")
f.BoolVar(&c.AssumeYes, "y", false, "answer 'yes' to confirmation prompts")
f.BoolVar(&c.AssumeYes, "yes", false, "")
}