From f7345155f1601cb3ce8b305b4a70ac5f36675386 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Fri, 27 Jun 2025 12:05:25 +0100 Subject: [PATCH] disable --help wrapping, realign the text add --help shortname -h patch bump --- pdm.lock | 38 ++++++++++++++++---------------- src/slobs_cli/__about__.py | 2 +- src/slobs_cli/audio.py | 4 ++-- src/slobs_cli/cli.py | 17 +++++++++----- src/slobs_cli/scene.py | 4 ++-- src/slobs_cli/scenecollection.py | 4 ++-- src/slobs_cli/styles.py | 8 +++---- 7 files changed, 40 insertions(+), 37 deletions(-) diff --git a/pdm.lock b/pdm.lock index d5cdd1f..4462d27 100644 --- a/pdm.lock +++ b/pdm.lock @@ -281,29 +281,29 @@ files = [ [[package]] name = "ruff" -version = "0.12.0" +version = "0.12.1" requires_python = ">=3.7" summary = "An extremely fast Python linter and code formatter, written in Rust." groups = ["dev"] files = [ - {file = "ruff-0.12.0-py3-none-linux_armv6l.whl", hash = "sha256:5652a9ecdb308a1754d96a68827755f28d5dfb416b06f60fd9e13f26191a8848"}, - {file = "ruff-0.12.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:05ed0c914fabc602fc1f3b42c53aa219e5736cb030cdd85640c32dbc73da74a6"}, - {file = "ruff-0.12.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:07a7aa9b69ac3fcfda3c507916d5d1bca10821fe3797d46bad10f2c6de1edda0"}, - {file = "ruff-0.12.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e7731c3eec50af71597243bace7ec6104616ca56dda2b99c89935fe926bdcd48"}, - {file = "ruff-0.12.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:952d0630eae628250ab1c70a7fffb641b03e6b4a2d3f3ec6c1d19b4ab6c6c807"}, - {file = "ruff-0.12.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c021f04ea06966b02614d442e94071781c424ab8e02ec7af2f037b4c1e01cc82"}, - {file = "ruff-0.12.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:7d235618283718ee2fe14db07f954f9b2423700919dc688eacf3f8797a11315c"}, - {file = "ruff-0.12.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0c0758038f81beec8cc52ca22de9685b8ae7f7cc18c013ec2050012862cc9165"}, - {file = "ruff-0.12.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:139b3d28027987b78fc8d6cfb61165447bdf3740e650b7c480744873688808c2"}, - {file = "ruff-0.12.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:68853e8517b17bba004152aebd9dd77d5213e503a5f2789395b25f26acac0da4"}, - {file = "ruff-0.12.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3a9512af224b9ac4757f7010843771da6b2b0935a9e5e76bb407caa901a1a514"}, - {file = "ruff-0.12.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:b08df3d96db798e5beb488d4df03011874aff919a97dcc2dd8539bb2be5d6a88"}, - {file = "ruff-0.12.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:6a315992297a7435a66259073681bb0d8647a826b7a6de45c6934b2ca3a9ed51"}, - {file = "ruff-0.12.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:1e55e44e770e061f55a7dbc6e9aed47feea07731d809a3710feda2262d2d4d8a"}, - {file = "ruff-0.12.0-py3-none-win32.whl", hash = "sha256:7162a4c816f8d1555eb195c46ae0bd819834d2a3f18f98cc63819a7b46f474fb"}, - {file = "ruff-0.12.0-py3-none-win_amd64.whl", hash = "sha256:d00b7a157b8fb6d3827b49d3324da34a1e3f93492c1f97b08e222ad7e9b291e0"}, - {file = "ruff-0.12.0-py3-none-win_arm64.whl", hash = "sha256:8cd24580405ad8c1cc64d61725bca091d6b6da7eb3d36f72cc605467069d7e8b"}, - {file = "ruff-0.12.0.tar.gz", hash = "sha256:4d047db3662418d4a848a3fdbfaf17488b34b62f527ed6f10cb8afd78135bc5c"}, + {file = "ruff-0.12.1-py3-none-linux_armv6l.whl", hash = "sha256:6013a46d865111e2edb71ad692fbb8262e6c172587a57c0669332a449384a36b"}, + {file = "ruff-0.12.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b3f75a19e03a4b0757d1412edb7f27cffb0c700365e9d6b60bc1b68d35bc89e0"}, + {file = "ruff-0.12.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:9a256522893cb7e92bb1e1153283927f842dea2e48619c803243dccc8437b8be"}, + {file = "ruff-0.12.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:069052605fe74c765a5b4272eb89880e0ff7a31e6c0dbf8767203c1fbd31c7ff"}, + {file = "ruff-0.12.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a684f125a4fec2d5a6501a466be3841113ba6847827be4573fddf8308b83477d"}, + {file = "ruff-0.12.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bdecdef753bf1e95797593007569d8e1697a54fca843d78f6862f7dc279e23bd"}, + {file = "ruff-0.12.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:70d52a058c0e7b88b602f575d23596e89bd7d8196437a4148381a3f73fcd5010"}, + {file = "ruff-0.12.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:84d0a69d1e8d716dfeab22d8d5e7c786b73f2106429a933cee51d7b09f861d4e"}, + {file = "ruff-0.12.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6cc32e863adcf9e71690248607ccdf25252eeeab5193768e6873b901fd441fed"}, + {file = "ruff-0.12.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7fd49a4619f90d5afc65cf42e07b6ae98bb454fd5029d03b306bd9e2273d44cc"}, + {file = "ruff-0.12.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:ed5af6aaaea20710e77698e2055b9ff9b3494891e1b24d26c07055459bb717e9"}, + {file = "ruff-0.12.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:801d626de15e6bf988fbe7ce59b303a914ff9c616d5866f8c79eb5012720ae13"}, + {file = "ruff-0.12.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:2be9d32a147f98a1972c1e4df9a6956d612ca5f5578536814372113d09a27a6c"}, + {file = "ruff-0.12.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:49b7ce354eed2a322fbaea80168c902de9504e6e174fd501e9447cad0232f9e6"}, + {file = "ruff-0.12.1-py3-none-win32.whl", hash = "sha256:d973fa626d4c8267848755bd0414211a456e99e125dcab147f24daa9e991a245"}, + {file = "ruff-0.12.1-py3-none-win_amd64.whl", hash = "sha256:9e1123b1c033f77bd2590e4c1fe7e8ea72ef990a85d2484351d408224d603013"}, + {file = "ruff-0.12.1-py3-none-win_arm64.whl", hash = "sha256:78ad09a022c64c13cc6077707f036bab0fac8cd7088772dcd1e5be21c5002efc"}, + {file = "ruff-0.12.1.tar.gz", hash = "sha256:806bbc17f1104fd57451a98a58df35388ee3ab422e029e8f5cf30aa4af2c138c"}, ] [[package]] diff --git a/src/slobs_cli/__about__.py b/src/slobs_cli/__about__.py index 9f2d52a..baf4b24 100644 --- a/src/slobs_cli/__about__.py +++ b/src/slobs_cli/__about__.py @@ -1,3 +1,3 @@ """module for package metadata.""" -__version__ = '0.11.3' +__version__ = '0.11.4' diff --git a/src/slobs_cli/audio.py b/src/slobs_cli/audio.py index b743d15..c62dc3e 100644 --- a/src/slobs_cli/audio.py +++ b/src/slobs_cli/audio.py @@ -47,8 +47,8 @@ async def list(ctx: click.Context, id: bool = False): ('Audio Source Name', 'left'), ('Muted', 'center'), ] - for col_name, col_justify in columns: - table.add_column(Text(col_name, justify='center'), justify=col_justify) + for heading, justify in columns: + table.add_column(Text(heading, justify='center'), justify=justify) for source in sources: model = await source.get_model() diff --git a/src/slobs_cli/cli.py b/src/slobs_cli/cli.py index 374a561..9fcad5d 100644 --- a/src/slobs_cli/cli.py +++ b/src/slobs_cli/cli.py @@ -17,7 +17,12 @@ def validate_style(ctx: click.Context, param: click.Parameter, value: str) -> st return value -@click.group() +CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) + + +@click.group( + context_settings=CONTEXT_SETTINGS, +) @click.option( '-d', '--domain', @@ -25,7 +30,7 @@ def validate_style(ctx: click.Context, param: click.Parameter, value: str) -> st envvar='SLOBS_DOMAIN', show_default=True, show_envvar=True, - help='The domain of the SLOBS server.', + help='\b\nStreamlabs Desktop WebSocket domain or IP address.\t', ) @click.option( '-p', @@ -34,7 +39,7 @@ def validate_style(ctx: click.Context, param: click.Parameter, value: str) -> st envvar='SLOBS_PORT', show_default=True, show_envvar=True, - help='The port of the SLOBS server.', + help='\b\nStreamlabs Desktop WebSocket port.\t\t\t', ) @click.option( '-t', @@ -42,7 +47,7 @@ def validate_style(ctx: click.Context, param: click.Parameter, value: str) -> st envvar='SLOBS_TOKEN', show_envvar=True, required=True, - help='The token for the SLOBS server.', + help='\b\nStreamlabs Desktop WebSocket authentication token.\t', ) @click.option( '-s', @@ -51,7 +56,7 @@ def validate_style(ctx: click.Context, param: click.Parameter, value: str) -> st envvar='SLOBS_STYLE', show_default=True, show_envvar=True, - help='The style to use for output.', + help='\b\nThe style to use for output.\t\t\t\t', callback=validate_style, ) @click.option( @@ -62,7 +67,7 @@ def validate_style(ctx: click.Context, param: click.Parameter, value: str) -> st envvar='SLOBS_STYLE_NO_BORDER', show_default=True, show_envvar=True, - help='Disable borders in the output.', + help='\b\nDisable borders in the output.\t\t\t\t', ) @click.version_option( version, '-v', '--version', message='%(prog)s version: %(version)s' diff --git a/src/slobs_cli/scene.py b/src/slobs_cli/scene.py index e12f92b..ec02e6a 100644 --- a/src/slobs_cli/scene.py +++ b/src/slobs_cli/scene.py @@ -52,8 +52,8 @@ async def list(ctx: click.Context, id: bool = False): ('Active', 'center'), ] - for col_name, col_justify in columns: - table.add_column(Text(col_name, justify='center'), justify=col_justify) + for heading, justify in columns: + table.add_column(Text(heading, justify='center'), justify=justify) for scene in scenes: to_append = [Text(scene.name, style=style.cell)] diff --git a/src/slobs_cli/scenecollection.py b/src/slobs_cli/scenecollection.py index 254ca0e..4001876 100644 --- a/src/slobs_cli/scenecollection.py +++ b/src/slobs_cli/scenecollection.py @@ -52,8 +52,8 @@ async def list(ctx: click.Context, id: bool): ('Active', 'center'), ] - for col_name, col_justify in columns: - table.add_column(Text(col_name, justify='center'), justify=col_justify) + for heading, justify in columns: + table.add_column(Text(heading, justify='center'), justify=justify) for collection in collections: to_append = [Text(collection.name, style=style.cell)] diff --git a/src/slobs_cli/styles.py b/src/slobs_cli/styles.py index 123988c..63e6dc5 100644 --- a/src/slobs_cli/styles.py +++ b/src/slobs_cli/styles.py @@ -46,11 +46,6 @@ class Disabled(Style): highlight: str = 'none' warning: str = 'none' - def __post__init__(self): - """Post-initialization to set default values.""" - super().__post_init__() - os.environ['NO_COLOR'] = '1' - @register_style @dataclass @@ -210,4 +205,7 @@ class Black(Style): def request_style_obj(style_name: str, no_border: bool) -> Style: """Request a style object by name.""" + if style_name == 'disabled': + os.environ['NO_COLOR'] = '1' + return registry[style_name.lower()](no_border=no_border)