mirror of
https://github.com/onyx-and-iris/gobs-cli.git
synced 2025-05-20 16:10:26 +01:00
add replaybuffer toggle command
This commit is contained in:
parent
53bbb58cfb
commit
3095c0c49d
@ -8,6 +8,7 @@ import (
|
||||
type ReplayBufferCmd struct {
|
||||
Start ReplayBufferStartCmd `help:"Start replay buffer." cmd:"" aliases:"s"`
|
||||
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"`
|
||||
Save ReplayBufferSaveCmd `help:"Save replay buffer." cmd:"" aliases:"sv"`
|
||||
}
|
||||
@ -30,6 +31,24 @@ func (cmd *ReplayBufferStopCmd) Run(ctx *context) error {
|
||||
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.
|
||||
type ReplayBufferStatusCmd struct{} // size = 0x0
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user