add float32 flag parser

This commit is contained in:
Ryan Cavicchioni 2020-03-28 18:03:16 -05:00
parent 67cd97e2d8
commit 4b6f159d03
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D

View File

@ -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