Compare commits

...

6 Commits

Author SHA1 Message Date
98e0d98cc7 typo 2025-06-27 13:45:24 +01:00
c6b22c7cf2 use console.highlight() 2025-06-27 13:29:39 +01:00
c3e55200db move style section
add link to style section in ToC.

add imgs.
2025-06-27 13:14:54 +01:00
4d37714aaf patch bump 2025-06-27 12:57:49 +01:00
157e1a167c fixes bug when setting --style=disabled (we were stil getting coloured check/cross marks) 2025-06-27 12:57:34 +01:00
d628c5d3a4 rename heading variables 2025-06-27 12:53:10 +01:00
12 changed files with 54 additions and 48 deletions

View File

@ -14,6 +14,7 @@ For an outline of past/future changes refer to: [CHANGELOG](CHANGELOG.md)
- [Installation](#installation)
- [Configuration](#configuration)
- [Style](#style)
- [Commands](#root-typer)
- [License](#license)
@ -68,6 +69,37 @@ 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.
@ -628,34 +660,6 @@ 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.

BIN
img/coloured-border.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
img/coloured-no-border.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
img/colourless.png Executable file

Binary file not shown.

After

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.0"
__version__ = "0.19.1"

View File

@ -62,8 +62,8 @@ def list_(
(Text('Enabled', justify='center'), 'center', None),
(Text('Settings', justify='center'), 'center', ctx.obj['style'].column),
]
for name, justify, style in columns:
table.add_column(name, justify=justify, style=style)
for heading, justify, style in columns:
table.add_column(heading, 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 column, justify, style in columns:
table.add_column(column, justify=justify, style=style)
for heading, justify, style in columns:
table.add_column(heading, 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 column, justify, style in columns:
table.add_column(column, justify=justify, style=style)
for heading, justify, style in columns:
table.add_column(heading, 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 column, justify, style in columns:
table.add_column(column, justify=justify, style=style)
for heading, justify, style in columns:
table.add_column(heading, 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 column, justify, style in columns:
table.add_column(column, justify=justify, style=style)
for heading, justify, style in columns:
table.add_column(heading, justify=justify, style=style)
for scene_name, scene_uuid in scenes:
if uuid:
@ -108,7 +108,11 @@ def switch(
if preview:
ctx.obj['obsws'].set_current_preview_scene(scene_name)
console.out.print(f'Switched to preview scene: [green]{scene_name}[/green]')
console.out.print(
f'Switched to preview scene: {console.highlight(ctx, scene_name)}'
)
else:
ctx.obj['obsws'].set_current_program_scene(scene_name)
console.out.print(f'Switched to program scene: [green]{scene_name}[/green]')
console.out.print(
f'Switched to program scene: {console.highlight(ctx, scene_name)}'
)

View File

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

View File

@ -42,11 +42,6 @@ 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
@ -182,4 +177,7 @@ 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)