diff --git a/main.go b/main.go index f454a72..b5088ce 100644 --- a/main.go +++ b/main.go @@ -44,7 +44,7 @@ type CLI struct { Completion kongcompletion.Completion `help:"Generate shell completion scripts." cmd:"" aliases:"c"` - Raw RawCmdGroup `help:"Send raw OSC messages to the mixer." cmd:"" group:"Raw"` + Raw RawCmd `help:"Send raw OSC messages to the mixer." cmd:"" group:"Raw"` Main MainCmdGroup `help:"Control the Main L/R output" cmd:"" group:"Main"` Strip StripCmdGroup `help:"Control the strips." cmd:"" group:"Strip"` Bus BusCmdGroup `help:"Control the buses." cmd:"" group:"Bus"` diff --git a/raw.go b/raw.go index 6335f05..782129e 100644 --- a/raw.go +++ b/raw.go @@ -5,17 +5,13 @@ import ( "time" ) -type RawCmdGroup struct { - Send RawSendCmd `help:"Send a raw OSC message to the mixer." cmd:""` -} - -type RawSendCmd struct { +type RawCmd struct { Timeout time.Duration `help:"Timeout for the OSC message send operation." default:"200ms" short:"t"` Address string `help:"The OSC address to send the message to." arg:""` Args []string `help:"The arguments to include in the OSC message." arg:"" optional:""` } -func (cmd *RawSendCmd) Run(ctx *context) error { +func (cmd *RawCmd) Run(ctx *context) error { params := make([]any, len(cmd.Args)) for i, arg := range cmd.Args { params[i] = arg @@ -28,7 +24,9 @@ func (cmd *RawSendCmd) Run(ctx *context) error { if err != nil { return fmt.Errorf("failed to receive response for raw OSC message: %w", err) } - fmt.Fprintf(ctx.Out, "Received response: %s with args: %v\n", msg.Address, msg.Arguments) + if msg != nil { + fmt.Fprintf(ctx.Out, "Received response: %s with args: %v\n", msg.Address, msg.Arguments) + } return nil }