From 37781f6de77ef3cc91b0faf66e625ba244fa7452 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Wed, 4 Jun 2025 17:34:45 +0100 Subject: [PATCH] clean up defaults in help messages --- obsws_cli/filter.py | 46 +++++++++++++++++++++++++++++++++-------- obsws_cli/group.py | 35 +++++++++++++++++++++++-------- obsws_cli/hotkey.py | 5 ++++- obsws_cli/input.py | 12 +++++++---- obsws_cli/profile.py | 13 ++++++++---- obsws_cli/projector.py | 3 ++- obsws_cli/scene.py | 4 +++- obsws_cli/sceneitem.py | 5 ++++- obsws_cli/screenshot.py | 13 +++++++----- 9 files changed, 101 insertions(+), 35 deletions(-) diff --git a/obsws_cli/filter.py b/obsws_cli/filter.py index f1beb2a..a4fa534 100644 --- a/obsws_cli/filter.py +++ b/obsws_cli/filter.py @@ -24,7 +24,11 @@ def main(): def list_( ctx: typer.Context, source_name: Annotated[ - Optional[str], typer.Argument(help='The source to list filters for') + Optional[str], + typer.Argument( + show_default='The current scene', + help='The source to list filters for', + ), ] = None, ): """List filters for a source.""" @@ -82,10 +86,16 @@ def _get_filter_enabled(ctx: typer.Context, source_name: str, filter_name: str): def enable( ctx: typer.Context, source_name: Annotated[ - str, typer.Argument(help='The source to enable the filter for') + str, + typer.Argument( + ..., show_default=False, help='The source to enable the filter for' + ), ], filter_name: Annotated[ - str, typer.Argument(help='The name of the filter to enable') + str, + typer.Argument( + ..., show_default=False, help='The name of the filter to enable' + ), ], ): """Enable a filter for a source.""" @@ -103,10 +113,16 @@ def enable( def disable( ctx: typer.Context, source_name: Annotated[ - str, typer.Argument(help='The source to disable the filter for') + str, + typer.Argument( + ..., show_default=False, help='The source to disable the filter for' + ), ], filter_name: Annotated[ - str, typer.Argument(help='The name of the filter to disable') + str, + typer.Argument( + ..., show_default=False, help='The name of the filter to disable' + ), ], ): """Disable a filter for a source.""" @@ -124,10 +140,16 @@ def disable( def toggle( ctx: typer.Context, source_name: Annotated[ - str, typer.Argument(help='The source to toggle the filter for') + str, + typer.Argument( + ..., show_default=False, help='The source to toggle the filter for' + ), ], filter_name: Annotated[ - str, typer.Argument(help='The name of the filter to toggle') + str, + typer.Argument( + ..., show_default=False, help='The name of the filter to toggle' + ), ], ): """Toggle a filter for a source.""" @@ -145,10 +167,16 @@ def toggle( def status( ctx: typer.Context, source_name: Annotated[ - str, typer.Argument(help='The source to get the filter status for') + str, + typer.Argument( + ..., show_default=False, help='The source to get the filter status for' + ), ], filter_name: Annotated[ - str, typer.Argument(help='The name of the filter to get the status for') + str, + typer.Argument( + ..., show_default=False, help='The name of the filter to get the status for' + ), ], ): """Get the status of a filter for a source.""" diff --git a/obsws_cli/group.py b/obsws_cli/group.py index d858d86..bb543f3 100644 --- a/obsws_cli/group.py +++ b/obsws_cli/group.py @@ -25,7 +25,10 @@ def list_( ctx: typer.Context, scene_name: Annotated[ Optional[str], - typer.Argument(help='Scene name (optional, defaults to current scene)'), + typer.Argument( + show_default='The current scene', + help='Scene name to list groups for', + ), ] = None, ): """List groups in a scene.""" @@ -82,9 +85,11 @@ def show( ctx: typer.Context, scene_name: Annotated[ str, - typer.Argument(..., help='Scene name the group is in'), + typer.Argument(..., show_default=False, help='Scene name the group is in'), + ], + group_name: Annotated[ + str, typer.Argument(..., show_default=False, help='Group name to show') ], - group_name: Annotated[str, typer.Argument(..., help='Group name to show')], ): """Show a group in a scene.""" if not validate.scene_in_scenes(ctx, scene_name): @@ -108,8 +113,12 @@ def show( @app.command('hide | h') def hide( ctx: typer.Context, - scene_name: Annotated[str, typer.Argument(..., help='Scene name the group is in')], - group_name: Annotated[str, typer.Argument(..., help='Group name to hide')], + scene_name: Annotated[ + str, typer.Argument(..., show_default=False, help='Scene name the group is in') + ], + group_name: Annotated[ + str, typer.Argument(..., show_default=False, help='Group name to hide') + ], ): """Hide a group in a scene.""" if not validate.scene_in_scenes(ctx, scene_name): @@ -133,8 +142,12 @@ def hide( @app.command('toggle | tg') def toggle( ctx: typer.Context, - scene_name: Annotated[str, typer.Argument(..., help='Scene name the group is in')], - group_name: Annotated[str, typer.Argument(..., help='Group name to toggle')], + scene_name: Annotated[ + str, typer.Argument(..., show_default=False, help='Scene name the group is in') + ], + group_name: Annotated[ + str, typer.Argument(..., show_default=False, help='Group name to toggle') + ], ): """Toggle a group in a scene.""" if not validate.scene_in_scenes(ctx, scene_name): @@ -162,8 +175,12 @@ def toggle( @app.command('status | ss') def status( ctx: typer.Context, - scene_name: Annotated[str, typer.Argument(..., help='Scene name the group is in')], - group_name: Annotated[str, typer.Argument(..., help='Group name to check status')], + scene_name: Annotated[ + str, typer.Argument(..., show_default=False, help='Scene name the group is in') + ], + group_name: Annotated[ + str, typer.Argument(..., show_default=False, help='Group name to check status') + ], ): """Get the status of a group in a scene.""" if not validate.scene_in_scenes(ctx, scene_name): diff --git a/obsws_cli/hotkey.py b/obsws_cli/hotkey.py index 46d0745..4cfff78 100644 --- a/obsws_cli/hotkey.py +++ b/obsws_cli/hotkey.py @@ -37,7 +37,9 @@ def list_( @app.command('trigger | tr') def trigger( ctx: typer.Context, - hotkey: Annotated[str, typer.Argument(..., help='The hotkey to trigger')], + hotkey: Annotated[ + str, typer.Argument(..., show_default=False, help='The hotkey to trigger') + ], ): """Trigger a hotkey by name.""" ctx.obj.trigger_hotkey_by_name(hotkey) @@ -50,6 +52,7 @@ def trigger_sequence( str, typer.Argument( ..., + show_default=False, help='The OBS key ID to trigger, see https://github.com/onyx-and-iris/obsws-cli?tab=readme-ov-file#hotkey for more info', ), ], diff --git a/obsws_cli/input.py b/obsws_cli/input.py index 4c8da8f..aa65426 100644 --- a/obsws_cli/input.py +++ b/obsws_cli/input.py @@ -20,7 +20,7 @@ def main(): @app.command('list | ls') -def list( +def list_( ctx: typer.Context, input: Annotated[bool, typer.Option(help='Filter by input type.')] = False, output: Annotated[bool, typer.Option(help='Filter by output type.')] = False, @@ -69,7 +69,9 @@ def list( @app.command('mute | m') def mute( ctx: typer.Context, - input_name: Annotated[str, typer.Argument(..., help='Name of the input to mute.')], + input_name: Annotated[ + str, typer.Argument(..., show_default=False, help='Name of the input to mute.') + ], ): """Mute an input.""" if not validate.input_in_inputs(ctx, input_name): @@ -88,7 +90,8 @@ def mute( def unmute( ctx: typer.Context, input_name: Annotated[ - str, typer.Argument(..., help='Name of the input to unmute.') + str, + typer.Argument(..., show_default=False, help='Name of the input to unmute.'), ], ): """Unmute an input.""" @@ -108,7 +111,8 @@ def unmute( def toggle( ctx: typer.Context, input_name: Annotated[ - str, typer.Argument(..., help='Name of the input to toggle.') + str, + typer.Argument(..., show_default=False, help='Name of the input to toggle.'), ], ): """Toggle an input.""" diff --git a/obsws_cli/profile.py b/obsws_cli/profile.py index fd0312d..ffcc54c 100644 --- a/obsws_cli/profile.py +++ b/obsws_cli/profile.py @@ -20,7 +20,7 @@ def main(): @app.command('list | ls') -def list(ctx: typer.Context): +def list_(ctx: typer.Context): """List profiles.""" resp = ctx.obj.get_profile_list() @@ -52,7 +52,10 @@ def current(ctx: typer.Context): def switch( ctx: typer.Context, profile_name: Annotated[ - str, typer.Argument(..., help='Name of the profile to switch to') + str, + typer.Argument( + ..., show_default=False, help='Name of the profile to switch to' + ), ], ): """Switch to a profile.""" @@ -73,7 +76,8 @@ def switch( def create( ctx: typer.Context, profile_name: Annotated[ - str, typer.Argument(..., help='Name of the profile to create.') + str, + typer.Argument(..., show_default=False, help='Name of the profile to create.'), ], ): """Create a new profile.""" @@ -89,7 +93,8 @@ def create( def remove( ctx: typer.Context, profile_name: Annotated[ - str, typer.Argument(..., help='Name of the profile to remove.') + str, + typer.Argument(..., show_default=False, help='Name of the profile to remove.'), ], ): """Remove a profile.""" diff --git a/obsws_cli/projector.py b/obsws_cli/projector.py index 70dda60..21c82d8 100644 --- a/obsws_cli/projector.py +++ b/obsws_cli/projector.py @@ -52,7 +52,8 @@ def open( source_name: Annotated[ str, typer.Argument( - help='Name of the source to project. (optional, defaults to current scene)' + show_default='The current scene', + help='Name of the source to project.', ), ] = '', ): diff --git a/obsws_cli/scene.py b/obsws_cli/scene.py index e426f0b..6d09eb7 100644 --- a/obsws_cli/scene.py +++ b/obsws_cli/scene.py @@ -64,7 +64,9 @@ def current( @app.command('switch | set') def switch( ctx: typer.Context, - scene_name: Annotated[str, typer.Argument(help='Name of the scene to switch to')], + scene_name: Annotated[ + str, typer.Argument(..., help='Name of the scene to switch to') + ], preview: Annotated[ bool, typer.Option(help='Switch to the preview scene instead of the program scene'), diff --git a/obsws_cli/sceneitem.py b/obsws_cli/sceneitem.py index 08cb1b8..a8ee5e7 100644 --- a/obsws_cli/sceneitem.py +++ b/obsws_cli/sceneitem.py @@ -26,7 +26,10 @@ def list_( ctx: typer.Context, scene_name: Annotated[ Optional[str], - typer.Argument(help='Scene name (optional, defaults to current scene)'), + typer.Argument( + show_default='The current scene', + help='Scene name to list items for', + ), ] = None, ): """List all items in a scene.""" diff --git a/obsws_cli/screenshot.py b/obsws_cli/screenshot.py index 1e264b9..2d523d9 100644 --- a/obsws_cli/screenshot.py +++ b/obsws_cli/screenshot.py @@ -27,6 +27,8 @@ def save( source_name: Annotated[ str, typer.Argument( + ..., + show_default=False, help='Name of the source to take a screenshot of.', ), ], @@ -36,9 +38,10 @@ def save( # we won't validate the path here. typer.Argument( ..., + show_default=False, file_okay=True, dir_okay=False, - help='Path to save the screenshot.', + help='Path to save the screenshot (must include file name and extension).', ), ], width: Annotated[ @@ -56,11 +59,11 @@ def save( quality: Annotated[ float, typer.Option( - min=1, + min=-1, max=100, - help='Quality of the screenshot (1-100).', + help='Quality of the screenshot.', ), - ] = None, + ] = -1, ): """Take a screenshot and save it to a file.""" try: @@ -70,7 +73,7 @@ def save( file_path=str(output_path), width=width, height=height, - quality=quality if quality else -1, # -1 means default quality + quality=quality, ) except obsws.error.OBSSDKRequestError as e: match e.code: