mirror of
https://github.com/onyx-and-iris/gobs-cli.git
synced 2025-05-20 08:10:22 +01:00
add missing record status command
add replaybuffer toggle to readme
This commit is contained in:
parent
c04324d173
commit
dd0bbfc0da
@ -50,3 +50,6 @@ issues:
|
||||
exclude:
|
||||
# gosec: Duplicated errcheck checks
|
||||
- G104
|
||||
exclude-files:
|
||||
# Exclude vendor directory
|
||||
- main_test.go
|
||||
|
@ -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
|
||||
|
34
record.go
34
record.go
@ -6,11 +6,12 @@ import (
|
||||
|
||||
// RecordCmd handles the recording commands.
|
||||
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"`
|
||||
Pause RecordPauseCmd `cmd:"" help:"Pause recording." aliases:"p"`
|
||||
Resume RecordResumeCmd `cmd:"" help:"Resume recording." aliases:"r"`
|
||||
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"`
|
||||
}
|
||||
|
||||
// RecordStartCmd starts the recording.
|
||||
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user