mirror of
https://github.com/onyx-and-iris/slobs-cli.git
synced 2025-06-27 15:20:24 +01:00
implement slobs connection flags/envvars
add slobs connection to context patch bump
This commit is contained in:
parent
b4fdf97676
commit
3242a866e3
@ -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
45
src/slobs_cli/cli.py
Normal 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)
|
Loading…
x
Reference in New Issue
Block a user