use new app.ExtraInfo inside minio and donut commands properly

This commit is contained in:
Harshavardhana
2015-07-24 23:55:18 -07:00
parent 8346cc74db
commit 0eefbdef0c
5 changed files with 27 additions and 16 deletions

13
main.go
View File

@@ -114,11 +114,16 @@ func main() {
app.Flags = flags
app.Commands = commands
app.Before = func(c *cli.Context) error {
if c.GlobalBool("debug") {
app.ExtraInfo = getSystemData()
}
globalDebugFlag = c.GlobalBool("debug")
return nil
}
app.ExtraInfo = func() map[string]string {
if globalDebugFlag {
return getSystemData()
}
return make(map[string]string)
}
app.CustomAppHelpTemplate = `NAME:
{{.Name}} - {{.Usage}}
@@ -134,7 +139,7 @@ GLOBAL FLAGS:
VERSION:
{{if .Compiled}}
{{.Compiled}}{{end}}
{{range $key, $value := .ExtraInfo}}
{{range $key, $value := ExtraInfo}}
{{$key}}:
{{$value}}
{{end}}