Fix upgrade flaeg
This commit is contained in:
parent
a0b9c0d007
commit
d63636243c
4 changed files with 19 additions and 11 deletions
10
Gopkg.lock
generated
10
Gopkg.lock
generated
|
@ -278,8 +278,8 @@
|
||||||
".",
|
".",
|
||||||
"parse"
|
"parse"
|
||||||
]
|
]
|
||||||
revision = "aad81c7ac7f49671a59b9ede8ab22436e132a302"
|
revision = "c93d194b807ef171c43344d60adad8b58217390a"
|
||||||
version = "v1.3.0"
|
version = "v1.4.1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
@ -343,10 +343,10 @@
|
||||||
version = "v3.2.0"
|
version = "v3.2.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
name = "github.com/dimchansky/utfbom"
|
name = "github.com/dimchansky/utfbom"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "5448fe645cb1964ba70ac8f9f2ffe975e61a536c"
|
revision = "c410c2305b32ec96caea4e24b4ecbf648e2eeb25"
|
||||||
version = "v1.0.0"
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
@ -1826,6 +1826,6 @@
|
||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "817d5ad6a6ae085d57953a73f7b615a223fa3e70b6152bf87382508bfbfbd655"
|
inputs-digest = "001d7f14037057a96b36926ec5a68b92cfc230aed7dee45989e4e7b1f4d59214"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/containous/flaeg"
|
name = "github.com/containous/flaeg"
|
||||||
version = "1.3.0"
|
version = "1.4.1"
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
|
14
vendor/github.com/containous/flaeg/flaeg.go
generated
vendored
14
vendor/github.com/containous/flaeg/flaeg.go
generated
vendored
|
@ -434,6 +434,11 @@ func LoadWithCommand(cmd *Command, cmdArgs []string, customParsers map[reflect.T
|
||||||
|
|
||||||
// PrintHelpWithCommand generates and prints command line help for a Command
|
// 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 {
|
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
|
// Define a templates
|
||||||
// Using POSXE STD : http://pubs.opengroup.org/onlinepubs/9699919799/
|
// Using POSXE STD : http://pubs.opengroup.org/onlinepubs/9699919799/
|
||||||
const helper = `{{if .ProgDescription}}{{.ProgDescription}}
|
const helper = `{{if .ProgDescription}}{{.ProgDescription}}
|
||||||
|
@ -457,7 +462,7 @@ Flags:
|
||||||
SubCommands map[string]string
|
SubCommands map[string]string
|
||||||
}
|
}
|
||||||
tempStruct := TempStruct{}
|
tempStruct := TempStruct{}
|
||||||
if cmd != nil && !cmd.HideHelp {
|
if cmd != nil {
|
||||||
tempStruct.ProgName = cmd.Name
|
tempStruct.ProgName = cmd.Name
|
||||||
tempStruct.ProgDescription = cmd.Description
|
tempStruct.ProgDescription = cmd.Description
|
||||||
tempStruct.SubCommands = map[string]string{}
|
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)
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,7 +669,7 @@ func (f *Flaeg) findCommandWithCommandArgs() (*Command, []string, error) {
|
||||||
commandName, f.commandArgs = splitArgs(f.args)
|
commandName, f.commandArgs = splitArgs(f.args)
|
||||||
if len(commandName) > 0 {
|
if len(commandName) > 0 {
|
||||||
for _, command := range f.commands {
|
for _, command := range f.commands {
|
||||||
if commandName == command.Name && !command.HideHelp {
|
if commandName == command.Name {
|
||||||
f.calledCommand = command
|
f.calledCommand = command
|
||||||
return f.calledCommand, f.commandArgs, nil
|
return f.calledCommand, f.commandArgs, nil
|
||||||
}
|
}
|
||||||
|
|
4
vendor/github.com/containous/flaeg/parse/parse.go
generated
vendored
4
vendor/github.com/containous/flaeg/parse/parse.go
generated
vendored
|
@ -172,7 +172,7 @@ type Duration time.Duration
|
||||||
|
|
||||||
// Set sets the duration from the given string value.
|
// Set sets the duration from the given string value.
|
||||||
func (d *Duration) Set(s string) error {
|
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)
|
*d = Duration(time.Duration(v) * time.Second)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ func (d *Duration) MarshalJSON() ([]byte, error) {
|
||||||
|
|
||||||
// UnmarshalJSON deserializes the given text into a duration value.
|
// UnmarshalJSON deserializes the given text into a duration value.
|
||||||
func (d *Duration) UnmarshalJSON(text []byte) error {
|
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))
|
*d = Duration(time.Duration(v))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue