本文整理汇总了Golang中github.com/tsuru/gnuflag.NewFlagSet函数的典型用法代码示例。如果您正苦于以下问题:Golang NewFlagSet函数的具体用法?Golang NewFlagSet怎么用?Golang NewFlagSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewFlagSet函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestMergeFlagSet
func (s *S) TestMergeFlagSet(c *check.C) {
var x, y bool
fs1 := gnuflag.NewFlagSet("x", gnuflag.ExitOnError)
fs1.BoolVar(&x, "x", false, "Something")
fs2 := gnuflag.NewFlagSet("y", gnuflag.ExitOnError)
fs2.BoolVar(&y, "y", false, "Something")
ret := MergeFlagSet(fs1, fs2)
c.Assert(ret, check.Equals, fs1)
fs1.Parse(true, []string{"-x", "-y"})
c.Assert(x, check.Equals, true)
c.Assert(y, check.Equals, true)
}
开发者ID:pedrosnk,项目名称:tsuru,代码行数:12,代码来源:utils_test.go
示例2: Flags
func (a *addNodeToSchedulerCmd) Flags() *gnuflag.FlagSet {
if a.fs == nil {
a.fs = gnuflag.NewFlagSet("with-flags", gnuflag.ContinueOnError)
a.fs.BoolVar(&a.register, "register", false, "Register an already created node")
}
return a.fs
}
开发者ID:Endika,项目名称:tsuru,代码行数:7,代码来源:cmd.go
示例3: Flags
func (f *fakeCommand) Flags() *gnuflag.FlagSet {
if f.fs == nil {
f.fs = gnuflag.NewFlagSet("fakeCommand", gnuflag.ExitOnError)
f.fs.StringVar(&f.name, "name", "", "your name")
}
return f.fs
}
开发者ID:zhenruyan,项目名称:tsuru,代码行数:7,代码来源:command_test.go
示例4: Flags
func (c *NodeContainerList) Flags() *gnuflag.FlagSet {
if c.fs == nil {
c.fs = gnuflag.NewFlagSet("flags", gnuflag.ExitOnError)
c.fs.BoolVar(&c.namesOnly, "q", false, "Show only names of existing node containers.")
}
return c.fs
}
开发者ID:tsuru,项目名称:tsuru,代码行数:7,代码来源:cmd.go
示例5: Flags
func (a *addNodeToSchedulerCmd) Flags() *gnuflag.FlagSet {
if a.fs == nil {
a.fs = gnuflag.NewFlagSet("with-flags", gnuflag.ContinueOnError)
a.fs.BoolVar(&a.register, "register", false, "Registers an existing docker endpoint, the IaaS won't be called.")
}
return a.fs
}
开发者ID:pedrosnk,项目名称:tsuru,代码行数:7,代码来源:cmd.go
示例6: handleFlags
func (m *Manager) handleFlags(command Command, name string, args []string) (Command, []string, error) {
var flagset *gnuflag.FlagSet
if flagged, ok := command.(FlaggedCommand); ok {
flagset = flagged.Flags()
} else {
flagset = gnuflag.NewFlagSet(name, gnuflag.ExitOnError)
}
var helpRequested bool
flagset.SetOutput(m.stderr)
if flagset.Lookup("help") == nil {
flagset.BoolVar(&helpRequested, "help", false, "Display help and exit")
}
if flagset.Lookup("h") == nil {
flagset.BoolVar(&helpRequested, "h", false, "Display help and exit")
}
err := flagset.Parse(true, args)
if err != nil {
return nil, nil, err
}
if helpRequested {
command = m.Commands["help"]
args = []string{name}
} else {
args = flagset.Args()
}
return command, args, nil
}
开发者ID:botvs,项目名称:tsuru,代码行数:27,代码来源:cmd.go
示例7: Flags
func (c *keyList) Flags() *gnuflag.FlagSet {
if c.fs == nil {
c.fs = gnuflag.NewFlagSet("key-list", gnuflag.ExitOnError)
c.fs.BoolVar(&c.notrunc, "n", false, "disable truncation of key content")
c.fs.BoolVar(&c.notrunc, "no-truncate", false, "disable truncation of key content")
}
return c.fs
}
开发者ID:wpjunior,项目名称:tsuru-client,代码行数:8,代码来源:key.go
示例8: Flags
func (s *appSwap) Flags() *gnuflag.FlagSet {
if s.fs == nil {
s.fs = gnuflag.NewFlagSet("", gnuflag.ExitOnError)
s.fs.BoolVar(&s.force, "force", false, "Force Swap among apps with different number of units or different platform.")
s.fs.BoolVar(&s.force, "f", false, "Force Swap among apps with different number of units or different platform.")
}
return s.fs
}
开发者ID:wpjunior,项目名称:tsuru-client,代码行数:8,代码来源:swap.go
示例9: Flags
func (c *ListHealingHistoryCmd) Flags() *gnuflag.FlagSet {
if c.fs == nil {
c.fs = gnuflag.NewFlagSet("with-flags", gnuflag.ContinueOnError)
c.fs.BoolVar(&c.nodeOnly, "node", false, "List only healing process started for nodes")
c.fs.BoolVar(&c.containerOnly, "container", false, "List only healing process started for containers")
}
return c.fs
}
开发者ID:tsuru,项目名称:tsuru,代码行数:8,代码来源:cmd.go
示例10: Flags
func (cmd *GuessingCommand) Flags() *gnuflag.FlagSet {
if cmd.fs == nil {
cmd.fs = gnuflag.NewFlagSet("", gnuflag.ExitOnError)
cmd.fs.StringVar(&cmd.appName, "app", "", "The name of the app.")
cmd.fs.StringVar(&cmd.appName, "a", "", "The name of the app.")
}
return cmd.fs
}
开发者ID:zhenruyan,项目名称:tsuru,代码行数:8,代码来源:guess.go
示例11: Flags
func (c *CommandWithFlags) Flags() *gnuflag.FlagSet {
if c.fs == nil {
c.fs = gnuflag.NewFlagSet("with-flags", gnuflag.ContinueOnError)
c.fs.IntVar(&c.age, "age", 0, "your age")
c.fs.IntVar(&c.age, "a", 0, "your age")
}
return c.fs
}
开发者ID:zhenruyan,项目名称:tsuru,代码行数:8,代码来源:cmd_test.go
示例12: Flags
func (cmd *ConfirmationCommand) Flags() *gnuflag.FlagSet {
if cmd.fs == nil {
cmd.fs = gnuflag.NewFlagSet("", gnuflag.ExitOnError)
cmd.fs.BoolVar(&cmd.yes, "y", false, "Don't ask for confirmation.")
cmd.fs.BoolVar(&cmd.yes, "assume-yes", false, "Don't ask for confirmation.")
}
return cmd.fs
}
开发者ID:zhenruyan,项目名称:tsuru,代码行数:8,代码来源:confirm.go
示例13: Flags
func (t *targetAdd) Flags() *gnuflag.FlagSet {
if t.fs == nil {
t.fs = gnuflag.NewFlagSet("target-add", gnuflag.ExitOnError)
t.fs.BoolVar(&t.set, "set-current", false, "Add and define the target as the current target")
t.fs.BoolVar(&t.set, "s", false, "Add and define the target as the current target")
}
return t.fs
}
开发者ID:tsuru,项目名称:tsuru,代码行数:8,代码来源:target.go
示例14: Flags
func (c *regenerateAPIToken) Flags() *gnuflag.FlagSet {
if c.fs == nil {
c.fs = gnuflag.NewFlagSet("", gnuflag.ExitOnError)
c.fs.StringVar(&c.user, "user", "", "Generates a new API token for the given user email")
c.fs.StringVar(&c.user, "u", "", "Generates a new API token for the given user email")
}
return c.fs
}
开发者ID:pauloalem,项目名称:tsuru-client,代码行数:8,代码来源:auth.go
示例15: Flags
func (c *planList) Flags() *gnuflag.FlagSet {
if c.fs == nil {
c.fs = gnuflag.NewFlagSet("plan-List", gnuflag.ExitOnError)
bytes := "bytesized units for memory and swap."
c.fs.BoolVar(&c.bytes, "bytes", false, bytes)
c.fs.BoolVar(&c.bytes, "b", false, bytes)
}
return c.fs
}
开发者ID:wpjunior,项目名称:tsuru-client,代码行数:9,代码来源:plan.go
示例16: Flags
func (c *apiCmd) Flags() *gnuflag.FlagSet {
if c.fs == nil {
c.fs = gnuflag.NewFlagSet("api", gnuflag.ExitOnError)
c.fs.BoolVar(&c.dry, "dry", false, "dry-run: does not start the server (for testing purpose)")
c.fs.BoolVar(&c.dry, "d", false, "dry-run: does not start the server (for testing purpose)")
c.fs.BoolVar(&c.checkOnly, "t", false, "check only config: test your tsuru.conf file before starts.")
}
return c.fs
}
开发者ID:zhenruyan,项目名称:tsuru,代码行数:9,代码来源:api.go
示例17: Flags
func (c *EnvSetCmd) Flags() *gnuflag.FlagSet {
if c.fs == nil {
c.fs = gnuflag.NewFlagSet("with-flags", gnuflag.ContinueOnError)
desc := "Pool name where set variables will apply"
c.fs.StringVar(&c.pool, "pool", "", desc)
c.fs.StringVar(&c.pool, "p", "", desc)
}
return c.fs
}
开发者ID:botvs,项目名称:tsuru,代码行数:9,代码来源:cmd.go
示例18: Flags
func (c *serviceUpdate) Flags() *gnuflag.FlagSet {
if c.fs == nil {
c.fs = gnuflag.NewFlagSet("service-update", gnuflag.ExitOnError)
descriptionMessage := "service instance description"
c.fs.StringVar(&c.description, "description", "", descriptionMessage)
c.fs.StringVar(&c.description, "d", "", descriptionMessage)
}
return c.fs
}
开发者ID:pauloalem,项目名称:tsuru-client,代码行数:9,代码来源:services.go
示例19: Flags
func (c *permissionList) Flags() *gnuflag.FlagSet {
if c.fs == nil {
c.fs = gnuflag.NewFlagSet("plan-List", gnuflag.ExitOnError)
tree := "Show permissions in tree format."
c.fs.BoolVar(&c.tree, "tree", false, tree)
c.fs.BoolVar(&c.tree, "t", false, tree)
}
return c.fs
}
开发者ID:pauloalem,项目名称:tsuru-client,代码行数:9,代码来源:permission.go
示例20: setupLogFlags
func setupLogFlags() *flag.FlagSet {
logFlagSet := flag.NewFlagSet("log", flag.ExitOnError)
logFlagSet.IntVar(&color, "color", -1, "value of 1 forces color on, 2 forces color off")
logFlagSet.IntVar(&maxLines, "max-lines", 10, "max number of lines to show per commit (-1 for all lines)")
logFlagSet.IntVar(&maxCommits, "n", 0, "max number of commits to display (0 for all commits)")
logFlagSet.BoolVar(&oneline, "oneline", false, "show a summary of each commit on a single line")
logFlagSet.BoolVar(&showGraph, "graph", false, "show ascii-based commit hierarcy on left side of output")
logFlagSet.BoolVar(&showValue, "show-value", false, "show commit value rather than diff information -- this is temporary")
outputpager.RegisterOutputpagerFlags(logFlagSet)
return logFlagSet
}
开发者ID:Richardphp,项目名称:noms,代码行数:11,代码来源:noms_log.go
注:本文中的github.com/tsuru/gnuflag.NewFlagSet函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论