8
"launchpad.net/gnuflag"
9
"launchpad.net/juju-core/cmd"
12
func bufferString(stream io.Writer) string {
13
return stream.(*bytes.Buffer).String()
16
// TestCommand is used by several different tests.
17
type TestCommand struct {
25
func (c *TestCommand) Info() *cmd.Info {
27
return &cmd.Info{Name: c.Name}
32
Purpose: c.Name + " the juju",
38
func (c *TestCommand) SetFlags(f *gnuflag.FlagSet) {
40
f.StringVar(&c.Option, "option", "", "option-doc")
44
func (c *TestCommand) Init(args []string) error {
45
return cmd.CheckEmpty(args)
48
func (c *TestCommand) Run(ctx *cmd.Context) error {
51
return errors.New("BAM!")
55
_, err := io.Copy(ctx.Stdout, ctx.Stdin)
58
fmt.Fprintln(ctx.Stdout, c.Option)
63
// minimalHelp and fullHelp are the expected help strings for a TestCommand
64
// with Name "verb", with and without Minimal set.
65
var minimalHelp = "usage: verb\n"
66
var optionHelp = `usage: verb [options] <something>
67
purpose: verb the juju
73
var fullHelp = `usage: verb [options] <something>
74
purpose: verb the juju