diff --git a/obsws_cli/filter.py b/obsws_cli/filter.py index 8ee8fd3..bb1bcbe 100644 --- a/obsws_cli/filter.py +++ b/obsws_cli/filter.py @@ -52,12 +52,14 @@ def list_( table = Table(title=f'Filters for Source: {source_name}', padding=(0, 2)) - for column in ('Filter Name', 'Kind', 'Enabled', 'Settings'): - table.add_column( - column, - justify='left' if column in ('Filter Name', 'Kind') else 'center', - style='cyan', - ) + columns = [ + ('Filter Name', 'left', 'cyan'), + ('Kind', 'left', 'cyan'), + ('Enabled', 'center', None), + ('Settings', 'center', 'cyan'), + ] + for name, justify, style in columns: + table.add_column(name, justify=justify, style=style if style else None) for filter in resp.filters: resp = ctx.obj.get_source_filter_default_settings(filter['filterKind']) diff --git a/obsws_cli/group.py b/obsws_cli/group.py index 6541519..1bda7c8 100644 --- a/obsws_cli/group.py +++ b/obsws_cli/group.py @@ -52,10 +52,13 @@ def list_( table = Table(title=f'Groups in Scene: {scene_name}', padding=(0, 2)) - for column in ('ID', 'Group Name', 'Enabled'): - table.add_column( - column, justify='left' if column == 'Group Name' else 'center', style='cyan' - ) + columns = [ + ('ID', 'center', 'cyan'), + ('Group Name', 'left', 'cyan'), + ('Enabled', 'center', None), + ] + for column, justify, style in columns: + table.add_column(column, justify=justify, style=style) for item_id, group_name, is_enabled in groups: table.add_row( diff --git a/obsws_cli/profile.py b/obsws_cli/profile.py index 59eabc2..4f06caf 100644 --- a/obsws_cli/profile.py +++ b/obsws_cli/profile.py @@ -25,12 +25,12 @@ def list_(ctx: typer.Context): resp = ctx.obj.get_profile_list() table = Table(title='Profiles', padding=(0, 2)) - for column in ('Profile Name', 'Current'): - table.add_column( - column, - justify='left' if column == 'Profile Name' else 'center', - style='cyan', - ) + columns = [ + ('Profile Name', 'left', 'cyan'), + ('Current', 'center', None), + ] + for column, justify, style in columns: + table.add_column(column, justify=justify, style=style) for profile in resp.profiles: table.add_row( diff --git a/obsws_cli/scene.py b/obsws_cli/scene.py index 0523b78..48bcc46 100644 --- a/obsws_cli/scene.py +++ b/obsws_cli/scene.py @@ -29,8 +29,12 @@ def list_(ctx: typer.Context): ) table = Table(title='Scenes', padding=(0, 2)) - for column in ('Scene Name', 'UUID'): - table.add_column(column, justify='left', style='cyan') + columns = [ + ('Scene Name', 'left', 'cyan'), + ('UUID', 'left', 'cyan'), + ] + for column, justify, style in columns: + table.add_column(column, justify=justify, style=style) for scene_name, scene_uuid in scenes: table.add_row( diff --git a/obsws_cli/sceneitem.py b/obsws_cli/sceneitem.py index 7ea2262..928fb24 100644 --- a/obsws_cli/sceneitem.py +++ b/obsws_cli/sceneitem.py @@ -58,10 +58,15 @@ def list_( raise typer.Exit() table = Table(title=f'Items in Scene: {scene_name}', padding=(0, 2)) - for column in ('Item ID', 'Item Name', 'In Group', 'Enabled'): - table.add_column( - column, justify='left' if column == 'Item Name' else 'center', style='cyan' - ) + columns = [ + ('Item ID', 'center', 'cyan'), + ('Item Name', 'left', 'cyan'), + ('In Group', 'left', 'cyan'), + ('Enabled', 'center', None), + ] + # Add columns to the table + for column, justify, style in columns: + table.add_column(column, justify=justify, style=style) for item_id, item_name, is_group, is_enabled in items: if is_group: