Support for shortnames

This commit is contained in:
Jeremy Saenz 2013-07-14 18:00:03 -07:00
parent 6fa7cfa8a6
commit bdb9c5ab61
2 changed files with 2 additions and 2 deletions

2
cli.go
View File

@ -20,7 +20,7 @@ func Run(args []string) {
if len(args) > 1 { if len(args) > 1 {
name := args[1] name := args[1]
for _, c := range append(Commands, HelpCommand) { for _, c := range append(Commands, HelpCommand) {
if c.Name == name { if c.Name == name || c.ShortName == name {
c.Action(name) c.Action(name)
return return
} }

View File

@ -29,7 +29,7 @@ VERSION:
{{.Version}} {{.Version}}
COMMANDS: COMMANDS:
{{range .Commands}}{{.Name}}{{ "\t" }}{{.Usage}} {{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
{{end}} {{end}}
` `
data := HelpData{ data := HelpData{