Add Command.Aliases and deprecate Command.ShortName

`Aliases` will be more flexible while still allowing "ShortName"
behaviour via `Aliases`.
This commit is contained in:
jszwedko
2015-03-09 21:24:57 -07:00
parent 3e0905345c
commit bf65971a6a
7 changed files with 75 additions and 71 deletions

7
app.go
View File

@@ -5,6 +5,7 @@ import (
"io"
"io/ioutil"
"os"
"strings"
"text/tabwriter"
"text/template"
"time"
@@ -91,8 +92,12 @@ func (a *App) Run(arguments []string) (err error) {
}()
HelpPrinter = func(templ string, data interface{}) {
funcMap := template.FuncMap{
"join": strings.Join,
}
w := tabwriter.NewWriter(a.Writer, 0, 8, 1, '\t', 0)
t := template.Must(template.New("help").Parse(templ))
t := template.Must(template.New("help").Funcs(funcMap).Parse(templ))
err := t.Execute(w, data)
if err != nil {
panic(err)