diff --git a/obsws_cli/__about__.py b/obsws_cli/__about__.py index 8e8dd91..1d2fc1a 100644 --- a/obsws_cli/__about__.py +++ b/obsws_cli/__about__.py @@ -1,4 +1,4 @@ # SPDX-FileCopyrightText: 2025-present onyx-and-iris # # SPDX-License-Identifier: MIT -__version__ = "0.18.2" +__version__ = "0.18.3" diff --git a/obsws_cli/console.py b/obsws_cli/console.py index efb15cb..abaef64 100644 --- a/obsws_cli/console.py +++ b/obsws_cli/console.py @@ -9,6 +9,4 @@ err = Console(stderr=True, style='bold red') def highlight(ctx: typer.Context, text: str) -> str: """Highlight text using the current context's style.""" - if ctx.obj['style'].name == 'no_colour': - return text return f'[{ctx.obj["style"].highlight}]{text}[/{ctx.obj["style"].highlight}]' diff --git a/obsws_cli/filter.py b/obsws_cli/filter.py index 04890c0..132c450 100644 --- a/obsws_cli/filter.py +++ b/obsws_cli/filter.py @@ -72,7 +72,7 @@ def list_( table.add_row( filter['filterName'], util.snakecase_to_titlecase(filter['filterKind']), - util.check_mark(ctx, filter['filterEnabled']), + util.check_mark(filter['filterEnabled']), '\n'.join( [ f'{util.snakecase_to_titlecase(k):<20} {v:>10}' diff --git a/obsws_cli/group.py b/obsws_cli/group.py index a4fcfc9..4fa9845 100644 --- a/obsws_cli/group.py +++ b/obsws_cli/group.py @@ -68,7 +68,7 @@ def list_( table.add_row( str(item_id), group_name, - util.check_mark(ctx, is_enabled), + util.check_mark(is_enabled), ) console.out.print(table) diff --git a/obsws_cli/input.py b/obsws_cli/input.py index b981bcb..8adfcde 100644 --- a/obsws_cli/input.py +++ b/obsws_cli/input.py @@ -81,7 +81,7 @@ def list_( input_mark = '' try: input_muted = ctx.obj['obsws'].get_input_mute(name=input_name).input_muted - input_mark = util.check_mark(ctx, input_muted) + input_mark = util.check_mark(input_muted) except obsws.error.OBSSDKRequestError as e: if e.code == 604: # Input does not support audio input_mark = 'N/A' diff --git a/obsws_cli/scene.py b/obsws_cli/scene.py index 30a16b9..d3101a6 100644 --- a/obsws_cli/scene.py +++ b/obsws_cli/scene.py @@ -50,13 +50,13 @@ def list_( if uuid: table.add_row( scene_name, - util.check_mark(ctx, scene_name == active_scene, empty_if_false=True), + util.check_mark(scene_name == active_scene, empty_if_false=True), scene_uuid, ) else: table.add_row( scene_name, - util.check_mark(ctx, scene_name == active_scene, empty_if_false=True), + util.check_mark(scene_name == active_scene, empty_if_false=True), ) console.out.print(table) diff --git a/obsws_cli/sceneitem.py b/obsws_cli/sceneitem.py index 22ed81c..9d68d21 100644 --- a/obsws_cli/sceneitem.py +++ b/obsws_cli/sceneitem.py @@ -107,7 +107,7 @@ def list_( str(group_item_id), group_item_name, item_name, - util.check_mark(ctx, is_enabled and group_item_enabled), + util.check_mark(is_enabled and group_item_enabled), group_item_source_uuid, ) else: @@ -115,7 +115,7 @@ def list_( str(group_item_id), group_item_name, item_name, - util.check_mark(ctx, is_enabled and group_item_enabled), + util.check_mark(is_enabled and group_item_enabled), ) else: if uuid: @@ -123,7 +123,7 @@ def list_( str(item_id), item_name, '', - util.check_mark(ctx, is_enabled), + util.check_mark(is_enabled), source_uuid, ) else: @@ -131,7 +131,7 @@ def list_( str(item_id), item_name, '', - util.check_mark(ctx, is_enabled), + util.check_mark(is_enabled), ) console.out.print(table) diff --git a/obsws_cli/styles.py b/obsws_cli/styles.py index b691c8a..4c7aa05 100644 --- a/obsws_cli/styles.py +++ b/obsws_cli/styles.py @@ -21,9 +21,9 @@ class Style: name: str = 'no_colour' description: str = 'Style disabled' - border: str | None = None - column: str | None = None - highlight: str | None = None + border: str = 'none' + column: str = 'none' + highlight: str = 'none' no_border: bool = False def __post_init__(self): diff --git a/obsws_cli/util.py b/obsws_cli/util.py index 6832ef3..7132582 100644 --- a/obsws_cli/util.py +++ b/obsws_cli/util.py @@ -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 '❌'