Exemplo n.º 1
0
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")
	}
}
Exemplo n.º 2
0
Arquivo: cmd.go Projeto: botvs/tsuru
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
}
Exemplo n.º 3
0
Arquivo: cmd.go Projeto: tsuru/tsuru
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")
}
Exemplo n.º 4
0
func RegisterOutputpagerFlags(flags *flag.FlagSet) {
	if !flagsRegistered {
		flagsRegistered = true
		flags.BoolVar(&noPager, "no-pager", false, "suppress paging functionality")
	}
}