Compare commits

..

No commits in common. "98e0d98cc78ec8a4f88f42bf655b22b3afea0e04" and "4bf8edb692da8fdec4d2425a3d1cad5466b48706" have entirely different histories.

12 changed files with 48 additions and 54 deletions

View File

@ -14,7 +14,6 @@ For an outline of past/future changes refer to: [CHANGELOG](CHANGELOG.md)
- [Installation](#installation)
- [Configuration](#configuration)
- [Style](#style)
- [Commands](#root-typer)
- [License](#license)
@ -69,37 +68,6 @@ OBS_PASSWORD=<websocket password>
Flags can be used to override environment variables.
## Style
Styling is opt-in, by default you will get a colourless output:
![colourless](./img/colourless.png)
You may enable styling with the --style/-s flag:
```console
obsws-cli --style="cyan" sceneitem list
```
Available styles: _red, magenta, purple, blue, cyan, green, yellow, orange, white, grey, navy, black_
![coloured](./img/coloured-border.png)
Optionally you may disable border colouring with the --no-border flag:
![coloured-no-border](./img/coloured-no-border.png)
```console
obsws-cli --style="cyan" --no-border sceneitem list
```
Or with environment variables:
```env
OBS_STYLE=cyan
OBS_STYLE_NO_BORDER=true
```
## Root Typer
- obs-version: Get the OBS Client and WebSocket versions.
@ -660,6 +628,34 @@ obsws-cli projector open --monitor-index=1 "test_group"
obsws-cli screenshot save --width=2560 --height=1440 "Scene" "C:\Users\me\Videos\screenshot.png"
```
## Style
By default styling is disabled but you may enable it with:
- --style/-s: Style used in output.
- OBS_STYLE
- --no-border/-b: Disable table border styling in output.
- OBS_STYLE_NO_BORDER
Available styles:
- red
- magenta
- purple
- blue
- cyan
- green
- yellow
- orange
- white
- grey
- navy
- black
```console
obsws-cli --style=cyan --no-border scene list
```
## License
`obsws-cli` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online>
#
# SPDX-License-Identifier: MIT
__version__ = "0.19.1"
__version__ = "0.19.0"

View File

@ -62,8 +62,8 @@ def list_(
(Text('Enabled', justify='center'), 'center', None),
(Text('Settings', justify='center'), 'center', ctx.obj['style'].column),
]
for heading, justify, style in columns:
table.add_column(heading, justify=justify, style=style)
for name, justify, style in columns:
table.add_column(name, justify=justify, style=style)
for filter in resp.filters:
resp = ctx.obj['obsws'].get_source_filter_default_settings(filter['filterKind'])

View File

@ -61,8 +61,8 @@ def list_(
(Text('Group Name', justify='center'), 'left', ctx.obj['style'].column),
(Text('Enabled', justify='center'), 'center', None),
]
for heading, justify, style in columns:
table.add_column(heading, justify=justify, style=style)
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(

View File

@ -74,8 +74,8 @@ def list_(
(Text('Kind', justify='center'), 'center', ctx.obj['style'].column),
(Text('Muted', justify='center'), 'center', None),
]
for heading, justify, style in columns:
table.add_column(heading, justify=justify, style=style)
for column, justify, style in columns:
table.add_column(column, justify=justify, style=style)
for input_name, input_kind, input_uuid in inputs:
input_mark = ''

View File

@ -29,8 +29,8 @@ def list_(ctx: typer.Context):
(Text('Profile Name', justify='center'), 'left', ctx.obj['style'].column),
(Text('Current', justify='center'), 'center', None),
]
for heading, justify, style in columns:
table.add_column(heading, justify=justify, style=style)
for column, justify, style in columns:
table.add_column(column, justify=justify, style=style)
for profile in resp.profiles:
table.add_row(

View File

@ -43,8 +43,8 @@ def list_(
(Text('Scene Name', justify='center'), 'left', ctx.obj['style'].column),
(Text('Active', justify='center'), 'center', None),
]
for heading, justify, style in columns:
table.add_column(heading, justify=justify, style=style)
for column, justify, style in columns:
table.add_column(column, justify=justify, style=style)
for scene_name, scene_uuid in scenes:
if uuid:
@ -108,11 +108,7 @@ def switch(
if preview:
ctx.obj['obsws'].set_current_preview_scene(scene_name)
console.out.print(
f'Switched to preview scene: {console.highlight(ctx, scene_name)}'
)
console.out.print(f'Switched to preview scene: [green]{scene_name}[/green]')
else:
ctx.obj['obsws'].set_current_program_scene(scene_name)
console.out.print(
f'Switched to program scene: {console.highlight(ctx, scene_name)}'
)
console.out.print(f'Switched to program scene: [green]{scene_name}[/green]')

View File

@ -78,8 +78,8 @@ def list_(
('Enabled', 'center', None),
]
# Add columns to the table
for heading, justify, style in columns:
table.add_column(heading, justify=justify, style=style)
for column, justify, style in columns:
table.add_column(column, justify=justify, style=style)
for item_id, item_name, is_group, is_enabled, source_uuid in items:
if is_group:

View File

@ -42,6 +42,11 @@ class Disabled(Style):
column: str = 'none'
highlight: str = 'none'
def __post_init__(self):
"""Post-initialization to set default values."""
super().__post_init__()
os.environ['NO_COLOR'] = '1'
@register_style
@dataclass
@ -177,7 +182,4 @@ class Black(Style):
def request_style_obj(style_name: str, no_border: bool) -> Style:
"""Entry point for style objects. Returns a Style object based on the style name."""
if style_name == 'disabled':
os.environ['NO_COLOR'] = '1'
return registry[style_name.lower()](no_border=no_border)