clean up defaults in help messages

This commit is contained in:
onyx-and-iris 2025-06-04 17:34:45 +01:00
parent 5e84becc57
commit 37781f6de7
9 changed files with 101 additions and 35 deletions

View File

@ -24,7 +24,11 @@ def main():
def list_( def list_(
ctx: typer.Context, ctx: typer.Context,
source_name: Annotated[ 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, ] = None,
): ):
"""List filters for a source.""" """List filters for a source."""
@ -82,10 +86,16 @@ def _get_filter_enabled(ctx: typer.Context, source_name: str, filter_name: str):
def enable( def enable(
ctx: typer.Context, ctx: typer.Context,
source_name: Annotated[ 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[ 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.""" """Enable a filter for a source."""
@ -103,10 +113,16 @@ def enable(
def disable( def disable(
ctx: typer.Context, ctx: typer.Context,
source_name: Annotated[ 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[ 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.""" """Disable a filter for a source."""
@ -124,10 +140,16 @@ def disable(
def toggle( def toggle(
ctx: typer.Context, ctx: typer.Context,
source_name: Annotated[ 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[ 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.""" """Toggle a filter for a source."""
@ -145,10 +167,16 @@ def toggle(
def status( def status(
ctx: typer.Context, ctx: typer.Context,
source_name: Annotated[ 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[ 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.""" """Get the status of a filter for a source."""

View File

@ -25,7 +25,10 @@ def list_(
ctx: typer.Context, ctx: typer.Context,
scene_name: Annotated[ scene_name: Annotated[
Optional[str], 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, ] = None,
): ):
"""List groups in a scene.""" """List groups in a scene."""
@ -82,9 +85,11 @@ def show(
ctx: typer.Context, ctx: typer.Context,
scene_name: Annotated[ scene_name: Annotated[
str, 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.""" """Show a group in a scene."""
if not validate.scene_in_scenes(ctx, scene_name): if not validate.scene_in_scenes(ctx, scene_name):
@ -108,8 +113,12 @@ def show(
@app.command('hide | h') @app.command('hide | h')
def hide( def hide(
ctx: typer.Context, ctx: typer.Context,
scene_name: Annotated[str, typer.Argument(..., help='Scene name the group is in')], scene_name: Annotated[
group_name: Annotated[str, typer.Argument(..., help='Group name to hide')], 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.""" """Hide a group in a scene."""
if not validate.scene_in_scenes(ctx, scene_name): if not validate.scene_in_scenes(ctx, scene_name):
@ -133,8 +142,12 @@ def hide(
@app.command('toggle | tg') @app.command('toggle | tg')
def toggle( def toggle(
ctx: typer.Context, ctx: typer.Context,
scene_name: Annotated[str, typer.Argument(..., help='Scene name the group is in')], scene_name: Annotated[
group_name: Annotated[str, typer.Argument(..., help='Group name to toggle')], 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.""" """Toggle a group in a scene."""
if not validate.scene_in_scenes(ctx, scene_name): if not validate.scene_in_scenes(ctx, scene_name):
@ -162,8 +175,12 @@ def toggle(
@app.command('status | ss') @app.command('status | ss')
def status( def status(
ctx: typer.Context, ctx: typer.Context,
scene_name: Annotated[str, typer.Argument(..., help='Scene name the group is in')], scene_name: Annotated[
group_name: Annotated[str, typer.Argument(..., help='Group name to check status')], 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.""" """Get the status of a group in a scene."""
if not validate.scene_in_scenes(ctx, scene_name): if not validate.scene_in_scenes(ctx, scene_name):

View File

@ -37,7 +37,9 @@ def list_(
@app.command('trigger | tr') @app.command('trigger | tr')
def trigger( def trigger(
ctx: typer.Context, 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.""" """Trigger a hotkey by name."""
ctx.obj.trigger_hotkey_by_name(hotkey) ctx.obj.trigger_hotkey_by_name(hotkey)
@ -50,6 +52,7 @@ def trigger_sequence(
str, str,
typer.Argument( 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', help='The OBS key ID to trigger, see https://github.com/onyx-and-iris/obsws-cli?tab=readme-ov-file#hotkey for more info',
), ),
], ],

View File

@ -20,7 +20,7 @@ def main():
@app.command('list | ls') @app.command('list | ls')
def list( def list_(
ctx: typer.Context, ctx: typer.Context,
input: Annotated[bool, typer.Option(help='Filter by input type.')] = False, input: Annotated[bool, typer.Option(help='Filter by input type.')] = False,
output: Annotated[bool, typer.Option(help='Filter by output type.')] = False, output: Annotated[bool, typer.Option(help='Filter by output type.')] = False,
@ -69,7 +69,9 @@ def list(
@app.command('mute | m') @app.command('mute | m')
def mute( def mute(
ctx: typer.Context, 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.""" """Mute an input."""
if not validate.input_in_inputs(ctx, input_name): if not validate.input_in_inputs(ctx, input_name):
@ -88,7 +90,8 @@ def mute(
def unmute( def unmute(
ctx: typer.Context, ctx: typer.Context,
input_name: Annotated[ 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.""" """Unmute an input."""
@ -108,7 +111,8 @@ def unmute(
def toggle( def toggle(
ctx: typer.Context, ctx: typer.Context,
input_name: Annotated[ 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.""" """Toggle an input."""

View File

@ -20,7 +20,7 @@ def main():
@app.command('list | ls') @app.command('list | ls')
def list(ctx: typer.Context): def list_(ctx: typer.Context):
"""List profiles.""" """List profiles."""
resp = ctx.obj.get_profile_list() resp = ctx.obj.get_profile_list()
@ -52,7 +52,10 @@ def current(ctx: typer.Context):
def switch( def switch(
ctx: typer.Context, ctx: typer.Context,
profile_name: Annotated[ 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.""" """Switch to a profile."""
@ -73,7 +76,8 @@ def switch(
def create( def create(
ctx: typer.Context, ctx: typer.Context,
profile_name: Annotated[ 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.""" """Create a new profile."""
@ -89,7 +93,8 @@ def create(
def remove( def remove(
ctx: typer.Context, ctx: typer.Context,
profile_name: Annotated[ 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.""" """Remove a profile."""

View File

@ -52,7 +52,8 @@ def open(
source_name: Annotated[ source_name: Annotated[
str, str,
typer.Argument( 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.',
), ),
] = '', ] = '',
): ):

View File

@ -64,7 +64,9 @@ def current(
@app.command('switch | set') @app.command('switch | set')
def switch( def switch(
ctx: typer.Context, 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[ preview: Annotated[
bool, bool,
typer.Option(help='Switch to the preview scene instead of the program scene'), typer.Option(help='Switch to the preview scene instead of the program scene'),

View File

@ -26,7 +26,10 @@ def list_(
ctx: typer.Context, ctx: typer.Context,
scene_name: Annotated[ scene_name: Annotated[
Optional[str], 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, ] = None,
): ):
"""List all items in a scene.""" """List all items in a scene."""

View File

@ -27,6 +27,8 @@ def save(
source_name: Annotated[ source_name: Annotated[
str, str,
typer.Argument( typer.Argument(
...,
show_default=False,
help='Name of the source to take a screenshot of.', help='Name of the source to take a screenshot of.',
), ),
], ],
@ -36,9 +38,10 @@ def save(
# we won't validate the path here. # we won't validate the path here.
typer.Argument( typer.Argument(
..., ...,
show_default=False,
file_okay=True, file_okay=True,
dir_okay=False, dir_okay=False,
help='Path to save the screenshot.', help='Path to save the screenshot (must include file name and extension).',
), ),
], ],
width: Annotated[ width: Annotated[
@ -56,11 +59,11 @@ def save(
quality: Annotated[ quality: Annotated[
float, float,
typer.Option( typer.Option(
min=1, min=-1,
max=100, 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.""" """Take a screenshot and save it to a file."""
try: try:
@ -70,7 +73,7 @@ def save(
file_path=str(output_path), file_path=str(output_path),
width=width, width=width,
height=height, height=height,
quality=quality if quality else -1, # -1 means default quality quality=quality,
) )
except obsws.error.OBSSDKRequestError as e: except obsws.error.OBSSDKRequestError as e:
match e.code: match e.code: