Default app.Writer to os.Stdout

As NewApp() does.

Fixes #545
main
Jesse Szwedko 8 years ago
parent 55f715e28c
commit 508a23430b

@ -165,6 +165,10 @@ func (a *App) Setup() {
if a.Metadata == nil {
a.Metadata = make(map[string]interface{})
}
if a.Writer == nil {
a.Writer = os.Stdout
}
}
// Run is the entry point to the cli app. Parses the arguments slice and routes

@ -202,6 +202,12 @@ func TestApp_Command(t *testing.T) {
}
}
func TestApp_Setup_defaultsWriter(t *testing.T) {
app := &App{}
app.Setup()
expect(t, app.Writer, os.Stdout)
}
func TestApp_CommandWithArgBeforeFlags(t *testing.T) {
var parsedOption, firstArg string

Loading…
Cancel
Save