aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/codegangsta/cli/command.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-25 04:25:11 +0800
committerobscuren <geffobscura@gmail.com>2015-03-25 04:25:11 +0800
commit3d5f48a1602a2dbe6d9a4d123e5b3aa4f51d53a1 (patch)
treee6692d3c0de3bacfe02d0114bfdbea5a866ca7ad /Godeps/_workspace/src/github.com/codegangsta/cli/command.go
parenta6e659f74b199d2caec54a00916217ec5439c05b (diff)
downloadgo-tangerine-3d5f48a1602a2dbe6d9a4d123e5b3aa4f51d53a1.tar
go-tangerine-3d5f48a1602a2dbe6d9a4d123e5b3aa4f51d53a1.tar.gz
go-tangerine-3d5f48a1602a2dbe6d9a4d123e5b3aa4f51d53a1.tar.bz2
go-tangerine-3d5f48a1602a2dbe6d9a4d123e5b3aa4f51d53a1.tar.lz
go-tangerine-3d5f48a1602a2dbe6d9a4d123e5b3aa4f51d53a1.tar.xz
go-tangerine-3d5f48a1602a2dbe6d9a4d123e5b3aa4f51d53a1.tar.zst
go-tangerine-3d5f48a1602a2dbe6d9a4d123e5b3aa4f51d53a1.zip
updated deps
Diffstat (limited to 'Godeps/_workspace/src/github.com/codegangsta/cli/command.go')
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/command.go21
1 files changed, 19 insertions, 2 deletions
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/command.go b/Godeps/_workspace/src/github.com/codegangsta/cli/command.go
index 07c919a87..b61691c86 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/command.go
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/command.go
@@ -10,8 +10,10 @@ import (
type Command struct {
// The name of the command
Name string
- // short name of the command. Typically one character
+ // short name of the command. Typically one character (deprecated, use `Aliases`)
ShortName string
+ // A list of aliases for the command
+ Aliases []string
// A short description of the usage of this command
Usage string
// A longer explanation of how the command works
@@ -117,9 +119,24 @@ func (c Command) Run(ctx *Context) error {
return nil
}
+func (c Command) Names() []string {
+ names := []string{c.Name}
+
+ if c.ShortName != "" {
+ names = append(names, c.ShortName)
+ }
+
+ return append(names, c.Aliases...)
+}
+
// Returns true if Command.Name or Command.ShortName matches given name
func (c Command) HasName(name string) bool {
- return c.Name == name || (c.ShortName != "" && c.ShortName == name)
+ for _, n := range c.Names() {
+ if n == name {
+ return true
+ }
+ }
+ return false
}
func (c Command) startApp(ctx *Context) error {