add float32 flag parser
This commit is contained in:
parent
67cd97e2d8
commit
4b6f159d03
@ -36,12 +36,20 @@ var (
|
||||
defaultFast bool = false
|
||||
defaultWhiteKelvin string = ""
|
||||
defaultWhiteName string = ""
|
||||
defaultHue string = ""
|
||||
defaultSaturation string = ""
|
||||
defaultRGB string = ""
|
||||
)
|
||||
|
||||
func (f Flags) String(name string) string {
|
||||
return f.FlagSet.Lookup(name).Value.String()
|
||||
}
|
||||
|
||||
func (f Flags) Float32(name string) float32 {
|
||||
val, _ := strconv.ParseFloat(f.String(name), 32)
|
||||
return float32(val)
|
||||
}
|
||||
|
||||
func (f Flags) Float64(name string) float64 {
|
||||
val, _ := strconv.ParseFloat(f.String(name), 64)
|
||||
return val
|
||||
|
Loading…
Reference in New Issue
Block a user