mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-08-07 12:11:53 +00:00
Compare commits
4 Commits
b9d2afb108
...
3dbff1cc4d
Author | SHA1 | Date | |
---|---|---|---|
3dbff1cc4d | |||
75fdbf5ad8 | |||
ec444d9cdd | |||
370c82f393 |
10
CHANGELOG.md
10
CHANGELOG.md
@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
# [0.15.0] - 2025-06-02
|
||||
|
||||
### Added
|
||||
|
||||
- root typer now accepts --version/-v option, it returns the CLI version. See [Root Typer](https://github.com/onyx-and-iris/obsws-cli?tab=readme-ov-file#root-typer)
|
||||
|
||||
### Changed
|
||||
|
||||
- version command renamed to obs-version
|
||||
|
||||
# [0.14.2] - 2025-05-29
|
||||
|
||||
### Changed
|
||||
|
10
README.md
10
README.md
@ -64,10 +64,16 @@ Flags can be used to override environment variables.
|
||||
|
||||
## Root Typer
|
||||
|
||||
- version: Get the OBS Client and WebSocket versions.
|
||||
- --version/-v: Get the obsws-cli version:
|
||||
|
||||
```console
|
||||
obsws-cli version
|
||||
obsws-cli --version
|
||||
```
|
||||
|
||||
- obs-version: Get the OBS Client and WebSocket versions.
|
||||
|
||||
```console
|
||||
obsws-cli obs-version
|
||||
```
|
||||
|
||||
## Sub Typers
|
||||
|
@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online>
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
__version__ = "0.14.2"
|
||||
__version__ = "0.15.0"
|
||||
|
@ -6,6 +6,8 @@ import obsws_python as obsws
|
||||
import typer
|
||||
from rich.console import Console
|
||||
|
||||
from obsws_cli.__about__ import __version__ as obsws_cli_version
|
||||
|
||||
from . import (
|
||||
filter,
|
||||
group,
|
||||
@ -48,6 +50,13 @@ out_console = Console()
|
||||
err_console = Console(stderr=True)
|
||||
|
||||
|
||||
def version_callback(value: bool):
|
||||
"""Show the version of the CLI."""
|
||||
if value:
|
||||
typer.echo(f'obsws_cli version: {obsws_cli_version}')
|
||||
raise typer.Exit()
|
||||
|
||||
|
||||
@app.callback()
|
||||
def main(
|
||||
ctx: typer.Context,
|
||||
@ -68,13 +77,24 @@ def main(
|
||||
int,
|
||||
typer.Option(envvar='OBS_TIMEOUT', help='WebSocket timeout', show_default=5),
|
||||
] = settings.get('TIMEOUT'),
|
||||
version: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
'--version',
|
||||
'-v',
|
||||
is_eager=True,
|
||||
help='Show the CLI version and exit',
|
||||
show_default=False,
|
||||
callback=version_callback,
|
||||
),
|
||||
] = False,
|
||||
):
|
||||
"""obsws_cli is a command line interface for the OBS WebSocket API."""
|
||||
ctx.obj = ctx.with_resource(obsws.ReqClient(**ctx.params))
|
||||
|
||||
|
||||
@app.command()
|
||||
def version(ctx: typer.Context):
|
||||
def obs_version(ctx: typer.Context):
|
||||
"""Get the OBS Client and WebSocket versions."""
|
||||
resp = ctx.obj.get_version()
|
||||
out_console.print(
|
||||
|
@ -32,7 +32,7 @@ def list(ctx: typer.Context, source_name: str):
|
||||
|
||||
if not resp.filters:
|
||||
out_console.print(f'No filters found for source {source_name}')
|
||||
return
|
||||
raise typer.Exit()
|
||||
|
||||
table = Table(title=f'Filters for Source: {source_name}', padding=(0, 2))
|
||||
|
||||
|
@ -42,7 +42,7 @@ def list(
|
||||
|
||||
if not groups:
|
||||
out_console.print(f"No groups found in scene '{scene_name}'.")
|
||||
return
|
||||
raise typer.Exit()
|
||||
|
||||
table = Table(title=f'Groups in Scene: {scene_name}', padding=(0, 2))
|
||||
|
||||
|
@ -49,7 +49,7 @@ def list(
|
||||
|
||||
if not inputs:
|
||||
out_console.print('No inputs found.')
|
||||
return
|
||||
raise typer.Exit()
|
||||
|
||||
table = Table(title='Inputs', padding=(0, 2))
|
||||
for column in ('Input Name', 'Kind'):
|
||||
|
@ -52,7 +52,7 @@ def list(
|
||||
|
||||
if not items:
|
||||
out_console.print(f"No items found in scene '{scene_name}'.")
|
||||
return
|
||||
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'):
|
||||
|
@ -22,7 +22,7 @@ classifiers = [
|
||||
"Programming Language :: Python :: Implementation :: PyPy",
|
||||
]
|
||||
dependencies = [
|
||||
"typer>=0.15.2",
|
||||
"typer>=0.16.0",
|
||||
"obsws-python>=1.7.2",
|
||||
"pydantic-settings>=2.9.1",
|
||||
]
|
||||
|
@ -8,8 +8,15 @@ runner = CliRunner(mix_stderr=False)
|
||||
|
||||
|
||||
def test_version():
|
||||
"""Test the version command."""
|
||||
result = runner.invoke(app, ['version'])
|
||||
"""Test the version option."""
|
||||
result = runner.invoke(app, ['--version'])
|
||||
assert result.exit_code == 0
|
||||
assert 'obsws_cli version:' in result.stdout
|
||||
|
||||
|
||||
def test_obs_version():
|
||||
"""Test the obs-version command."""
|
||||
result = runner.invoke(app, ['obs-version'])
|
||||
assert result.exit_code == 0
|
||||
assert 'OBS Client version' in result.stdout
|
||||
assert 'WebSocket version' in result.stdout
|
||||
|
Loading…
x
Reference in New Issue
Block a user