add --style validation

add Disabled class to style registry

patch bump
This commit is contained in:
2025-06-22 12:35:21 +01:00
parent 55a7da67db
commit 4632260961
3 changed files with 46 additions and 42 deletions

View File

@@ -50,6 +50,15 @@ def setup_logging(debug: bool):
)
def validate_style(value: str):
"""Validate and return the style."""
if value not in styles.registry:
raise typer.BadParameter(
f'Invalid style: {value}. Available styles: {", ".join(styles.registry.keys())}'
)
return value
@app.callback()
def main(
ctx: typer.Context,
@@ -112,6 +121,7 @@ def main(
envvar='OBS_STYLE',
help='Set the style for the CLI output',
show_default='disabled',
callback=validate_style,
),
] = settings.get('style'),
no_border: Annotated[