aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-10 23:41:33 +0800
committerFelix Lange <fjl@twurst.com>2015-03-10 23:41:33 +0800
commit2407f006adbcbe5f5405b8591c5e9845cfa7dd5c (patch)
treea4dbe5d61b16b524c0b50ca0313691ffd376002b /Godeps
parent0bb7377ebee69c3467c21d355dd24945d0becad5 (diff)
downloadgo-tangerine-2407f006adbcbe5f5405b8591c5e9845cfa7dd5c.tar
go-tangerine-2407f006adbcbe5f5405b8591c5e9845cfa7dd5c.tar.gz
go-tangerine-2407f006adbcbe5f5405b8591c5e9845cfa7dd5c.tar.bz2
go-tangerine-2407f006adbcbe5f5405b8591c5e9845cfa7dd5c.tar.lz
go-tangerine-2407f006adbcbe5f5405b8591c5e9845cfa7dd5c.tar.xz
go-tangerine-2407f006adbcbe5f5405b8591c5e9845cfa7dd5c.tar.zst
go-tangerine-2407f006adbcbe5f5405b8591c5e9845cfa7dd5c.zip
Godeps: bump github.com/codegangsta/cli
Diffstat (limited to 'Godeps')
-rw-r--r--Godeps/Godeps.json4
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/app.go31
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go3
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/command.go2
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/help.go13
5 files changed, 42 insertions, 11 deletions
diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
index 8118b4509..e0a932f8b 100644
--- a/Godeps/Godeps.json
+++ b/Godeps/Godeps.json
@@ -17,8 +17,8 @@
},
{
"ImportPath": "github.com/codegangsta/cli",
- "Comment": "1.2.0-74-g50c77ec",
- "Rev": "50c77ecec0068c9aef9d90ae0fd0fdf410041da3"
+ "Comment": "1.2.0-81-g3e09053",
+ "Rev": "3e0905345cd2c5366530dbcdce62457f2ce16e7c"
},
{
"ImportPath": "github.com/ethereum/ethash",
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/app.go b/Godeps/_workspace/src/github.com/codegangsta/cli/app.go
index 928983ebd..3e7d5a63c 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/app.go
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/app.go
@@ -43,9 +43,11 @@ type App struct {
CommandNotFound func(context *Context, command string)
// Compilation date
Compiled time.Time
- // Author
+ // List of all authors who contributed
+ Authors []Author
+ // Name of Author (Note: Use App.Authors, this is deprecated)
Author string
- // Author e-mail
+ // Email of Author (Note: Use App.Authors, this is deprecated)
Email string
// Writer writer to write output to
Writer io.Writer
@@ -70,14 +72,19 @@ func NewApp() *App {
BashComplete: DefaultAppComplete,
Action: helpCommand.Action,
Compiled: compileTime(),
- Author: "Author",
- Email: "unknown@email",
+ Author: "Dr. James",
+ Email: "who@gmail.com",
+ Authors: []Author{{"Jim", "jim@corporate.com"}, {"Hank", "hank@indiepalace.com"}},
Writer: os.Stdout,
}
}
// Entry point to the cli app. Parses the arguments slice and routes to the proper flag/args combination
func (a *App) Run(arguments []string) (err error) {
+ if a.Author != "" && a.Author != "" {
+ a.Authors = append(a.Authors, Author{a.Author, a.Email})
+ }
+
if HelpPrinter == nil {
defer func() {
HelpPrinter = nil
@@ -294,3 +301,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)
+}
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go b/Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go
index fd2b0e826..6143d364b 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go
@@ -21,6 +21,9 @@ func ExampleApp() {
app.Action = func(c *cli.Context) {
fmt.Printf("Hello %v\n", c.String("name"))
}
+ app.Author = "Harrison"
+ app.Email = "harrison@lolwut.com"
+ app.Authors = []cli.Author{{"Oliver Allen", "oliver@toyshop.com"}}
app.Run(os.Args)
// Output:
// Hello Jeremy
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/command.go b/Godeps/_workspace/src/github.com/codegangsta/cli/command.go
index 5747e52e8..07c919a87 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/command.go
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/command.go
@@ -119,7 +119,7 @@ func (c Command) Run(ctx *Context) error {
// Returns true if Command.Name or Command.ShortName matches given name
func (c Command) HasName(name string) bool {
- return c.Name == name || c.ShortName == name
+ return c.Name == name || (c.ShortName != "" && c.ShortName == name)
}
func (c Command) startApp(ctx *Context) error {
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/help.go b/Godeps/_workspace/src/github.com/codegangsta/cli/help.go
index bfb278851..8d176556a 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/help.go
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/help.go
@@ -12,11 +12,10 @@ USAGE:
{{.Name}} {{if .Flags}}[global options] {{end}}command{{if .Flags}} [command options]{{end}} [arguments...]
VERSION:
- {{.Version}}{{if or .Author .Email}}
+ {{.Version}}
-AUTHOR:{{if .Author}}
- {{.Author}}{{if .Email}} - <{{.Email}}>{{end}}{{else}}
- {{.Email}}{{end}}{{end}}
+AUTHOR(S):
+ {{range .Authors}}{{ . }} {{end}}
COMMANDS:
{{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
@@ -112,6 +111,12 @@ func DefaultAppComplete(c *Context) {
// Prints help for the given command
func ShowCommandHelp(c *Context, command string) {
+ // show the subcommand help for a command with subcommands
+ if command == "" {
+ HelpPrinter(SubcommandHelpTemplate, c.App)
+ return
+ }
+
for _, c := range c.App.Commands {
if c.HasName(command) {
HelpPrinter(CommandHelpTemplate, c)