~juju/juju-core/trunk

« back to all changes in this revision

Viewing changes to testing/cmd.go

  • Committer: Tim Penhey
  • Date: 2013-03-14 22:05:40 UTC
  • mfrom: (993.1.10 format-flag)
  • Revision ID: tim.penhey@canonical.com-20130314220540-0o7j2ki1kb46sjp6
Add a --format flag for jujuc commands missing it

Fixes lp:1129130.  Also marks the --format flag as deprecated for commands
that don't produce output.

R=dfc, dimitern
CC=
https://codereview.appspot.com/7795045

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
        }
50
50
}
51
51
 
 
52
// Stdout takes a command Context that we assume has been created in this
 
53
// package, and gets the content of the Stdout buffer as a string.
 
54
func Stdout(ctx *cmd.Context) string {
 
55
        return ctx.Stdout.(*bytes.Buffer).String()
 
56
}
 
57
 
 
58
// Stderr takes a command Context that we assume has been created in this
 
59
// package, and gets the content of the Stderr buffer as a string.
 
60
func Stderr(ctx *cmd.Context) string {
 
61
        return ctx.Stderr.(*bytes.Buffer).String()
 
62
}
 
63
 
52
64
// RunCommand will run a command with the specified args.  The returned error
53
65
// may come from either the parsing of the args, the command initialisation or
54
66
// the actual running of the command.  Access to the resulting output streams