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_(
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."""

View File

@ -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):

View File

@ -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',
),
],

View File

@ -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."""

View File

@ -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."""

View File

@ -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.',
),
] = '',
):

View File

@ -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'),

View File

@ -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."""

View File

@ -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: