Compare commits

..

4 Commits

Author SHA1 Message Date
35be262b2a patch bump 2026-02-07 08:32:58 +00:00
58907fe2b5 add 0.24.8 to CHANGELOG 2026-02-07 08:32:34 +00:00
1a05a89042 update README 2026-02-07 08:32:26 +00:00
13a2443d48 remove --debug flag, replace it with --loglevel 2026-02-07 08:32:17 +00:00
5 changed files with 29 additions and 13 deletions

View File

@ -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.24.8] - 2026-02-07
### Changed
- --debug flag removed and replaced with --loglevel. See [Flags](https://github.com/onyx-and-iris/obsws-cli/tree/main?tab=readme-ov-file#flags). This gives the user more control over the level of logging. The default level has been set to WARNING.
### Fixed
- shell completion now works, see [Shell Completion](https://github.com/onyx-and-iris/obsws-cli/tree/main?tab=readme-ov-file#shell-completion). Unfortunately, command aliases in the help output are no longer present as it was breaking shell completion. However, the aliases do still work. See [issue #3](https://github.com/onyx-and-iris/obsws-cli/issues/3)
# [0.24.6] - 2026-01-26
### Changed

View File

@ -49,6 +49,8 @@ The CLI should now be discoverable as `obsws-cli`
- --password/-p: Websocket password
- --timeout/-T: Websocket timeout
- --version/-v: Print the obsws-cli version
- --loglevel/-l: Set the application's logging level
- One of *DEBUG, INFO, WARNING, ERROR, CRITICAL*
Pass `--host`, `--port` and `--password` as flags on the root command, for example:
@ -66,6 +68,7 @@ Store and load environment variables from:
OBSWS_CLI_HOST=localhost
OBSWS_CLI_PORT=4455
OBSWS_CLI_PASSWORD=<websocket password>
OBSWS_CLI_LOGLEVEL=DEBUG
```
Flags can be used to override environment variables.

View File

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

View File

@ -28,11 +28,15 @@ def version_callback(value: bool):
raise typer.Exit()
def setup_logging(debug: bool):
def setup_logging(loglevel: str):
"""Set up logging for the application."""
log_level = logging.DEBUG if debug else logging.CRITICAL
loglevel = loglevel.upper()
if loglevel not in ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']:
raise typer.BadParameter(
f'Invalid log level: {loglevel}. Choose from DEBUG, INFO, WARNING, ERROR, CRITICAL.'
)
logging.basicConfig(
level=log_level,
level=loglevel,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
)
@ -121,19 +125,18 @@ def main(
callback=version_callback,
),
] = False,
debug: Annotated[
bool,
loglevel: Annotated[
str,
typer.Option(
'--debug',
'-d',
envvar='OBSWS_CLI_DEBUG',
'--loglevel',
'-l',
envvar='OBSWS_CLI_LOGLEVEL',
is_eager=True,
help='Enable debug logging',
help='Set the logging level',
show_default=False,
callback=setup_logging,
hidden=True,
),
] = envconfig.get('debug'),
] = envconfig.get('loglevel'),
):
"""obsws_cli is a command line interface for the OBS WebSocket API."""
ctx.ensure_object(dict)

View File

@ -124,7 +124,7 @@ _envconfig = EnvConfig(
OBSWS_CLI_PORT=4455,
OBSWS_CLI_PASSWORD='',
OBSWS_CLI_TIMEOUT=5,
OBSWS_CLI_DEBUG=False,
OBSWS_CLI_LOGLEVEL='WARNING',
OBSWS_CLI_STYLE='disabled',
OBSWS_CLI_STYLE_NO_BORDER=False,
)