mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-08-03 10:31:46 +00:00
raise typer.Exit() on empty list queries
This commit is contained in:
parent
e851219ced
commit
286cda8066
@ -24,6 +24,10 @@ def list_(
|
||||
"""List all hotkeys."""
|
||||
resp = ctx.obj['obsws'].get_hotkey_list()
|
||||
|
||||
if not resp.hotkeys:
|
||||
console.out.print('No hotkeys found.')
|
||||
raise typer.Exit()
|
||||
|
||||
table = Table(
|
||||
title='Hotkeys',
|
||||
padding=(0, 2),
|
||||
|
@ -22,6 +22,10 @@ def list_(ctx: typer.Context):
|
||||
"""List profiles."""
|
||||
resp = ctx.obj['obsws'].get_profile_list()
|
||||
|
||||
if not resp.profiles:
|
||||
console.out.print('No profiles found.')
|
||||
raise typer.Exit()
|
||||
|
||||
table = Table(
|
||||
title='Profiles', padding=(0, 2), border_style=ctx.obj['style'].border
|
||||
)
|
||||
|
@ -21,16 +21,15 @@ def main():
|
||||
def list_monitors(ctx: typer.Context):
|
||||
"""List available monitors."""
|
||||
resp = ctx.obj['obsws'].get_monitor_list()
|
||||
|
||||
if not resp.monitors:
|
||||
console.out.print('No monitors found.')
|
||||
return
|
||||
|
||||
monitors = sorted(
|
||||
((m['monitorIndex'], m['monitorName']) for m in resp.monitors),
|
||||
key=lambda m: m[0],
|
||||
)
|
||||
|
||||
if not monitors:
|
||||
console.out.print('No monitors found.')
|
||||
raise typer.Exit()
|
||||
|
||||
table = Table(
|
||||
title='Available Monitors',
|
||||
padding=(0, 2),
|
||||
|
@ -29,6 +29,10 @@ def list_(
|
||||
for scene in reversed(resp.scenes)
|
||||
)
|
||||
|
||||
if not scenes:
|
||||
console.out.print('No scenes found.')
|
||||
raise typer.Exit()
|
||||
|
||||
active_scene = ctx.obj['obsws'].get_current_program_scene().scene_name
|
||||
|
||||
table = Table(title='Scenes', padding=(0, 2), border_style=ctx.obj['style'].border)
|
||||
|
@ -21,6 +21,10 @@ def list_(ctx: typer.Context):
|
||||
"""List all scene collections."""
|
||||
resp = ctx.obj['obsws'].get_scene_collection_list()
|
||||
|
||||
if not resp.scene_collections:
|
||||
console.out.print('No scene collections found.')
|
||||
raise typer.Exit()
|
||||
|
||||
table = Table(
|
||||
title='Scene Collections',
|
||||
padding=(0, 2),
|
||||
|
Loading…
x
Reference in New Issue
Block a user