From c20aa82e3b80fba0619ebd9e2dbe06f18c163086 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Thu, 5 Feb 2026 04:15:21 +0000 Subject: [PATCH] remove redundant util function --- strip.go | 9 ++++----- util.go | 12 ------------ 2 files changed, 4 insertions(+), 17 deletions(-) delete mode 100644 util.go diff --git a/strip.go b/strip.go index 3a99b40..a2b00dd 100644 --- a/strip.go +++ b/strip.go @@ -134,8 +134,8 @@ func (cmd *StripFadeoutCmd) Run(ctx *context, strip *StripCmdGroup) error { } type StripSendCmd struct { - BusNum int `arg:"" help:"The bus number to get or set the send level for."` - Level *string `arg:"" help:"The send level to set (in dB)." optional:""` + BusNum int `arg:"" help:"The bus number to get or set the send level for."` + Level *float64 `arg:"" help:"The send level to set (in dB)." optional:""` } func (cmd *StripSendCmd) Run(ctx *context, strip *StripCmdGroup) error { @@ -148,11 +148,10 @@ func (cmd *StripSendCmd) Run(ctx *context, strip *StripCmdGroup) error { return nil } - level := mustConvToFloat64(*cmd.Level) - if err := ctx.Client.Strip.SetSendLevel(strip.Index.Index, cmd.BusNum, level); err != nil { + if err := ctx.Client.Strip.SetSendLevel(strip.Index.Index, cmd.BusNum, *cmd.Level); err != nil { return fmt.Errorf("failed to set send level: %w", err) } - fmt.Fprintf(ctx.Out, "Strip %d send level for bus %d set to: %.2f dB\n", strip.Index.Index, cmd.BusNum, level) + fmt.Fprintf(ctx.Out, "Strip %d send level for bus %d set to: %.2f dB\n", strip.Index.Index, cmd.BusNum, *cmd.Level) return nil } diff --git a/util.go b/util.go deleted file mode 100644 index 8cdfede..0000000 --- a/util.go +++ /dev/null @@ -1,12 +0,0 @@ -package main - -import "strconv" - -// mustConvToFloat64 converts a string to float64, panicking on error. -func mustConvToFloat64(floatStr string) float64 { - level, err := strconv.ParseFloat(floatStr, 64) - if err != nil { - panic(err) - } - return level -}