implement slobs connection flags/envvars

add slobs connection to context

patch bump
This commit is contained in:
onyx-and-iris 2025-06-10 12:51:04 +01:00
parent b4fdf97676
commit 3242a866e3
2 changed files with 46 additions and 1 deletions

View File

@ -1,6 +1,6 @@
[project]
name = "slobs-cli"
version = "0.1.0"
version = "0.1.1"
description = "A command line application for Streamlabs Desktop"
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
dependencies = ["pyslobs>=2.0.4", "asyncclick>=8.1.8"]

45
src/slobs_cli/cli.py Normal file
View File

@ -0,0 +1,45 @@
import anyio
import asyncclick as click
from pyslobs import ConnectionConfig, SlobsConnection
@click.group()
@click.option(
"--domain",
default="localhost",
show_default=True,
show_envvar=True,
help="The domain of the SLOBS server.",
envvar="SLOBS_DOMAIN",
)
@click.option(
"--port",
default=59650,
show_default=True,
show_envvar=True,
help="The port of the SLOBS server.",
envvar="SLOBS_PORT",
)
@click.option(
"--token",
help="The token for the SLOBS server.",
envvar="SLOBS_TOKEN",
show_envvar=True,
)
@click.pass_context
async def cli(ctx: click.Context, domain: str, port: int, token: str | None):
"""
Command line interface for SLOBS.
"""
ctx.ensure_object(dict)
config = ConnectionConfig(
domain=domain,
port=port,
token=token,
)
ctx.obj["connection"] = SlobsConnection(config)
def run():
"""Run the CLI application."""
anyio.run(cli.main)