From 4b6f159d0351624ba3e77a685df0a73998e2ec11 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sat, 28 Mar 2020 18:03:16 -0500 Subject: [PATCH] add float32 flag parser --- cmd/command.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/command.go b/cmd/command.go index 912a8f3..cacb8b7 100644 --- a/cmd/command.go +++ b/cmd/command.go @@ -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