func (s *CmdSuite) TestInfo(c *gc.C) { minimal := &TestCommand{Name: "verb", Minimal: true} help := minimal.Info().Help(cmdtesting.NewFlagSet()) c.Assert(string(help), gc.Equals, minimalHelp) full := &TestCommand{Name: "verb"} f := cmdtesting.NewFlagSet() var ignored string f.StringVar(&ignored, "option", "", "option-doc") help = full.Info().Help(f) c.Assert(string(help), gc.Equals, fullHelp) optionInfo := full.Info() optionInfo.Doc = "" help = optionInfo.Help(f) c.Assert(string(help), gc.Equals, optionHelp) }
func newLogWithFlags(c *gc.C, defaultConfig string, flags ...string) *cmd.Log { log := &cmd.Log{ DefaultConfig: defaultConfig, } flagSet := cmdtesting.NewFlagSet() log.AddFlags(flagSet) err := flagSet.Parse(false, flags) c.Assert(err, gc.IsNil) return log }
func fs() (*gnuflag.FlagSet, *cmd.FileVar) { var config cmd.FileVar fs := cmdtesting.NewFlagSet() fs.Var(&config, "config", "the config") return fs, &config }