|
|
|
@ -40,10 +40,8 @@ type App struct {
|
|
|
|
|
CommandNotFound func(context *Context, command string)
|
|
|
|
|
// Compilation date
|
|
|
|
|
Compiled time.Time
|
|
|
|
|
// Author
|
|
|
|
|
Author string
|
|
|
|
|
// Author e-mail
|
|
|
|
|
Email string
|
|
|
|
|
// Authors
|
|
|
|
|
Authors []Author
|
|
|
|
|
// Writer writer to write output to
|
|
|
|
|
Writer io.Writer
|
|
|
|
|
}
|
|
|
|
@ -67,8 +65,7 @@ func NewApp() *App {
|
|
|
|
|
BashComplete: DefaultAppComplete,
|
|
|
|
|
Action: helpCommand.Action,
|
|
|
|
|
Compiled: compileTime(),
|
|
|
|
|
Author: "Author",
|
|
|
|
|
Email: "unknown@email",
|
|
|
|
|
Authors: []Author{{"Jim", "jim@corporate.com"}, {"Hank", "hank@indiepalace.com"}},
|
|
|
|
|
Writer: os.Stdout,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -273,3 +270,19 @@ func (a *App) appendFlag(flag Flag) {
|
|
|
|
|
a.Flags = append(a.Flags, flag)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Author represents someone who has contributed to a cli project.
|
|
|
|
|
type Author struct {
|
|
|
|
|
Name string // The Authors name
|
|
|
|
|
Email string // The Authors email
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String makes Author comply to the Stringer interface, to allow an easy print in the templating process
|
|
|
|
|
func (a Author) String() string {
|
|
|
|
|
e := ""
|
|
|
|
|
if a.Email != "" {
|
|
|
|
|
e = " <" + a.Email + "> "
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return fmt.Sprintf("%v %v", a.Name, e)
|
|
|
|
|
}
|
|
|
|
|