add missing record status command

add replaybuffer toggle to readme
This commit is contained in:
onyx-and-iris 2025-05-08 00:47:15 +01:00
parent c04324d173
commit dd0bbfc0da
3 changed files with 38 additions and 5 deletions

View File

@ -50,3 +50,6 @@ issues:
exclude:
# gosec: Duplicated errcheck checks
- G104
exclude-files:
# Exclude vendor directory
- main_test.go

View File

@ -373,6 +373,12 @@ gobs-cli replaybuffer start
gobs-cli replaybuffer stop
```
- toggle: Toggle replay buffer.
```console
gobs-cli replaybuffer toggle
```
- status: Get replay buffer status.
```console

View File

@ -9,6 +9,7 @@ type RecordCmd struct {
Start RecordStartCmd `cmd:"" help:"Start recording." aliases:"s"`
Stop RecordStopCmd `cmd:"" help:"Stop recording." aliases:"st"`
Toggle RecordToggleCmd `cmd:"" help:"Toggle recording." aliases:"tg"`
Status RecordStatusCmd `cmd:"" help:"Show recording status." aliases:"ss"`
Pause RecordPauseCmd `cmd:"" help:"Pause recording." aliases:"p"`
Resume RecordResumeCmd `cmd:"" help:"Resume recording." aliases:"r"`
}
@ -57,6 +58,29 @@ func (cmd *RecordToggleCmd) Run(ctx *context) error {
return nil
}
// RecordStatusCmd shows the recording status.
type RecordStatusCmd struct{} // size = 0x0
// Run executes the command to show recording status.
func (cmd *RecordStatusCmd) Run(ctx *context) error {
status, err := ctx.Client.Record.GetRecordStatus()
if err != nil {
return err
}
if status.OutputActive {
if status.OutputPaused {
fmt.Fprintln(ctx.Out, "Recording is paused.")
} else {
fmt.Fprintln(ctx.Out, "Recording is in progress.")
}
} else {
fmt.Fprintln(ctx.Out, "Recording is not in progress.")
}
return nil
}
// RecordPauseCmd pauses the recording.
type RecordPauseCmd struct{} // size = 0x0