From 7d41439ad6263ddd0e519d96728de7bd3b15b6ac Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Fri, 13 Feb 2026 08:04:44 +0000 Subject: [PATCH] move connectObs --- main.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/main.go b/main.go index 47cf333..8e74f39 100644 --- a/main.go +++ b/main.go @@ -126,19 +126,6 @@ func main() { ctx.FatalIfErrorf(run(ctx, cli.ObsConfig, cli.StyleConfig)) } -// connectObs creates a new OBS client and connects to the OBS WebSocket server. -func connectObs(cfg ObsConfig) (*goobs.Client, error) { - client, err := goobs.New( - fmt.Sprintf("%s:%d", cfg.Host, cfg.Port), - goobs.WithPassword(cfg.Password), - goobs.WithResponseTimeout(time.Duration(cfg.Timeout)*time.Second), - ) - if err != nil { - return nil, err - } - return client, nil -} - // run executes the command line interface. // 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. @@ -163,3 +150,16 @@ func run(ctx *kong.Context, obsCfg ObsConfig, styleCfg StyleConfig) error { return ctx.Run() } + +// connectObs creates a new OBS client and connects to the OBS WebSocket server. +func connectObs(cfg ObsConfig) (*goobs.Client, error) { + client, err := goobs.New( + fmt.Sprintf("%s:%d", cfg.Host, cfg.Port), + goobs.WithPassword(cfg.Password), + goobs.WithResponseTimeout(time.Duration(cfg.Timeout)*time.Second), + ) + if err != nil { + return nil, err + } + return client, nil +}