Compare commits

..

No commits in common. "82c0756ddec311abc1f92bb7e0e563e558dbeed6" and "c8a055fa28b3607450b4c28d891801c311b37e9f" have entirely different histories.

6 changed files with 30 additions and 110 deletions

View File

@ -5,17 +5,6 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# [0.11.0] - 2025-06-20
### Added
- input list, scene list and sceneitem list now accept --uuid flag.
- Active column added to scene list table.
### Changed
- scene list no longer prints the UUIDs by default, enable it with the --uuid flag.
# [0.10.3] - 2025-06-07
### Added

View File

@ -54,10 +54,6 @@ gobs-cli obs-version
### SceneCmd
- list: List all scenes.
- flags:
*optional*
- --UUID: Display UUIDs of scenes.
```console
gobs-cli scene list
@ -91,10 +87,6 @@ gobs-cli scene switch --preview LIVE
### SceneItemCmd
- list: List all scene items.
- flags:
*optional*
- --UUID: Display UUIDs of scene items.
*optional*
- args: SceneName
@ -233,7 +225,6 @@ gobs-cli group status START "test_group"
- --colour: List all colour sources.
- --ffmpeg: List all ffmpeg sources.
- --vlc: List all VLC sources.
- --uuid: Display UUIDs of inputs.
```console
gobs-cli input list

View File

