本文整理汇总了Golang中github.com/tsuru/gnuflag.FlagSet类的典型用法代码示例。如果您正苦于以下问题:Golang FlagSet类的具体用法?Golang FlagSet怎么用?Golang FlagSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FlagSet类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: RegisterLevelDBFlags
func RegisterLevelDBFlags(flags *flag.FlagSet) {
if !flagsRegistered {
flagsRegistered = true
flags.IntVar(&ldbFlags.maxFileHandles, "ldb-max-file-handles", 24, "max number of open file handles")
flags.BoolVar(&ldbFlags.dumpStats, "ldb-dump-stats", false, "print get/has/put counts on close")
}
}
开发者ID:Richardphp,项目名称:noms,代码行数:7,代码来源:leveldb_store.go
示例2: countFlags
func countFlags(flags *flag.FlagSet) int {
if flags == nil {
return 0
} else {
n := 0
flags.VisitAll(func(f *flag.Flag) {
n++
})
return n
}
}
开发者ID:Richardphp,项目名称:noms,代码行数:11,代码来源:noms_command.go
示例3: flags
func (c *dockerCmd) flags(fs *gnuflag.FlagSet) {
c.addMany(fs, &c.raw, "Add raw parameter to node container api call", "r", "raw")
c.addMany(fs, cmd.StringSliceFlagWrapper{Dst: &c.config.Config.Env}, "Set environment variables", "e", "env")
c.addMany(fs, cmd.StringSliceFlagWrapper{Dst: &c.config.HostConfig.Binds}, "Bind mount a volume", "v", "volume")
c.addMany(fs, cmd.MapFlagWrapper{Dst: &c.config.HostConfig.LogConfig.Config}, "Log driver options", "log-opt")
c.addMany(fs, &c.ports, "Publish a container's port(s) to the host", "p", "publish")
fs.BoolVar(&c.config.HostConfig.Privileged, "privileged", false, "Give extended privileges to this container")
fs.StringVar(&c.config.Config.Image, "image", "", "Image that will be used")
fs.StringVar(&c.config.HostConfig.RestartPolicy.Name, "restart", "", "Restart policy to apply when a container exits")
fs.StringVar(&c.config.HostConfig.NetworkMode, "net", "", "Connect a container to a network")
fs.StringVar(&c.config.HostConfig.LogConfig.Type, "log-driver", "", "Logging driver for container")
}
开发者ID:tsuru,项目名称:tsuru,代码行数:12,代码来源:cmd.go
示例4: RegisterProfileFlags
func RegisterProfileFlags(flags *flag.FlagSet) {
if !flagsRegistered {
flagsRegistered = true
flags.StringVar(&cpuProfile, "cpuprofile", "", "write cpu profile to file")
flags.StringVar(&memProfile, "memprofile", "", "write memory profile to this file")
flags.StringVar(&blockProfile, "blockprofile", "", "write block profile to this file")
}
}
开发者ID:Richardphp,项目名称:noms,代码行数:8,代码来源:profile.go
示例5: MergeFlagSet
func MergeFlagSet(fs1, fs2 *gnuflag.FlagSet) *gnuflag.FlagSet {
fs2.VisitAll(func(flag *gnuflag.Flag) {
fs1.Var(flag.Value, flag.Name, flag.Usage)
})
return fs1
}
开发者ID:pedrosnk,项目名称:tsuru,代码行数:6,代码来源:utils.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: RegisterOutputpagerFlags
func RegisterOutputpagerFlags(flags *flag.FlagSet) {
if !flagsRegistered {
flagsRegistered = true
flags.BoolVar(&noPager, "no-pager", false, "suppress paging functionality")
}
}
开发者ID:Richardphp,项目名称:noms,代码行数:6,代码来源:page_output.go
示例8: addMany
func (c *dockerCmd) addMany(fs *gnuflag.FlagSet, val gnuflag.Value, desc string, triggers ...string) {
for _, t := range triggers {
fs.Var(val, t, desc)
}
}
开发者ID:tsuru,项目名称:tsuru,代码行数:5,代码来源:cmd.go
注:本文中的github.com/tsuru/gnuflag.FlagSet类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论