disable --help wrapping, realign the text

add --help shortname -h

patch bump
This commit is contained in:
2025-06-27 12:05:25 +01:00
parent 1c2d1abb2a
commit f7345155f1
7 changed files with 40 additions and 37 deletions

View File

@@ -1,3 +1,3 @@
"""module for package metadata."""
__version__ = '0.11.3'
__version__ = '0.11.4'

View File

@@ -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()

View File

@@ -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'

View File

@@ -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)]

View File

@@ -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)]

View File

@@ -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)