@ -2,7 +2,6 @@ package main
import (
"fmt"
"sort"
"strings"
"github.com/andreykaipov/goobs/api/requests/inputs"
@ -24,7 +23,6 @@ type InputListCmd struct {
Colour bool `flag:"" help:"List all colour sources." aliases:"c"`
Ffmpeg bool `flag:"" help:"List all ffmpeg sources." aliases:"f"`
Vlc bool `flag:"" help:"List all VLC sources." aliases:"v"`
UUID bool `flag:"" help:"Display UUIDs of inputs." aliases:"u"`
}
// Run executes the command to list all inputs.
@ -36,31 +34,22 @@ func (cmd *InputListCmd) Run(ctx *context) error {
t := table.New(ctx.Out)
t.SetPadding(3)
if cmd.UUID {
t.SetAlignment(table.AlignLeft, table.AlignLeft, table.AlignCenter, table.AlignLeft)
t.SetHeaders("Input Name", "Kind", "Muted", "UUID")
} else {
t.SetAlignment(table.AlignLeft, table.AlignLeft, table.AlignCenter)
t.SetHeaders("Input Name", "Kind", "Muted")
}
sort.Slice(resp.Inputs, func(i, j int) bool {
return resp.Inputs[i].InputName < resp.Inputs[j].InputName
})
t.SetAlignment(table.AlignLeft, table.AlignLeft, table.AlignCenter)
t.SetHeaders("Input Name", "Kind", "Muted")
for _, input := range resp.Inputs {
var muteMark string
resp, err := ctx.Client.Inputs.GetInputMute(
inputs.NewGetInputMuteParams().WithInputName(input.InputName),
)
if err != nil {
if err.Error() == "request GetInputMute: InvalidResourceState (604): The specified input does not support audio." {
muteMark = "N/A"
} else {
return fmt.Errorf("failed to get input mute state: %w", err)
for _, kind := range []string{"input", "output", "ffmpeg", "vlc"} {
if strings.Contains(input.InputKind, kind) {
resp, err := ctx.Client.Inputs.GetInputMute(
inputs.NewGetInputMuteParams().WithInputName(input.InputName),
)
if err != nil {
return fmt.Errorf("failed to get input mute state: %w", err)
}
muteMark = getEnabledMark(resp.InputMuted)
break
}
} else {
muteMark = getEnabledMark(resp.InputMuted)
}
type filter struct {
@ -78,22 +67,14 @@ func (cmd *InputListCmd) Run(ctx *context) error {
var added bool
for _, f := range filters {
if f.enabled && strings.Contains(input.InputKind, f.keyword) {
if cmd.UUID {
t.AddRow(input.InputName, input.InputKind, muteMark, input.InputUuid)
} else {
t.AddRow(input.InputName, input.InputKind, muteMark)
}
t.AddRow(input.InputName, input.InputKind, muteMark)
added = true
break
}
}
if !added && (!cmd.Input && !cmd.Output && !cmd.Colour && !cmd.Ffmpeg && !cmd.Vlc) {
if cmd.UUID {
t.AddRow(input.InputName, snakeCaseToTitleCase(input.InputKind), muteMark, input.InputUuid)
} else {
t.AddRow(input.InputName, snakeCaseToTitleCase(input.InputKind), muteMark)
}
t.AddRow(input.InputName, input.InputKind, muteMark)
}
}
t.Render()

View File

@ -16,9 +16,7 @@ type SceneCmd struct {
}
// SceneListCmd provides a command to list all scenes.
type SceneListCmd struct {
UUID bool `flag:"" help:"Display UUIDs of scenes."`
}
type SceneListCmd struct{} // size = 0x0
// Run executes the command to list all scenes.
func (cmd *SceneListCmd) Run(ctx *context) error {
@ -27,32 +25,14 @@ func (cmd *SceneListCmd) Run(ctx *context) error {
return err
}
currentScene, err := ctx.Client.Scenes.GetCurrentProgramScene()
if err != nil {
return err
}
t := table.New(ctx.Out)
t.SetPadding(3)
if cmd.UUID {
t.SetAlignment(table.AlignLeft, table.AlignCenter, table.AlignLeft)
t.SetHeaders("Scene Name", "Active", "UUID")
} else {
t.SetAlignment(table.AlignLeft, table.AlignCenter)
t.SetHeaders("Scene Name", "Active")
}
t.SetAlignment(table.AlignLeft, table.AlignLeft)
t.SetHeaders("Scene Name", "UUID")
slices.Reverse(scenes.Scenes)
for _, scene := range scenes.Scenes {
var activeMark string
if scene.SceneName == currentScene.SceneName {
activeMark = getEnabledMark(true)
}
if cmd.UUID {
t.AddRow(scene.SceneName, activeMark, scene.SceneUuid)
} else {
t.AddRow(scene.SceneName, activeMark)
}
t.AddRow(scene.SceneName, scene.SceneUuid)
}
t.Render()
return nil

View File

@ -21,8 +21,7 @@ type SceneItemCmd struct {
// SceneItemListCmd provides a command to list all scene items in a scene.
type SceneItemListCmd struct {
UUID bool `flag:"" help:"Display UUIDs of scene items."`
SceneName string ` help:"Name of the scene to list items from." arg:"" default:""`
SceneName string `arg:"" help:"Name of the scene to list items from." default:""`
}
// Run executes the command to list all scene items in a scene.
@ -48,13 +47,8 @@ func (cmd *SceneItemListCmd) Run(ctx *context) error {
t := table.New(ctx.Out)
t.SetPadding(3)
if cmd.UUID {
t.SetAlignment(table.AlignCenter, table.AlignLeft, table.AlignCenter, table.AlignCenter, table.AlignCenter)
t.SetHeaders("Item ID", "Item Name", "In Group", "Enabled", "UUID")
} else {
t.SetAlignment(table.AlignCenter, table.AlignLeft, table.AlignCenter, table.AlignCenter)
t.SetHeaders("Item ID", "Item Name", "In Group", "Enabled")
}
t.SetAlignment(table.AlignCenter, table.AlignLeft, table.AlignCenter, table.AlignCenter)
t.SetHeaders("Item ID", "Item Name", "In Group", "Enabled")
sort.Slice(resp.SceneItems, func(i, j int) bool {
return resp.SceneItems[i].SceneItemID < resp.SceneItems[j].SceneItemID
@ -73,30 +67,15 @@ func (cmd *SceneItemListCmd) Run(ctx *context) error {
})
for _, groupItem := range resp.SceneItems {
if cmd.UUID {
t.AddRow(
fmt.Sprintf("%d", groupItem.SceneItemID),
groupItem.SourceName,
item.SourceName,
getEnabledMark(item.SceneItemEnabled && groupItem.SceneItemEnabled),
groupItem.SourceUuid,
)
} else {
t.AddRow(
fmt.Sprintf("%d", groupItem.SceneItemID),
groupItem.SourceName,
item.SourceName,
getEnabledMark(item.SceneItemEnabled && groupItem.SceneItemEnabled),
)
}
t.AddRow(
fmt.Sprintf("%d", groupItem.SceneItemID),
groupItem.SourceName,
item.SourceName,
getEnabledMark(item.SceneItemEnabled && groupItem.SceneItemEnabled),
)
}
} else {
if cmd.UUID {
t.AddRow(fmt.Sprintf("%d", item.SceneItemID), item.SourceName, "",
getEnabledMark(item.SceneItemEnabled), item.SourceUuid)
} else {
t.AddRow(fmt.Sprintf("%d", item.SceneItemID), item.SourceName, "", getEnabledMark(item.SceneItemEnabled))
}
t.AddRow(fmt.Sprintf("%d", item.SceneItemID), item.SourceName, "", getEnabledMark(item.SceneItemEnabled))
}
}
t.Render()

View File

@ -16,9 +16,9 @@ func snakeCaseToTitleCase(snake string) string {
func getEnabledMark(enabled bool) string {
if enabled {
return "\u2713" // check mark
return "\u2713" // green check mark
}
return "\u274c" // cross mark
return "\u274c" // red cross mark
}
func trimPrefix(s, prefix string) string {