Ejemplo n.º 1
0
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)
}
Ejemplo n.º 2
0
func (c *helpCommand) Run(ctx *Context) error {
	// If there is no help topic specified, print basic usage.
	if c.topic == "" {
		if _, ok := c.topics["basics"]; ok {
			c.topic = "basics"
		} else {
			// At this point, "help" is selected as the SuperCommand's
			// sub-command, but we want the info to be printed
			// as if there was nothing selected.
			c.super.subcmd = nil

			info := c.super.Info()
			f := gnuflag.NewFlagSet(info.Name, gnuflag.ContinueOnError)
			c.SetFlags(f)
			ctx.Stdout.Write(info.Help(f))
			return nil
		}
	}
	// If the topic is a registered subcommand, then run the help command with it
	if helpcmd, ok := c.super.subcmds[c.topic]; ok {
		info := helpcmd.Info()
		info.Name = fmt.Sprintf("%s %s", c.super.Name, info.Name)
		f := gnuflag.NewFlagSet(info.Name, gnuflag.ContinueOnError)
		helpcmd.SetFlags(f)
		ctx.Stdout.Write(info.Help(f))
		return nil
	}
	// Look to see if the topic is a registered topic.
	topic, ok := c.topics[c.topic]
	if ok {
		fmt.Fprintf(ctx.Stdout, "%s\n", strings.TrimSpace(topic.long()))
		return nil
	}
	// If we have a missing callback, call that with --help
	if c.super.missingCallback != nil {
		subcmd := &missingCommand{
			callback:  c.super.missingCallback,
			superName: c.super.Name,
			name:      c.topic,
			args:      []string{"--", "--help"},
		}
		err := subcmd.Run(ctx)
		_, isUnrecognized := err.(*UnrecognizedCommand)
		if !isUnrecognized {
			return err
		}
	}
	return fmt.Errorf("unknown command or topic for %s", c.topic)
}
Ejemplo n.º 3
0
func (c *rebalanceContainersCmd) Flags() *gnuflag.FlagSet {
	if c.fs == nil {
		c.fs = gnuflag.NewFlagSet("containers-rebalance", gnuflag.ExitOnError)
		c.fs.BoolVar(&c.dry, "dry", false, "Dry run, only shows what would be done")
	}
	return c.fs
}
Ejemplo n.º 4
0
func (c *CreateBridge) Flags() *gnuflag.FlagSet {
	if c.Fs == nil {
		c.Fs = gnuflag.NewFlagSet("megdc", gnuflag.ExitOnError)
		bridgeMsg := "specify the name of bridge"
		c.Fs.StringVar(&c.Bridgename, "bridgename", "one", bridgeMsg)
		phydevMsg := "specify the interfacename"
		c.Fs.StringVar(&c.PhyDev, "phydev", "eth0", phydevMsg)
		networkMsg := "specify the network address"
		c.Fs.StringVar(&c.Network, "network", "", networkMsg)
		netmaskMsg := "specify the netmask address"
		c.Fs.StringVar(&c.Netmask, "netmask", "", netmaskMsg)
		gatewayMsg := "specify the gateway address"
		c.Fs.StringVar(&c.Gateway, "gateway", "", gatewayMsg)
		dnsname1Msg := "specify the name server"
		c.Fs.StringVar(&c.Dnsname1, "dnsname1", "", dnsname1Msg)
		dnsname2Msg := "specify the name server"
		c.Fs.StringVar(&c.Dnsname2, "dnsname2", "", dnsname2Msg)
		hostMsg := "The host of the server to ssh"
		c.Fs.StringVar(&c.Host, "host", "localhost", hostMsg)
		usrMsg := "The username of the server"
		c.Fs.StringVar(&c.Username, "username", "", usrMsg)
		pwdMsg := "The password of the server"
		c.Fs.StringVar(&c.Password, "password", "", pwdMsg)
	}

	return c.Fs
}
Ejemplo n.º 5
0
func fs() (*gnuflag.FlagSet, *cmd.FileVar) {
	var config cmd.FileVar
	fs := gnuflag.NewFlagSet("", gnuflag.ContinueOnError)
	fs.SetOutput(ioutil.Discard)
	fs.Var(&config, "config", "the config")
	return fs, &config
}
Ejemplo n.º 6
0
func (c *CreateNetworkOpennebula) Flags() *gnuflag.FlagSet {
	if c.Fs == nil {
		c.Fs = gnuflag.NewFlagSet("megdc", gnuflag.ExitOnError)
		bridgeMsg := " To specify physical bridge  in the host where the vm should connect this network interface."
		c.Fs.StringVar(&c.Bridge, "bridge", "one", bridgeMsg)
		iptypeMsg := "To specify ip address ip4 or ip6"
		c.Fs.StringVar(&c.Iptype, "iptype", "IP4", iptypeMsg)
		ipMsg := "To specify the ip"
		c.Fs.StringVar(&c.Ip, "ip", "", ipMsg)
		sizeMsg := "To specify range of ip address."
		c.Fs.StringVar(&c.Size, "size", "", sizeMsg)
		dns1Msg := "To specify domain server address"
		c.Fs.StringVar(&c.Dns1, "dns1", "", dns1Msg)
		dns2Msg := "To specify domain server address"
		c.Fs.StringVar(&c.Dns2, "dns2", "", dns2Msg)
		gatewayMsg := "To specify gateway address"
		c.Fs.StringVar(&c.Gatewayip, "gateway", "", gatewayMsg)
		netmaskMsg := "To specify netmask address"
		c.Fs.StringVar(&c.Networkmask, "networkmask", "", netmaskMsg)
		hostMsg := "To set the hostname"
		c.Fs.StringVar(&c.Host, "host", "localhost", hostMsg)
		usrMsg := "The username of the server"
		c.Fs.StringVar(&c.Username, "username", "", usrMsg)
		pwdMsg := "The password of the server"
		c.Fs.StringVar(&c.Password, "password", "", pwdMsg)
	}

	return c.Fs
}
Ejemplo n.º 7
0
func (c *Cephinstall) Flags() *gnuflag.FlagSet {
	if c.Fs == nil {
		c.Fs = gnuflag.NewFlagSet("megdc", gnuflag.ExitOnError)

		/* Install package commands */
		c.Fs.BoolVar(&c.CephInstall, "ceph", false, "Install ceph package")
		c.Fs.BoolVar(&c.CephInstall, "c", false, "Install ceph package")

		c.Fs.StringVar(&c.CEPH_LOG, "ceph_log", "", "ceph_log path for hosted machine")
		c.Fs.StringVar(&c.CEPH_LOG, "l", "", "ceph_log path for hosted machine")
		c.Fs.StringVar(&c.Ceph_user, "ceph_user", "", "ceph_user for hosted machine")
		c.Fs.StringVar(&c.Ceph_user, "u", "", "ceph_user for hosted machine")
		c.Fs.StringVar(&c.Ceph_password, "ceph_password", "", "ceph_password for hosted machine")
		c.Fs.StringVar(&c.Ceph_password, "p", "", "ceph_password for hosted machine")
		c.Fs.StringVar(&c.Ceph_group, "ceph_group", "", "ceph_group for hosted machine")
		c.Fs.StringVar(&c.Ceph_group, "g", "", "ceph_group for hosted machine")
		c.Fs.StringVar(&c.User_home, "user_home", "", "user_home path for hosted machine")
		c.Fs.StringVar(&c.User_home, "uh", "", "user_home path for hosted machine")
		c.Fs.StringVar(&c.Host, "host", "", "host address for machine")
		c.Fs.StringVar(&c.Host, "h", "", "host address for machine")
		c.Fs.StringVar(&c.Osd1, "osd1", "", "osd1 storage drive for hosted machine")
		c.Fs.StringVar(&c.Osd1, "os1", "", "osd1 strorage drive for hosted machine")
		c.Fs.StringVar(&c.Osd2, "osd2", "", "osd2 storage drive for hosted machine")
		c.Fs.StringVar(&c.Osd2, "os2", "", "osd2 strorage drive for hosted machine")
		c.Fs.StringVar(&c.Osd3, "osd3", "", "osd3 storage drive for hosted machine")
		c.Fs.StringVar(&c.Osd3, "os3", "", "osd3 strorage drive for hosted machine")

		c.Fs.BoolVar(&c.Quiet, "quiet", false, "")
		c.Fs.BoolVar(&c.Quiet, "q", false, "")
	}
	return c.Fs
}
Ejemplo n.º 8
0
func (*suite) TestNewContext(c *gc.C) {
	for i, test := range newContextTests {
		c.Logf("test %d: %s", i, test.about)
		fset := flag.NewFlagSet("http", flag.ContinueOnError)
		ctxt, _, err := newContext(fset, test.args)
		if test.expectError != "" {
			c.Assert(err, gc.ErrorMatches, test.expectError)
			continue
		}
		c.Assert(err, gc.IsNil)
		if len(ctxt.header) == 0 {
			ctxt.header = nil
		}
		if len(ctxt.urlValues) == 0 {
			ctxt.urlValues = nil
		}
		if len(ctxt.form) == 0 {
			ctxt.form = nil
		}
		if len(ctxt.jsonObj) == 0 {
			ctxt.jsonObj = nil
		}
		c.Logf("url %s", ctxt.url)
		c.Assert(ctxt, jc.DeepEquals, &test.expectContext)
	}
}
Ejemplo n.º 9
0
func (a *updateNodeToSchedulerCmd) Flags() *gnuflag.FlagSet {
	if a.fs == nil {
		a.fs = gnuflag.NewFlagSet("", gnuflag.ExitOnError)
		a.fs.BoolVar(&a.disabled, "disable", false, "Disable node in scheduler.")
	}
	return a.fs
}
Ejemplo n.º 10
0
Archivo: http.go Proyecto: nathj07/http
func main() {
	fset := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
	ctxt, p, err := newContext(fset, os.Args[1:])
	if err != nil {
		if err == errUsage {
			fset.Usage()
		} else {
			fmt.Fprintf(os.Stderr, "%v\n", err)
		}
		os.Exit(2)
	}
	jar, client, err := newClient(p)
	if err != nil {
		fatalf("cannot make HTTP client: %v", err)
	}
	if jar != nil {
		defer jar.Save()
	}
	var stdin io.Reader
	if p.useStdin {
		stdin = os.Stdin
	}
	resp, err := ctxt.doRequest(client, stdin)
	if err != nil {
		fatalf("%v", err)
	}
	defer resp.Body.Close()
	if err := showResponse(p, resp, os.Stdout); err != nil {
		fatalf("%v", err)
	}
}
Ejemplo n.º 11
0
func (c *VerticeInstall) Flags() *gnuflag.FlagSet {
	if c.Fs == nil {
		c.Fs = gnuflag.NewFlagSet("", gnuflag.ExitOnError)
		nilMsg := "Install megam cockpit ui"
		c.Fs.BoolVar(&c.NilavuInstall, "nilavu", false, nilMsg)
		c.Fs.BoolVar(&c.NilavuInstall, "n", false, nilMsg)
		gwyMsg := "Install megam gateway apiserver"
		c.Fs.BoolVar(&c.GatewayInstall, "gateway", false, gwyMsg)
		c.Fs.BoolVar(&c.GatewayInstall, "g", false, gwyMsg)
		snoMsg := "Install megam uidserver"
		c.Fs.BoolVar(&c.SnowflakeInstall, "snowflake", false, snoMsg)
		c.Fs.BoolVar(&c.SnowflakeInstall, "s", false, snoMsg)
		megdMsg := "Install megam omni scheduler"
		c.Fs.BoolVar(&c.MegamdInstall, "vertice", false, megdMsg)
		c.Fs.BoolVar(&c.MegamdInstall, "d", false, megdMsg)
		hostMsg := "The host of the server to ssh"
		c.Fs.StringVar(&c.Host, "host", "localhost", hostMsg)
		usrMsg := "The username of the server"
		c.Fs.StringVar(&c.Username, "username", "", usrMsg)
		pwdMsg := "The password of the server"
		c.Fs.StringVar(&c.Password, "password", "", pwdMsg)
	}
	//	c.Fs = cmd.MergeFlagSet(new(packages.SSHCommand).Flags(), c.Fs)
	return c.Fs
}
Ejemplo n.º 12
0
func RunPlugin(ctx *cmd.Context, subcommand string, args []string) error {
	cmdName := JujuPluginPrefix + subcommand
	plugin := modelcmd.Wrap(&PluginCommand{name: cmdName})

	// We process common flags supported by Juju commands.
	// To do this, we extract only those supported flags from the
	// argument list to avoid confusing flags.Parse().
	flags := gnuflag.NewFlagSet(cmdName, gnuflag.ContinueOnError)
	flags.SetOutput(ioutil.Discard)
	plugin.SetFlags(flags)
	jujuArgs := extractJujuArgs(args)
	if err := flags.Parse(false, jujuArgs); err != nil {
		return err
	}
	if err := plugin.Init(args); err != nil {
		return err
	}
	err := plugin.Run(ctx)
	_, execError := err.(*exec.Error)
	// exec.Error results are for when the executable isn't found, in
	// those cases, drop through.
	if !execError {
		return err
	}
	return &cmd.UnrecognizedCommand{Name: subcommand}
}
Ejemplo n.º 13
0
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
}
Ejemplo n.º 14
0
func (c *Megamremove) Flags() *gnuflag.FlagSet {
	if c.Fs == nil {
		c.Fs = gnuflag.NewFlagSet("megdc", gnuflag.ExitOnError)
		c.Fs.BoolVar(&c.All, "all", false, "Remove all megam packages")
		c.Fs.BoolVar(&c.All, "a", false, "Remove all megam packages")

		/* Remove package commands */
		c.Fs.BoolVar(&c.MegamNilavuRemove, "megamnilavu", false, "Remove nilavu package")
		c.Fs.BoolVar(&c.MegamNilavuRemove, "n", false, "Remove nilavu package")
		c.Fs.BoolVar(&c.MegamGatewayRemove, "megamgateway", false, "Remove megam gateway package")
		c.Fs.BoolVar(&c.MegamGatewayRemove, "g", false, "Remove megam gateway package")
		c.Fs.BoolVar(&c.MegamdRemove, "megamd", false, "Remove megamd package")
		c.Fs.BoolVar(&c.MegamdRemove, "d", false, "Remove megamd package")
		c.Fs.BoolVar(&c.MegamCommonRemove, "megamcommon", false, "Remove megamcommon package")
		c.Fs.BoolVar(&c.MegamCommonRemove, "c", false, "Remove megamcommon package")
		c.Fs.BoolVar(&c.MegamSnowflakeRemove, "megamsnowflake", false, "Remove megam snowflake package")
		c.Fs.BoolVar(&c.MegamSnowflakeRemove, "s", false, "Remove megam snowflake package")
		c.Fs.BoolVar(&c.RiakRemove, "riak", false, "Remove Riak package")
		c.Fs.BoolVar(&c.RiakRemove, "r", false, "Remove Riak package")
		c.Fs.BoolVar(&c.RabbitmqRemove, "rabbitmq", false, "Remove Rabbitmq-server")
		c.Fs.BoolVar(&c.RabbitmqRemove, "m", false, "Remove Rabbitmq-server")

		c.Fs.StringVar(&c.Host, "host", "", "host address for machine")
		c.Fs.StringVar(&c.Host, "h", "", "host address for machine")
		c.Fs.StringVar(&c.Username, "username", "", "username for hosted machine")
		c.Fs.StringVar(&c.Username, "u", "", "username for hosted machine")
		c.Fs.StringVar(&c.Password, "password", "", "password for hosted machine")
		c.Fs.StringVar(&c.Password, "p", "", "password for hosted machine")
		c.Fs.BoolVar(&c.Quiet, "quiet", false, "")
		c.Fs.BoolVar(&c.Quiet, "q", false, "")
	}
	return c.Fs
}
Ejemplo n.º 15
0
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
}
Ejemplo n.º 16
0
Archivo: cmd.go Proyecto: 4eek/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
}
Ejemplo n.º 17
0
func (c *HelpToolCommand) Run(ctx *cmd.Context) error {
	var hookctx dummyHookContext
	if c.tool == "" {
		// Ripped from SuperCommand. We could Run() a SuperCommand
		// with "help commands", but then the implicit "help" command
		// shows up.
		names := jujuc.CommandNames()
		cmds := make([]cmd.Command, 0, len(names))
		longest := 0
		for _, name := range names {
			if c, err := jujuc.NewCommand(hookctx, name); err == nil {
				if len(name) > longest {
					longest = len(name)
				}
				cmds = append(cmds, c)
			}
		}
		for _, c := range cmds {
			info := c.Info()
			fmt.Fprintf(ctx.Stdout, "%-*s  %s\n", longest, info.Name, info.Purpose)
		}
	} else {
		c, err := jujuc.NewCommand(hookctx, c.tool)
		if err != nil {
			return err
		}
		info := c.Info()
		f := gnuflag.NewFlagSet(info.Name, gnuflag.ContinueOnError)
		c.SetFlags(f)
		ctx.Stdout.Write(info.Help(f))
	}
	return nil
}
Ejemplo n.º 18
0
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")
	}
	return c.fs
}
Ejemplo n.º 19
0
func newRunCmd() *runCmd {
	cmd := new(runCmd)
	flags := gnuflag.NewFlagSet(cmd.Name(), gnuflag.ExitOnError)
	flags.StringVar(&cmd.configPath, "config", "", "Hockeypuck configuration file")
	cmd.flags = flags
	return cmd
}
Ejemplo n.º 20
0
func newRecoverCmd() *recoverCmd {
	cmd := new(recoverCmd)
	flags := gnuflag.NewFlagSet(cmd.Name(), gnuflag.ExitOnError)
	flags.StringVar(&cmd.configPath, "config", "", "prlpks configuration file")
	cmd.flags = flags
	return cmd
}
Ejemplo n.º 21
0
func (c *removeNodeFromSchedulerCmd) Flags() *gnuflag.FlagSet {
	if c.fs == nil {
		c.fs = gnuflag.NewFlagSet("with-flags", gnuflag.ContinueOnError)
		c.fs.BoolVar(&c.destroy, "destroy", false, "Destroy node from IaaS")
	}
	return c.fs
}
Ejemplo n.º 22
0
func (*ArgsSuite) TestFlagsUsage(c *gc.C) {
	for i, test := range []struct {
		message       string
		defaultValue  []string
		args          []string
		expectedValue []string
	}{{
		message: "nil default and no arg",
	}, {
		message:       "default value and not set by args",
		defaultValue:  []string{"foo", "bar"},
		expectedValue: []string{"foo", "bar"},
	}, {
		message:       "no value set by args",
		args:          []string{"--value", "foo,bar"},
		expectedValue: []string{"foo", "bar"},
	}, {
		message:       "default value and set by args",
		defaultValue:  []string{"omg"},
		args:          []string{"--value", "foo,bar"},
		expectedValue: []string{"foo", "bar"},
	}} {
		c.Log(fmt.Sprintf("%v: %s", i, test.message))
		f := gnuflag.NewFlagSet("test", gnuflag.ContinueOnError)
		f.SetOutput(ioutil.Discard)
		var value []string
		f.Var(cmd.NewStringsValue(test.defaultValue, &value), "value", "help")
		err := f.Parse(false, test.args)
		c.Check(err, gc.IsNil)
		c.Check(value, gc.DeepEquals, test.expectedValue)
	}
}
Ejemplo n.º 23
0
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
}
Ejemplo n.º 24
0
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
}
Ejemplo n.º 25
0
func (c *serviceRemove) Flags() *gnuflag.FlagSet {
	if c.fs == nil {
		c.fs = gnuflag.NewFlagSet("service-remove", gnuflag.ExitOnError)
		c.fs.BoolVar(&c.yes, "assume-yes", false, "Don't ask for confirmation, just remove the service.")
		c.fs.BoolVar(&c.yes, "y", false, "Don't ask for confirmation, just remove the service.")
	}
	return c.fs
}
Ejemplo n.º 26
0
func newDeleteCmd() *deleteCmd {
	cmd := new(deleteCmd)
	flags := gnuflag.NewFlagSet(cmd.Name(), gnuflag.ExitOnError)
	flags.StringVar(&cmd.configPath, "config", "", "prlpks configuration file")
	flags.StringVar(&cmd.keyHash, "keyHash", "", "Delete key hash")
	cmd.flags = flags
	return cmd
}
Ejemplo n.º 27
0
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
}
Ejemplo n.º 28
0
func (c *MesosMasterInstall) Flags() *gnuflag.FlagSet {
	if c.Fs == nil {
		c.Fs = gnuflag.NewFlagSet("megdc", gnuflag.ExitOnError)
		c.Fs.StringVar(&c.Sparkvrs, "sparkversion", "1.5.1", "version of the spark")

	}
	return c.Fs
}
Ejemplo n.º 29
0
func newLoginCmd() *loginCmd {
	cmd := &loginCmd{}
	cmd.flags = gnuflag.NewFlagSet(cmd.Name(), gnuflag.ExitOnError)
	cmd.flags.StringVar(&cmd.url, "url", "", "Affinity server URL")
	cmd.flags.StringVar(&cmd.user, "user", "", "Authenticate user")
	cmd.flags.StringVar(&cmd.homeDir, "homedir", "", "Affinity client home (default: ~/.affinity)")
	return cmd
}
Ejemplo n.º 30
0
func (c *listAutoScaleHistoryCmd) Flags() *gnuflag.FlagSet {
	if c.fs == nil {
		c.fs = gnuflag.NewFlagSet("with-flags", gnuflag.ContinueOnError)
		c.fs.IntVar(&c.page, "page", 1, "Current page")
		c.fs.IntVar(&c.page, "p", 1, "Current page")
	}
	return c.fs
}