print message and return 0 for list queries returning empty results

This commit is contained in:
onyx-and-iris 2025-07-29 02:52:00 +01:00
parent 417ad54a0c
commit 23e358da9c
7 changed files with 24 additions and 7 deletions

View File

@ -50,10 +50,10 @@ def list_(
] ]
if not groups: if not groups:
raise OBSWSCLIError( console.out.print(
f'No groups found in scene {console.highlight(ctx, scene_name)}.', f'No groups found in scene {console.highlight(ctx, scene_name)}.'
code=ExitCode.SUCCESS,
) )
return
table = Table( table = Table(
title=f'Groups in Scene: {scene_name}', title=f'Groups in Scene: {scene_name}',

View File

@ -74,7 +74,8 @@ def list_(
) )
if not inputs: if not inputs:
raise OBSWSCLIError('No inputs found.', code=ExitCode.SUCCESS) console.out.print('No inputs found matching the specified filters.')
return
table = Table(title='Inputs', padding=(0, 2), border_style=ctx.style.border) table = Table(title='Inputs', padding=(0, 2), border_style=ctx.style.border)
if uuid: if uuid:

View File

@ -37,6 +37,10 @@ def list_(
for heading, justify, style in columns: for heading, justify, style in columns:
table.add_column(heading, justify=justify, style=style) table.add_column(heading, justify=justify, style=style)
if not resp.profiles:
console.out.print('No profiles found.')
return
for profile in resp.profiles: for profile in resp.profiles:
table.add_row( table.add_row(
profile, profile,

View File

@ -38,6 +38,10 @@ def list_monitors(
key=lambda m: m[0], key=lambda m: m[0],
) )
if not monitors:
console.out.print('No monitors available.')
return
table = Table( table = Table(
title='Available Monitors', title='Available Monitors',
padding=(0, 2), padding=(0, 2),

View File

@ -36,6 +36,10 @@ def list_(
for scene in reversed(resp.scenes) for scene in reversed(resp.scenes)
) )
if not scenes:
console.out.print('No scenes found.')
return
active_scene = ctx.client.get_current_program_scene().scene_name active_scene = ctx.client.get_current_program_scene().scene_name
table = Table(title='Scenes', padding=(0, 2), border_style=ctx.style.border) table = Table(title='Scenes', padding=(0, 2), border_style=ctx.style.border)

View File

@ -37,6 +37,10 @@ def list_(
) )
table.add_column('Scene Collection Name', justify='left', style=ctx.style.column) table.add_column('Scene Collection Name', justify='left', style=ctx.style.column)
if not resp.scene_collections:
console.out.print('No scene collections found.')
return
for scene_collection_name in resp.scene_collections: for scene_collection_name in resp.scene_collections:
table.add_row(scene_collection_name) table.add_row(scene_collection_name)

View File

@ -60,10 +60,10 @@ def list_(
) )
if not items: if not items:
raise OBSWSCLIError( console.out.print(
f'No items found in scene [yellow]{scene_name}[/yellow].', f'No items found in scene {console.highlight(ctx, scene_name)}.'
exit_code=ExitCode.SUCCESS,
) )
return
table = Table( table = Table(
title=f'Items in Scene: {scene_name}', title=f'Items in Scene: {scene_name}',