Compare commits

...

4 Commits

7 changed files with 54 additions and 11 deletions

30
.github/workflows/update-go-modules.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: Auto-Update Go Modules
on:
schedule:
- cron: '0 0 * * 1' # Runs every Monday at midnight
jobs:
update-go-modules:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Update Dependencies
run: |
go get -u ./...
go mod tidy
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add go.mod go.sum
git commit -m "chore: auto-update Go modules"
git push

View File

@@ -5,6 +5,12 @@ 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.18.0] - 2026-01-23
### Added
- support for shell completion, see [Shell Completion](https://github.com/onyx-and-iris/gobs-cli?tab=readme-ov-file#shell-completion)
# [0.17.0] - 2026-01-09
### Added

BIN
img/coloured-border.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
img/coloured-no-border.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -131,7 +131,7 @@ func (cmd *InputListCmd) Run(ctx *context) error {
)
if err != nil {
if err.Error() == "request GetInputMute: InvalidResourceState (604): The specified input does not support audio." {
muteMark = "N/A"
muteMark = ""
} else {
return fmt.Errorf("failed to get input mute state: %w", err)
}

23
main.go
View File

@@ -123,12 +123,7 @@ func main() {
}(),
})
client, err := connectObs(cli.ObsConfig)
ctx.FatalIfErrorf(err)
ctx.Bind(newContext(client, os.Stdout, cli.StyleConfig))
ctx.FatalIfErrorf(run(ctx, client))
ctx.FatalIfErrorf(run(ctx, cli.ObsConfig, cli.StyleConfig))
}
// connectObs creates a new OBS client and connects to the OBS WebSocket server.
@@ -145,8 +140,18 @@ func connectObs(cfg ObsConfig) (*goobs.Client, error) {
}
// run executes the command line interface.
// It disconnects the OBS client after the command is executed.
func run(ctx *kong.Context, client *goobs.Client) error {
// It connects to the OBS WebSocket server and binds the context to the selected command.
// It also handles the "completion" command separately to avoid unnecessary connections.
func run(ctx *kong.Context, obsCfg ObsConfig, styleCfg StyleConfig) error {
if ctx.Selected().Name == "completion" {
return ctx.Run()
}
client, err := connectObs(obsCfg)
if err != nil {
return err
}
defer func() error {
if err := client.Disconnect(); err != nil {
return fmt.Errorf("failed to disconnect from OBS: %w", err)
@@ -154,5 +159,7 @@ func run(ctx *kong.Context, client *goobs.Client) error {
return nil
}()
ctx.Bind(newContext(client, os.Stdout, styleCfg))
return ctx.Run()
}

View File

@@ -24,12 +24,12 @@ func getEnabledMark(enabled bool) string {
if os.Getenv("NO_COLOR") != "" { // nolint: misspell
return "✓"
}
return ""
return ""
}
if os.Getenv("NO_COLOR") != "" { // nolint: misspell
return "✗"
}
return ""
return ""
}
func trimPrefix(s, prefix string) string {