Fix upgrade flaeg

This commit is contained in:
Michael
2018-12-03 10:34:04 +01:00
committed by Traefiker Bot
parent 617de78d14
commit 6aa040ad9f
4 changed files with 17 additions and 9 deletions

6
Gopkg.lock generated
View File

@@ -284,8 +284,8 @@
".",
"parse"
]
revision = "aad81c7ac7f49671a59b9ede8ab22436e132a302"
version = "v1.3.0"
revision = "c93d194b807ef171c43344d60adad8b58217390a"
version = "v1.4.1"
[[projects]]
branch = "master"
@@ -1858,6 +1858,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "6ee32d5903ed13bd76b1611117595144c7dad503aee04cc390b28ca308f2e1b8"
inputs-digest = "26517fdb01d55f549e4692c251587c90f657b7736e2951d673a530f3b86a90fb"
solver-name = "gps-cdcl"
solver-version = 1

View File

@@ -54,7 +54,7 @@
[[constraint]]
name = "github.com/containous/flaeg"
version = "1.3.0"
version = "1.4.1"
[[constraint]]
branch = "master"

View File

@@ -434,6 +434,11 @@ func LoadWithCommand(cmd *Command, cmdArgs []string, customParsers map[reflect.T
// PrintHelpWithCommand generates and prints command line help for a Command
func PrintHelpWithCommand(flagMap map[string]reflect.StructField, defaultValMap map[string]reflect.Value, parsers map[reflect.Type]parse.Parser, cmd *Command, subCmd []*Command) error {
// Hide command from help
if cmd != nil && cmd.HideHelp {
return fmt.Errorf("command %s not found", cmd.Name)
}
// Define a templates
// Using POSXE STD : http://pubs.opengroup.org/onlinepubs/9699919799/
const helper = `{{if .ProgDescription}}{{.ProgDescription}}
@@ -457,7 +462,7 @@ Flags:
SubCommands map[string]string
}
tempStruct := TempStruct{}
if cmd != nil && !cmd.HideHelp {
if cmd != nil {
tempStruct.ProgName = cmd.Name
tempStruct.ProgDescription = cmd.Description
tempStruct.SubCommands = map[string]string{}
@@ -582,7 +587,10 @@ func PrintErrorWithCommand(err error, flagMap map[string]reflect.StructField, de
fmt.Printf("Error here : %s\n", err)
}
PrintHelpWithCommand(flagMap, defaultValMap, parsers, cmd, subCmd)
if errHelp := PrintHelpWithCommand(flagMap, defaultValMap, parsers, cmd, subCmd); errHelp != nil {
return errHelp
}
return err
}
@@ -661,7 +669,7 @@ func (f *Flaeg) findCommandWithCommandArgs() (*Command, []string, error) {
commandName, f.commandArgs = splitArgs(f.args)
if len(commandName) > 0 {
for _, command := range f.commands {
if commandName == command.Name && !command.HideHelp {
if commandName == command.Name {
f.calledCommand = command
return f.calledCommand, f.commandArgs, nil
}

View File

@@ -172,7 +172,7 @@ type Duration time.Duration
// Set sets the duration from the given string value.
func (d *Duration) Set(s string) error {
if v, err := strconv.Atoi(s); err == nil {
if v, err := strconv.ParseInt(s, 10, 64); err == nil {
*d = Duration(time.Duration(v) * time.Second)
return nil
}
@@ -211,7 +211,7 @@ func (d *Duration) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given text into a duration value.
func (d *Duration) UnmarshalJSON(text []byte) error {
if v, err := strconv.Atoi(string(text)); err == nil {
if v, err := strconv.ParseInt(string(text), 10, 64); err == nil {
*d = Duration(time.Duration(v))
return nil
}