From e7a561c7b48f64da84c6f8941ca4df4ffdd41a1a Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Wed, 11 Jun 2025 02:09:32 +0100 Subject: [PATCH] add --version/-v flag --- CHANGELOG.md | 10 ++++++++++ README.md | 1 + pyproject.toml | 12 ++++++------ src/slobs_cli/__about__.py | 1 + src/slobs_cli/cli.py | 5 +++++ 5 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 src/slobs_cli/__about__.py diff --git a/CHANGELOG.md b/CHANGELOG.md index d4a8edd..04460ef 100644 --- a/CHANGELOG.md +++ b/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.7.6] - 2025-06-11 + +### Added + +- --version/-v command. + +### Changed + +- --token/-t is now required. + # [0.7.3] - 2025-06-10 ### Added diff --git a/README.md b/README.md index 50020a7..588d688 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ The CLI should now be discoverable as `slobs-cli` - --domain/-d: Streamlabs client domain - --port/-p Streamlabs client port - --token/-t: API Token +- --version/-v: Print the slobs-cli version Pass `--domain`, `--port` and `--token` as flags on the root command, for example: diff --git a/pyproject.toml b/pyproject.toml index b7d0c21..f7d64e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [project] name = "slobs-cli" -version = "0.7.5" description = "A command line application for Streamlabs Desktop" authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }] dependencies = ["pyslobs>=2.0.4", "asyncclick>=8.1.8"] requires-python = ">=3.10" readme = "README.md" license = { text = "MIT" } +dynamic = ["version"] [project.scripts] slobs-cli = "slobs_cli.cli:run" @@ -19,6 +19,10 @@ build-backend = "pdm.backend" [tool.pdm] distribution = true +[tool.pdm.version] +source = "file" +path = "src/slobs_cli/__about__.py" + [tool.pdm.scripts] cli.cmd = "slobs-cli {args}" cli.env_file = ".env" @@ -28,8 +32,4 @@ test.env_file = ".env" post_test.cmd = "python tests/teardown.py" [dependency-groups] -dev = [ - "tox-pdm>=0.7.2", - "pytest>=8.4.0", - "virtualenv-pyenv>=0.5.0", -] +dev = ["tox-pdm>=0.7.2", "pytest>=8.4.0", "virtualenv-pyenv>=0.5.0"] diff --git a/src/slobs_cli/__about__.py b/src/slobs_cli/__about__.py new file mode 100644 index 0000000..aed5734 --- /dev/null +++ b/src/slobs_cli/__about__.py @@ -0,0 +1 @@ +__version__ = "0.7.6" diff --git a/src/slobs_cli/cli.py b/src/slobs_cli/cli.py index 6235129..36b396e 100644 --- a/src/slobs_cli/cli.py +++ b/src/slobs_cli/cli.py @@ -2,6 +2,8 @@ import anyio import asyncclick as click from pyslobs import ConnectionConfig, SlobsConnection +from .__about__ import __version__ as version + @click.group() @click.option( @@ -30,6 +32,9 @@ from pyslobs import ConnectionConfig, SlobsConnection show_envvar=True, required=True, ) +@click.version_option( + version, "-v", "--version", message="%(prog)s version: %(version)s" +) @click.pass_context async def cli(ctx: click.Context, domain: str, port: int, token: str | None): """Command line interface for Streamlabs Desktop."""