Update vendored dependencies.
This commit is contained in:
parent
d6d93db13b
commit
e375ba98f0
8 changed files with 233 additions and 49 deletions
9
vendor/github.com/containous/flaeg/flaeg.go
generated
vendored
9
vendor/github.com/containous/flaeg/flaeg.go
generated
vendored
|
@ -3,7 +3,6 @@ package flaeg
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
flag "github.com/ogier/pflag"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
@ -14,6 +13,8 @@ import (
|
|||
"text/tabwriter"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
flag "github.com/ogier/pflag"
|
||||
)
|
||||
|
||||
// ErrParserNotFound is thrown when a field is flaged but not parser match its type
|
||||
|
@ -131,8 +132,8 @@ func loadParsers(customParsers map[reflect.Type]Parser) (map[reflect.Type]Parser
|
|||
var float64Parser float64Value
|
||||
parsers[reflect.TypeOf(float64(1.5))] = &float64Parser
|
||||
|
||||
var durationParser durationValue
|
||||
parsers[reflect.TypeOf(time.Second)] = &durationParser
|
||||
var durationParser Duration
|
||||
parsers[reflect.TypeOf(Duration(time.Second))] = &durationParser
|
||||
|
||||
var timeParser timeValue
|
||||
parsers[reflect.TypeOf(time.Now())] = &timeParser
|
||||
|
@ -473,7 +474,7 @@ func PrintHelpWithCommand(flagmap map[string]reflect.StructField, defaultValmap
|
|||
// Define a templates
|
||||
// Using POSXE STD : http://pubs.opengroup.org/onlinepubs/9699919799/
|
||||
const helper = `{{if .ProgDescription}}{{.ProgDescription}}
|
||||
|
||||
|
||||
{{end}}Usage: {{.ProgName}} [--flag=flag_argument] [-f[flag_argument]] ... set flag_argument to flag(s)
|
||||
or: {{.ProgName}} [--flag[=true|false| ]] [-f[true|false| ]] ... set true/false to boolean flag(s)
|
||||
{{if .SubCommands}}
|
||||
|
|
33
vendor/github.com/containous/flaeg/parsers.go
generated
vendored
33
vendor/github.com/containous/flaeg/parsers.go
generated
vendored
|
@ -143,21 +143,38 @@ func (f *float64Value) SetValue(val interface{}) {
|
|||
*f = float64Value(val.(float64))
|
||||
}
|
||||
|
||||
// -- time.Duration Value
|
||||
type durationValue time.Duration
|
||||
// Duration is a custom type suitable for parsing duration values.
|
||||
// It supports `time.ParseDuration`-compatible values and suffix-less digits; in
|
||||
// the latter case, seconds are assumed.
|
||||
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 {
|
||||
*d = Duration(time.Duration(v) * time.Second)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *durationValue) Set(s string) error {
|
||||
v, err := time.ParseDuration(s)
|
||||
*d = durationValue(v)
|
||||
*d = Duration(v)
|
||||
return err
|
||||
}
|
||||
|
||||
func (d *durationValue) Get() interface{} { return time.Duration(*d) }
|
||||
// Get returns the duration value.
|
||||
func (d *Duration) Get() interface{} { return time.Duration(*d) }
|
||||
|
||||
func (d *durationValue) String() string { return (*time.Duration)(d).String() }
|
||||
// String returns a string representation of the duration value.
|
||||
func (d *Duration) String() string { return (*time.Duration)(d).String() }
|
||||
|
||||
func (d *durationValue) SetValue(val interface{}) {
|
||||
*d = durationValue(val.(time.Duration))
|
||||
// SetValue sets the duration from the given Duration-asserted value.
|
||||
func (d *Duration) SetValue(val interface{}) {
|
||||
*d = Duration(val.(Duration))
|
||||
}
|
||||
|
||||
// UnmarshalText deserializes the given text into a duration value.
|
||||
// It is meant to support TOML decoding of durations.
|
||||
func (d *Duration) UnmarshalText(text []byte) error {
|
||||
return d.Set(string(text))
|
||||
}
|
||||
|
||||
// -- time.Time Value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue