add replaybuffer toggle command

This commit is contained in:
onyx-and-iris 2025-05-07 20:16:44 +01:00
parent 53bbb58cfb
commit 3095c0c49d

View File

@ -8,6 +8,7 @@ import (
type ReplayBufferCmd struct { type ReplayBufferCmd struct {
Start ReplayBufferStartCmd `help:"Start replay buffer." cmd:"" aliases:"s"` Start ReplayBufferStartCmd `help:"Start replay buffer." cmd:"" aliases:"s"`
Stop ReplayBufferStopCmd `help:"Stop replay buffer." cmd:"" aliases:"st"` Stop ReplayBufferStopCmd `help:"Stop replay buffer." cmd:"" aliases:"st"`
Toggle ReplayBufferToggleCmd `help:"Toggle replay buffer." cmd:"" aliases:"tg"`
Status ReplayBufferStatusCmd `help:"Get replay buffer status." cmd:"" aliases:"ss"` Status ReplayBufferStatusCmd `help:"Get replay buffer status." cmd:"" aliases:"ss"`
Save ReplayBufferSaveCmd `help:"Save replay buffer." cmd:"" aliases:"sv"` Save ReplayBufferSaveCmd `help:"Save replay buffer." cmd:"" aliases:"sv"`
} }
@ -30,6 +31,24 @@ func (cmd *ReplayBufferStopCmd) Run(ctx *context) error {
return err return err
} }
// ReplayBufferToggleCmd toggles the replay buffer state.
type ReplayBufferToggleCmd struct{} // size = 0x0
// Run executes the command to toggle the replay buffer.
func (cmd *ReplayBufferToggleCmd) Run(ctx *context) error {
status, err := ctx.Client.Outputs.ToggleReplayBuffer()
if err != nil {
return err
}
if status.OutputActive {
fmt.Fprintln(ctx.Out, "Replay buffer started successfully.")
} else {
fmt.Fprintln(ctx.Out, "Replay buffer stopped successfully.")
}
return nil
}
// ReplayBufferStatusCmd retrieves the status of the replay buffer. // ReplayBufferStatusCmd retrieves the status of the replay buffer.
type ReplayBufferStatusCmd struct{} // size = 0x0 type ReplayBufferStatusCmd struct{} // size = 0x0