Merge pull request #193 from codegangsta/add-aliases

Add `Command.Aliases` and deprecate `Command.ShortName`
This commit is contained in:
2015-03-16 21:49:33 -04:00
7 changed files with 64 additions and 43 deletions

7
app.go
View File

@@ -5,6 +5,7 @@ import (
"io"
"io/ioutil"
"os"
"strings"
"text/tabwriter"
"text/template"
"time"
@@ -88,8 +89,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)