app: Allocate Metadata map automatically

This commit is contained in:
Radek Simko
2016-07-11 07:39:58 +01:00
parent 1efa31f08b
commit bef215fe3e
2 changed files with 52 additions and 0 deletions

4
app.go
View File

@@ -160,6 +160,10 @@ func (a *App) Setup() {
a.categories = a.categories.AddCommand(command.Category, command)
}
sort.Sort(a.categories)
if a.Metadata == nil {
a.Metadata = make(map[string]interface{})
}
}
// Run is the entry point to the cli app. Parses the arguments slice and routes