diff --git a/cmd/x32-cli/bus.go b/cmd/x32-cli/bus.go index cc1db94..1cda18d 100644 --- a/cmd/x32-cli/bus.go +++ b/cmd/x32-cli/bus.go @@ -3,8 +3,6 @@ package main import ( "fmt" "time" - - "github.com/alecthomas/kong" ) // BusCmdGroup defines the commands related to controlling the buses of the X-Air device. @@ -183,7 +181,11 @@ type BusEqCmdGroup struct { } // Validate checks that the provided EQ band number is within the valid range (1-6). -func (cmd *BusEqCmdGroup) Validate(ctx kong.Context) error { +func (cmd *BusEqCmdGroup) Validate() error { + if cmd.Band.Band == 0 { + return nil + } + if cmd.Band.Band < 1 || cmd.Band.Band > 6 { return fmt.Errorf("EQ band number must be between 1 and 6") } diff --git a/cmd/x32-cli/main.go b/cmd/x32-cli/main.go index 864ca77..3064b83 100644 --- a/cmd/x32-cli/main.go +++ b/cmd/x32-cli/main.go @@ -3,8 +3,6 @@ package main import ( "fmt" "time" - - "github.com/alecthomas/kong" ) // MainCmdGroup defines the command group for controlling the Main L/R output, including commands for mute state, fader level, and fade-in/fade-out times. @@ -146,7 +144,11 @@ type MainEqCmdGroup struct { } // Validate checks if the provided EQ band number is within the valid range (1-6) for the Main L/R output. -func (cmd *MainEqCmdGroup) Validate(ctx kong.Context) error { +func (cmd *MainEqCmdGroup) Validate() error { + if cmd.Band.Band == 0 { + return nil + } + if cmd.Band.Band < 1 || cmd.Band.Band > 6 { return fmt.Errorf("invalid EQ band number: %d. Valid range is 1-6", cmd.Band.Band) } diff --git a/cmd/x32-cli/mainmono.go b/cmd/x32-cli/mainmono.go index bf4fb64..4fa08e5 100644 --- a/cmd/x32-cli/mainmono.go +++ b/cmd/x32-cli/mainmono.go @@ -3,8 +3,6 @@ package main import ( "fmt" "time" - - "github.com/alecthomas/kong" ) // MainMonoCmdGroup defines the command group for controlling the Main Mono output, including commands for mute state, fader level, and fade-in/fade-out times. @@ -146,7 +144,11 @@ type MainMonoEqCmdGroup struct { } // Validate checks if the provided EQ band number is within the valid range (1-6) for the Main Mono output. -func (cmd *MainMonoEqCmdGroup) Validate(ctx kong.Context) error { +func (cmd *MainMonoEqCmdGroup) Validate() error { + if cmd.Band.Band == 0 { + return nil + } + if cmd.Band.Band < 1 || cmd.Band.Band > 6 { return fmt.Errorf("invalid EQ band number: %d. Valid range is 1-6", cmd.Band.Band) } diff --git a/cmd/x32-cli/matrix.go b/cmd/x32-cli/matrix.go index 1d71be2..82dd865 100644 --- a/cmd/x32-cli/matrix.go +++ b/cmd/x32-cli/matrix.go @@ -3,8 +3,6 @@ package main import ( "fmt" "time" - - "github.com/alecthomas/kong" ) // MatrixCmdGroup defines the command group for controlling the Matrix outputs, including commands for mute state, fader level, and fade-in/fade-out times. @@ -22,7 +20,7 @@ type MatrixCmdGroup struct { } `help:"Commands for controlling individual Matrix outputs." arg:""` } -func (cmd *MatrixCmdGroup) Validate(ctx kong.Context) error { +func (cmd *MatrixCmdGroup) Validate() error { if cmd.Index.Index < 1 || cmd.Index.Index > 6 { return fmt.Errorf("invalid Matrix output index: %d. Valid range is 1-6", cmd.Index.Index) } @@ -156,7 +154,11 @@ type MatrixEqCmdGroup struct { } // Validate checks if the provided EQ band number is within the valid range (1-6) for the Matrix output. -func (cmd *MatrixEqCmdGroup) Validate(ctx kong.Context) error { +func (cmd *MatrixEqCmdGroup) Validate() error { + if cmd.Band.Band == 0 { + return nil + } + if cmd.Band.Band < 1 || cmd.Band.Band > 6 { return fmt.Errorf("invalid EQ band number: %d. Valid range is 1-6", cmd.Band.Band) } diff --git a/cmd/x32-cli/strip.go b/cmd/x32-cli/strip.go index eb72f60..f80e5d1 100644 --- a/cmd/x32-cli/strip.go +++ b/cmd/x32-cli/strip.go @@ -3,8 +3,6 @@ package main import ( "fmt" "time" - - "github.com/alecthomas/kong" ) // StripCmdGroup defines the command group for controlling the strips of the mixer, including commands for getting and setting various parameters such as mute state, fader level, send levels, and EQ settings. @@ -374,7 +372,11 @@ type StripEqCmdGroup struct { } // Validate checks if the provided EQ band number is valid (between 1 and 4) and returns an error if it is not. -func (cmd *StripEqCmdGroup) Validate(ctx kong.Context) error { +func (cmd *StripEqCmdGroup) Validate() error { + if cmd.Band.Band == 0 { + return nil + } + if cmd.Band.Band < 1 || cmd.Band.Band > 4 { return fmt.Errorf("EQ band number must be between 1 and 4") } diff --git a/cmd/xair-cli/bus.go b/cmd/xair-cli/bus.go index cc1db94..8b6b03e 100644 --- a/cmd/xair-cli/bus.go +++ b/cmd/xair-cli/bus.go @@ -3,8 +3,6 @@ package main import ( "fmt" "time" - - "github.com/alecthomas/kong" ) // BusCmdGroup defines the commands related to controlling the buses of the X-Air device. @@ -183,7 +181,12 @@ type BusEqCmdGroup struct { } // Validate checks that the provided EQ band number is within the valid range (1-6). -func (cmd *BusEqCmdGroup) Validate(ctx kong.Context) error { +// Only validates when a band number is actually specified (non-zero). +func (cmd *BusEqCmdGroup) Validate() error { + if cmd.Band.Band == 0 { + return nil + } + if cmd.Band.Band < 1 || cmd.Band.Band > 6 { return fmt.Errorf("EQ band number must be between 1 and 6") } diff --git a/cmd/xair-cli/main.go b/cmd/xair-cli/main.go index 864ca77..3064b83 100644 --- a/cmd/xair-cli/main.go +++ b/cmd/xair-cli/main.go @@ -3,8 +3,6 @@ package main import ( "fmt" "time" - - "github.com/alecthomas/kong" ) // MainCmdGroup defines the command group for controlling the Main L/R output, including commands for mute state, fader level, and fade-in/fade-out times. @@ -146,7 +144,11 @@ type MainEqCmdGroup struct { } // Validate checks if the provided EQ band number is within the valid range (1-6) for the Main L/R output. -func (cmd *MainEqCmdGroup) Validate(ctx kong.Context) error { +func (cmd *MainEqCmdGroup) Validate() error { + if cmd.Band.Band == 0 { + return nil + } + if cmd.Band.Band < 1 || cmd.Band.Band > 6 { return fmt.Errorf("invalid EQ band number: %d. Valid range is 1-6", cmd.Band.Band) } diff --git a/cmd/xair-cli/strip.go b/cmd/xair-cli/strip.go index eb72f60..f80e5d1 100644 --- a/cmd/xair-cli/strip.go +++ b/cmd/xair-cli/strip.go @@ -3,8 +3,6 @@ package main import ( "fmt" "time" - - "github.com/alecthomas/kong" ) // StripCmdGroup defines the command group for controlling the strips of the mixer, including commands for getting and setting various parameters such as mute state, fader level, send levels, and EQ settings. @@ -374,7 +372,11 @@ type StripEqCmdGroup struct { } // Validate checks if the provided EQ band number is valid (between 1 and 4) and returns an error if it is not. -func (cmd *StripEqCmdGroup) Validate(ctx kong.Context) error { +func (cmd *StripEqCmdGroup) Validate() error { + if cmd.Band.Band == 0 { + return nil + } + if cmd.Band.Band < 1 || cmd.Band.Band > 4 { return fmt.Errorf("EQ band number must be between 1 and 4") }