Merge pull request #547 from urfave/default-writer
Default app.Writer to os.Stdout
This commit is contained in:
commit
3eb41f1bb1
4
app.go
4
app.go
@ -167,6 +167,10 @@ func (a *App) Setup() {
|
|||||||
if a.Metadata == nil {
|
if a.Metadata == nil {
|
||||||
a.Metadata = make(map[string]interface{})
|
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
|
// Run is the entry point to the cli app. Parses the arguments slice and routes
|
||||||
|
@ -257,6 +257,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) {
|
func TestApp_CommandWithArgBeforeFlags(t *testing.T) {
|
||||||
var parsedOption, firstArg string
|
var parsedOption, firstArg string
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user