by setting values in the default style to 'none' we avoid the rich markup errors in console.highlight

add comment to util.check_mark and test only NO_COLOR

patch bump
This commit is contained in:
2025-06-22 10:14:46 +01:00
parent 55e60ff977
commit 7bec573ef9
9 changed files with 19 additions and 19 deletions

View File

@@ -2,19 +2,21 @@
import os
import typer
def snakecase_to_titlecase(snake_str: str) -> str:
"""Convert a snake_case string to a title case string."""
return snake_str.replace('_', ' ').title()
def check_mark(ctx: typer.Context, value: bool, empty_if_false: bool = False) -> str:
def check_mark(value: bool, empty_if_false: bool = False) -> str:
"""Return a check mark or cross mark based on the boolean value."""
if empty_if_false and not value:
return ''
if os.getenv('NO_COLOR', '') != '' or ctx.obj['style'].name == 'no_colour':
# For all other output rich gracefully handles colourless output
# but here we must handle it manually
# If NO_COLOR is set, return simple check or cross marks
# Otherwise, return colored check or cross marks
if os.getenv('NO_COLOR', '') != '':
return '' if value else ''
return '' if value else ''