本文整理匯總了Golang中github.com/tsuru/gnuflag.FlagSet.StringVar方法的典型用法代碼示例。如果您正苦於以下問題:Golang FlagSet.StringVar方法的具體用法?Golang FlagSet.StringVar怎麽用?Golang FlagSet.StringVar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/tsuru/gnuflag.FlagSet
的用法示例。
在下文中一共展示了FlagSet.StringVar方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: 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")
}
示例2: 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")
}
}