1
0
mirror of https://github.com/rancher/os.git synced 2025-09-02 15:24:32 +00:00

Bump codegangsta/cli

This commit is contained in:
Josh Curl
2016-08-09 15:16:45 -07:00
parent c67475cbaa
commit 6658917591
11 changed files with 1240 additions and 219 deletions

View File

@@ -8,6 +8,7 @@ import (
"path/filepath"
"reflect"
"sort"
"strings"
"time"
)
@@ -139,13 +140,6 @@ func (a *App) Setup() {
}
a.Commands = newCmds
a.categories = CommandCategories{}
for _, command := range a.Commands {
a.categories = a.categories.AddCommand(command.Category, command)
}
sort.Sort(a.categories)
// append help to commands
if a.Command(helpCommand.Name) == nil && !a.HideHelp {
a.Commands = append(a.Commands, helpCommand)
if (HelpFlag != BoolFlag{}) {
@@ -153,7 +147,6 @@ func (a *App) Setup() {
}
}
//append version/help flags
if a.EnableBashCompletion {
a.appendFlag(BashCompletionFlag)
}
@@ -161,6 +154,12 @@ func (a *App) Setup() {
if !a.HideVersion {
a.appendFlag(VersionFlag)
}
a.categories = CommandCategories{}
for _, command := range a.Commands {
a.categories = a.categories.AddCommand(command.Category, command)
}
sort.Sort(a.categories)
}
// Run is the entry point to the cli app. Parses the arguments slice and routes
@@ -461,11 +460,13 @@ func (a Author) String() string {
func HandleAction(action interface{}, context *Context) (err error) {
defer func() {
if r := recover(); r != nil {
switch r.(type) {
case error:
err = r.(error)
default:
err = NewExitError(fmt.Sprintf("ERROR unknown Action error: %v. See %s", r, appActionDeprecationURL), 2)
// Try to detect a known reflection error from *this scope*, rather than
// swallowing all panics that may happen when calling an Action func.
s := fmt.Sprintf("%v", r)
if strings.HasPrefix(s, "reflect: ") && strings.Contains(s, "too many input arguments") {
err = NewExitError(fmt.Sprintf("ERROR unknown Action error: %v. See %s", r, appActionDeprecationURL), 2)
} else {
panic(r)
}
}
}()