25 Commits

Author SHA1 Message Date
aaadcc9d38 typo 2026-03-27 09:33:01 +00:00
cab4299b17 add shell completion scripts
add Shell Completion section to README

add pdm script completion

add pre-commit config
2026-03-24 00:40:05 +00:00
58a8b96603 add anyio to deps
patch bump
2025-12-28 20:55:32 +00:00
8646c7601f update websocket token location 2025-11-06 16:17:30 +00:00
2c4a0f618c fix lincense link 2025-06-29 14:35:50 +01:00
fa681a7208 typo 2025-06-27 13:45:51 +01:00
c6c8522a2d prefer true 2025-06-27 13:11:42 +01:00
cac7c09fa6 reword 2025-06-27 12:45:42 +01:00
f9f118dc2d rename release action to publish
add ruff action
2025-06-27 12:42:55 +01:00
835a05dd3e add style env vars to README 2025-06-27 12:17:28 +01:00
4cd420dc44 fix workflow dir name 2025-06-27 12:13:05 +01:00
06c9fa236d add release workflow 2025-06-27 12:09:05 +01:00
6490b5aa54 move style section and add imgs 2025-06-27 12:05:53 +01:00
f7345155f1 disable --help wrapping, realign the text
add --help shortname -h

patch bump
2025-06-27 12:05:25 +01:00
1c2d1abb2a add --style validation
add Disabled class to style registry

patch bump
2025-06-22 12:36:29 +01:00
fe3a975ba3 leave it up to rich... if no style is set we still get colour on stderr, but this can be overriden with NO_COLOR manually
patch bump
2025-06-22 11:33:52 +01:00
d8622ab037 set default values for no_colour style to 'none'.
This fixes rich markup error

ensure errors are written without colour if NO_COLOR is set
2025-06-22 10:49:05 +01:00
10cb9777fa add 0.11.0 to CHANGELOG 2025-06-22 02:57:31 +01:00
c48f7a49ac add Style section to README 2025-06-22 02:54:42 +01:00
b14d9b7610 ensure studio mode is disabled on test cleanup 2025-06-22 02:54:08 +01:00
864751ecc9 remove terminaltables3 dep, add rich 2025-06-22 02:53:46 +01:00
c02ffac403 replace terminaltables with rich tables.
allow rich to handle all console output.

util.check_mark is now used to pass back colourless check/cross marks if NO_COLOR is set or --style/SLOBS_STYLE was not set.
2025-06-22 02:52:27 +01:00
6bcdd8391c add --style and --no-border flags to root command 2025-06-22 02:39:28 +01:00
b0d311dad9 define styles 2025-06-22 02:38:56 +01:00
46159a0ca4 add missing for-else comment 2025-06-15 08:40:36 +01:00
28 changed files with 906 additions and 260 deletions

26
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: Publish to PyPI
on:
release:
types: [published]
push:
tags:
- 'v*.*.*'
jobs:
pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
environment: pypi
permissions:
# This permission is needed for private repositories.
contents: read
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
- uses: pdm-project/setup-pdm@v4
- name: Publish package distributions to PyPI
run: pdm publish

19
.github/workflows/ruff.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Ruff
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3
with:
args: 'format --check --diff'

7
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

View File

@@ -5,6 +5,14 @@ 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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# [0.11.0] - 2025-06-22
### Added
- Various colouring styles, see [Style](https://github.com/onyx-and-iris/slobs-cli/tree/main?tab=readme-ov-file#style)
- colouring is applied to list tables as well as highlighted information in stdout/stderr output.
- table border styling may be optionally disabled with the --no-border flag.
# [0.10.0] - 2025-06-13 # [0.10.0] - 2025-06-13
### Changed ### Changed

View File

@@ -14,14 +14,16 @@ For an outline of past/future changes refer to: [CHANGELOG](CHANGELOG.md)
- [Installation](#installation) - [Installation](#installation)
- [Configuration](#configuration) - [Configuration](#configuration)
- [Style](#style)
- [Commands](#commands) - [Commands](#commands)
- [Shell Completion](#shell-completion)
- [License](#license) - [License](#license)
## Requirements ## Requirements
- Python 3.11 or greater - Python 3.11 or greater
- [Streamlabs Desktop][sl-desktop] - [Streamlabs Desktop][sl-desktop]
- A websocket token: Settings > Remote Control > API Token - A websocket token: Settings > Mobile > Third Party Connections > API Token
## Installation ## Installation
@@ -68,6 +70,37 @@ Flags can be used to override environment variables.
[sl-desktop]: https://streamlabs.com/streamlabs-live-streaming-software?srsltid=AfmBOopnswGBgEyvVSi2DIc_vsGovKn2HQZyLw1Cg6LEo51OJhONXnAX [sl-desktop]: https://streamlabs.com/streamlabs-live-streaming-software?srsltid=AfmBOopnswGBgEyvVSi2DIc_vsGovKn2HQZyLw1Cg6LEo51OJhONXnAX
## 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
slobs-cli --style="yellow" audio 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
slobs-cli --style="yellow" --no-border audio list
```
Or with environment variables:
```env
SLOBS_STYLE=yellow
SLOBS_STYLE_NO_BORDER=true
```
## Commands ## Commands
#### Scene #### Scene
@@ -293,10 +326,70 @@ slobs-cli scenecollection load "ExistingCollection"
slobs-cli scenecollection rename "ExistingCollection" "NewName" slobs-cli scenecollection rename "ExistingCollection" "NewName"
``` ```
## Shell Completion
Shell completion scripts are available for *bash*, *zsh*, and *fish*, you can find them in the [completions directory](./completions/).
#### Bash
Save the script in a completions directory of your choice.
```console
cp -v ./completions/_slobs-cli.bash ~/.completions/_slobs-cli
```
Source the file in `~/.bashrc`
```bash
. ~/.completions/_slobs-cli
```
Restart the shell
```console
exec "$SHELL"
```
#### Fish
Save the script to `~/.config/fish/completions`
```fish
cp -v ./completions/_slobs-cli.fish ~/.config/fish/completions/_slobs-cli
```
Restart the shell
```console
exec "$SHELL"
```
#### Zsh
Save the script in a completions directory of your choice.
```console
cp -v ./completions/_slobs-cli.zsh ~/.completions/_slobs-cli
```
Source the file in `~/.zshrc`
```zsh
. ~/.completions/_slobs-cli
```
> Note: If you're using a framework like oh-my-zsh you can copy the completion script straight into $ZSH_CUSTOM/completions and skip modifying ~/.zshrc
Restart the shell
```console
exec "$SHELL"
```
## Special Thanks ## Special Thanks
- [Julian-0](https://github.com/Julian-O) For writing the [PySLOBS wrapper](https://github.com/Julian-O/PySLOBS) on which this CLI depends. - [Julian-0](https://github.com/Julian-O) For writing the [PySLOBS wrapper](https://github.com/Julian-O/PySLOBS) on which this CLI depends.
## License ## License
`slobs-cli` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license. `slobs-cli` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

33
Taskfile.yaml Normal file
View File

@@ -0,0 +1,33 @@
version: '3'
tasks:
default:
desc: Generate completion scripts for supported shells
cmds:
- task: generate-completion-scripts
generate-completion-scripts:
desc: Generate completion scripts for supported shells
cmds:
- for:
matrix:
SHELL: [bash, fish, zsh]
task: generate-completion-script-{{.ITEM.SHELL}}
generate-completion-script-bash:
desc: Generate bash completion script
cmds:
- bash -c '_SLOBS_CLI_COMPLETE=bash_source slobs-cli > ./completions/_slobs-cli.bash'
internal: true
generate-completion-script-fish:
desc: Generate fish completion script
cmds:
- fish -c '_SLOBS_CLI_COMPLETE=fish_source slobs-cli > ./completions/_slobs-cli.fish'
internal: true
generate-completion-script-zsh:
desc: Generate zsh completion script
cmds:
- zsh -c '_SLOBS_CLI_COMPLETE=zsh_source slobs-cli > ./completions/_slobs-cli.zsh'
internal: true

View File

@@ -0,0 +1,28 @@
_slobs_cli_completion() {
local IFS=$'\n'
local response
response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _SLOBS_CLI_COMPLETE=bash_complete $1)
for completion in $response; do
IFS=',' read type value <<< "$completion"
if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done
return 0
}
_slobs_cli_completion_setup() {
complete -o nosort -F _slobs_cli_completion slobs-cli
}
_slobs_cli_completion_setup;

View File

@@ -0,0 +1,17 @@
function _slobs_cli_completion;
set -l response (env _SLOBS_CLI_COMPLETE=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) slobs-cli);
for completion in $response;
set -l metadata (string split "," $completion);
if test $metadata[1] = "dir";
__fish_complete_directories $metadata[2];
else if test $metadata[1] = "file";
__fish_complete_path $metadata[2];
else if test $metadata[1] = "plain";
echo $metadata[2];
end;
end;
end;
complete --no-files --command slobs-cli --arguments "(_slobs_cli_completion)";

View File

@@ -0,0 +1,40 @@
#compdef slobs-cli
_slobs_cli_completion() {
local -a completions
local -a completions_with_descriptions
local -a response
(( ! $+commands[slobs-cli] )) && return 1
response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) _SLOBS_CLI_COMPLETE=zsh_complete slobs-cli)}")
for type key descr in ${response}; do
if [[ "$type" == "plain" ]]; then
if [[ "$descr" == "_" ]]; then
completions+=("$key")
else
completions_with_descriptions+=("$key":"$descr")
fi
elif [[ "$type" == "dir" ]]; then
_path_files -/
elif [[ "$type" == "file" ]]; then
_path_files -f
fi
done
if [ -n "$completions_with_descriptions" ]; then
_describe -V unsorted completions_with_descriptions -U
fi
if [ -n "$completions" ]; then
compadd -U -V unsorted -a completions
fi
}
if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
# autoload from fpath, call function directly
_slobs_cli_completion "$@"
else
# eval/source/. command, register function for later
compdef _slobs_cli_completion slobs-cli
fi

BIN
img/coloured-border.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
img/colourless.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

279
pdm.lock generated
View File

@@ -5,53 +5,50 @@
groups = ["default", "dev"] groups = ["default", "dev"]
strategy = ["inherit_metadata"] strategy = ["inherit_metadata"]
lock_version = "4.5.0" lock_version = "4.5.0"
content_hash = "sha256:c1f6a22d9f4fca9c52692b2931ca64dada84a1e99c9013dad4be26bdd786cc6e" content_hash = "sha256:657780adc251e4b26f1c7798388f7e7442549af2cbdac53fa23b39c40acb28ba"
[[metadata.targets]] [[metadata.targets]]
requires_python = ">=3.11" requires_python = ">=3.11"
[[package]] [[package]]
name = "anyio" name = "anyio"
version = "4.9.0" version = "4.12.0"
requires_python = ">=3.9" requires_python = ">=3.9"
summary = "High level compatibility layer for multiple asynchronous event loop implementations" summary = "High-level concurrency and networking framework on top of asyncio or Trio"
groups = ["default"] groups = ["default"]
dependencies = [ dependencies = [
"exceptiongroup>=1.0.2; python_version < \"3.11\"", "exceptiongroup>=1.0.2; python_version < \"3.11\"",
"idna>=2.8", "idna>=2.8",
"sniffio>=1.1",
"typing-extensions>=4.5; python_version < \"3.13\"", "typing-extensions>=4.5; python_version < \"3.13\"",
] ]
files = [ files = [
{file = "anyio-4.9.0-py3-none-any.whl", hash = "sha256:9f76d541cad6e36af7beb62e978876f3b41e3e04f2c1fbf0884604c0a9c4d93c"}, {file = "anyio-4.12.0-py3-none-any.whl", hash = "sha256:dad2376a628f98eeca4881fc56cd06affd18f659b17a747d3ff0307ced94b1bb"},
{file = "anyio-4.9.0.tar.gz", hash = "sha256:673c0c244e15788651a4ff38710fea9675823028a6f08a5eda409e0c9840a028"}, {file = "anyio-4.12.0.tar.gz", hash = "sha256:73c693b567b0c55130c104d0b43a9baf3aa6a31fc6110116509f27bf75e21ec0"},
] ]
[[package]] [[package]]
name = "asyncclick" name = "asyncclick"
version = "8.1.8" version = "8.3.0.7"
requires_python = ">=3.9" requires_python = ">=3.11"
summary = "Composable command line interface toolkit, " summary = "Composable command line interface toolkit, async fork"
groups = ["default"] groups = ["default"]
dependencies = [ dependencies = [
"anyio~=4.0",
"colorama; platform_system == \"Windows\"", "colorama; platform_system == \"Windows\"",
] ]
files = [ files = [
{file = "asyncclick-8.1.8-py3-none-any.whl", hash = "sha256:eb1ccb44bc767f8f0695d592c7806fdf5bd575605b4ee246ffd5fadbcfdbd7c6"}, {file = "asyncclick-8.3.0.7-py3-none-any.whl", hash = "sha256:7607046de39a3f315867cad818849f973e29d350c10d92f251db3ff7600c6c7d"},
{file = "asyncclick-8.1.8.0-py3-none-any.whl", hash = "sha256:be146a2d8075d4fe372ff4e877f23c8b5af269d16705c1948123b9415f6fd678"}, {file = "asyncclick-8.3.0.7.tar.gz", hash = "sha256:8a80d8ac613098ee6a9a8f0248f60c66c273e22402cf3f115ed7f071acfc71d3"},
{file = "asyncclick-8.1.8.tar.gz", hash = "sha256:0f0eb0f280e04919d67cf71b9fcdfb4db2d9ff7203669c40284485c149578e4c"},
] ]
[[package]] [[package]]
name = "cachetools" name = "cachetools"
version = "6.0.0" version = "6.2.4"
requires_python = ">=3.9" requires_python = ">=3.9"
summary = "Extensible memoizing collections and decorators" summary = "Extensible memoizing collections and decorators"
groups = ["dev"] groups = ["dev"]
files = [ files = [
{file = "cachetools-6.0.0-py3-none-any.whl", hash = "sha256:82e73ba88f7b30228b5507dce1a1f878498fc669d972aef2dde4f3a3c24f103e"}, {file = "cachetools-6.2.4-py3-none-any.whl", hash = "sha256:69a7a52634fed8b8bf6e24a050fb60bff1c9bd8f6d24572b99c32d4e71e62a51"},
{file = "cachetools-6.0.0.tar.gz", hash = "sha256:f225782b84438f828328fc2ad74346522f27e5b1440f4e9fd18b20ebfd1aa2cf"}, {file = "cachetools-6.2.4.tar.gz", hash = "sha256:82c5c05585e70b6ba2d3ae09ea60b79548872185d2f24ae1f2709d37299fd607"},
] ]
[[package]] [[package]]
@@ -78,45 +75,70 @@ files = [
[[package]] [[package]]
name = "distlib" name = "distlib"
version = "0.3.9" version = "0.4.0"
summary = "Distribution utilities" summary = "Distribution utilities"
groups = ["dev"] groups = ["dev"]
files = [ files = [
{file = "distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87"}, {file = "distlib-0.4.0-py2.py3-none-any.whl", hash = "sha256:9659f7d87e46584a30b5780e43ac7a2143098441670ff0a49d5f9034c54a6c16"},
{file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"}, {file = "distlib-0.4.0.tar.gz", hash = "sha256:feec40075be03a04501a973d81f633735b4b69f98b05450592310c0f401a4e0d"},
] ]
[[package]] [[package]]
name = "filelock" name = "filelock"
version = "3.18.0" version = "3.20.1"
requires_python = ">=3.9" requires_python = ">=3.10"
summary = "A platform independent file lock." summary = "A platform independent file lock."
groups = ["dev"] groups = ["dev"]
files = [ files = [
{file = "filelock-3.18.0-py3-none-any.whl", hash = "sha256:c401f4f8377c4464e6db25fff06205fd89bdd83b65eb0488ed1b160f780e21de"}, {file = "filelock-3.20.1-py3-none-any.whl", hash = "sha256:15d9e9a67306188a44baa72f569d2bfd803076269365fdea0934385da4dc361a"},
{file = "filelock-3.18.0.tar.gz", hash = "sha256:adbc88eabb99d2fec8c9c1b229b171f18afa655400173ddc653d5d01501fb9f2"}, {file = "filelock-3.20.1.tar.gz", hash = "sha256:b8360948b351b80f420878d8516519a2204b07aefcdcfd24912a5d33127f188c"},
] ]
[[package]] [[package]]
name = "idna" name = "idna"
version = "3.10" version = "3.11"
requires_python = ">=3.6" requires_python = ">=3.8"
summary = "Internationalized Domain Names in Applications (IDNA)" summary = "Internationalized Domain Names in Applications (IDNA)"
groups = ["default"] groups = ["default"]
files = [ files = [
{file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, {file = "idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea"},
{file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, {file = "idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902"},
] ]
[[package]] [[package]]
name = "iniconfig" name = "iniconfig"
version = "2.1.0" version = "2.3.0"
requires_python = ">=3.8" requires_python = ">=3.10"
summary = "brain-dead simple config-ini parsing" summary = "brain-dead simple config-ini parsing"
groups = ["dev"] groups = ["dev"]
files = [ files = [
{file = "iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760"}, {file = "iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12"},
{file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"}, {file = "iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730"},
]
[[package]]
name = "markdown-it-py"
version = "4.0.0"
requires_python = ">=3.10"
summary = "Python port of markdown-it. Markdown parsing, done right!"
groups = ["default"]
dependencies = [
"mdurl~=0.1",
]
files = [
{file = "markdown_it_py-4.0.0-py3-none-any.whl", hash = "sha256:87327c59b172c5011896038353a81343b6754500a08cd7a4973bb48c6d578147"},
{file = "markdown_it_py-4.0.0.tar.gz", hash = "sha256:cb0a2b4aa34f932c007117b194e945bd74e0ec24133ceb5bac59009cda1cb9f3"},
]
[[package]]
name = "mdurl"
version = "0.1.2"
requires_python = ">=3.7"
summary = "Markdown URL utilities"
groups = ["default"]
files = [
{file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"},
{file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"},
] ]
[[package]] [[package]]
@@ -132,13 +154,13 @@ files = [
[[package]] [[package]]
name = "platformdirs" name = "platformdirs"
version = "4.3.8" version = "4.5.1"
requires_python = ">=3.9" requires_python = ">=3.10"
summary = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." summary = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."
groups = ["dev"] groups = ["dev"]
files = [ files = [
{file = "platformdirs-4.3.8-py3-none-any.whl", hash = "sha256:ff7059bb7eb1179e2685604f4aaf157cfd9535242bd23742eadc3c13542139b4"}, {file = "platformdirs-4.5.1-py3-none-any.whl", hash = "sha256:d03afa3963c806a9bed9d5125c8f4cb2fdaf74a55ab60e5d59b3fde758104d31"},
{file = "platformdirs-4.3.8.tar.gz", hash = "sha256:3d512d96e16bcb959a814c9f348431070822a6496326a4be0911c40b5a74c2bc"}, {file = "platformdirs-4.5.1.tar.gz", hash = "sha256:61d5cdcc6065745cdd94f0f878977f8de9437be93de97c1c12f853c9c0cdcbda"},
] ]
[[package]] [[package]]
@@ -154,78 +176,78 @@ files = [
[[package]] [[package]]
name = "pyenv-inspect" name = "pyenv-inspect"
version = "0.4.0" version = "0.5.0"
requires_python = ">=3.8" requires_python = ">=3.9"
summary = "An auxiliary library for the virtualenv-pyenv and tox-pyenv-redux plugins" summary = "An auxiliary library for the virtualenv-pyenv and tox-pyenv-redux plugins"
groups = ["dev"] groups = ["dev"]
files = [ files = [
{file = "pyenv-inspect-0.4.0.tar.gz", hash = "sha256:ec429d1d81b67ab0b08a0408414722a79d24fd1845a5b264267e44e19d8d60f0"}, {file = "pyenv_inspect-0.5.0-py3-none-any.whl", hash = "sha256:ada3d3ea49b8604ff330d06a39ffe46df120d31c0bc9796392a41f2c3b34b08e"},
{file = "pyenv_inspect-0.4.0-py3-none-any.whl", hash = "sha256:618683ae7d3e6db14778d58aa0fc6b3170180d944669b5d35a8aa4fb7db550d2"}, {file = "pyenv_inspect-0.5.0.tar.gz", hash = "sha256:acaec63227577ac6edd3e775036d7bb0077d8ed2ebce5021e176a732e20c84d3"},
] ]
[[package]] [[package]]
name = "pygments" name = "pygments"
version = "2.19.1" version = "2.19.2"
requires_python = ">=3.8" requires_python = ">=3.8"
summary = "Pygments is a syntax highlighting package written in Python." summary = "Pygments is a syntax highlighting package written in Python."
groups = ["dev"] groups = ["default", "dev"]
files = [ files = [
{file = "pygments-2.19.1-py3-none-any.whl", hash = "sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c"}, {file = "pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b"},
{file = "pygments-2.19.1.tar.gz", hash = "sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f"}, {file = "pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887"},
] ]
[[package]] [[package]]
name = "pyproject-api" name = "pyproject-api"
version = "1.9.1" version = "1.10.0"
requires_python = ">=3.9" requires_python = ">=3.10"
summary = "API to interact with the python pyproject.toml based projects" summary = "API to interact with the python pyproject.toml based projects"
groups = ["dev"] groups = ["dev"]
dependencies = [ dependencies = [
"packaging>=25", "packaging>=25",
"tomli>=2.2.1; python_version < \"3.11\"", "tomli>=2.3; python_version < \"3.11\"",
] ]
files = [ files = [
{file = "pyproject_api-1.9.1-py3-none-any.whl", hash = "sha256:7d6238d92f8962773dd75b5f0c4a6a27cce092a14b623b811dba656f3b628948"}, {file = "pyproject_api-1.10.0-py3-none-any.whl", hash = "sha256:8757c41a79c0f4ab71b99abed52b97ecf66bd20b04fa59da43b5840bac105a09"},
{file = "pyproject_api-1.9.1.tar.gz", hash = "sha256:43c9918f49daab37e302038fc1aed54a8c7a91a9fa935d00b9a485f37e0f5335"}, {file = "pyproject_api-1.10.0.tar.gz", hash = "sha256:40c6f2d82eebdc4afee61c773ed208c04c19db4c4a60d97f8d7be3ebc0bbb330"},
] ]
[[package]] [[package]]
name = "pyslobs" name = "pyslobs"
version = "2.0.5" version = "2.1.0"
requires_python = ">=3.9" requires_python = ">=3.10"
summary = "Python wrapper to StreamLabs Desktop API" summary = "Python wrapper to StreamLabs Desktop API"
groups = ["default"] groups = ["default"]
dependencies = [ dependencies = [
"websocket-client", "websocket-client",
] ]
files = [ files = [
{file = "pyslobs-2.0.5-py3-none-any.whl", hash = "sha256:b33d774dda484ffe48e63592a3cdf66c79f77d04947a6e8c8b6da58db13ab156"}, {file = "pyslobs-2.1.0-py3-none-any.whl", hash = "sha256:b0fe85dce75a8faae5dfd8ee717971a732d45602d97cc5eaa653a116878d5e92"},
{file = "pyslobs-2.0.5.tar.gz", hash = "sha256:53cb083cbe71e37f3604ad0e5ca9712b3f26a29824ce0d437fd66e3d7937fee6"}, {file = "pyslobs-2.1.0.tar.gz", hash = "sha256:244c67563cffd56fd1b39a03552d125ad7c2c8fefff6b42c4153bbfe29984fa1"},
] ]
[[package]] [[package]]
name = "pytest" name = "pytest"
version = "8.4.0" version = "9.0.2"
requires_python = ">=3.9" requires_python = ">=3.10"
summary = "pytest: simple powerful testing with Python" summary = "pytest: simple powerful testing with Python"
groups = ["dev"] groups = ["dev"]
dependencies = [ dependencies = [
"colorama>=0.4; sys_platform == \"win32\"", "colorama>=0.4; sys_platform == \"win32\"",
"exceptiongroup>=1; python_version < \"3.11\"", "exceptiongroup>=1; python_version < \"3.11\"",
"iniconfig>=1", "iniconfig>=1.0.1",
"packaging>=20", "packaging>=22",
"pluggy<2,>=1.5", "pluggy<2,>=1.5",
"pygments>=2.7.2", "pygments>=2.7.2",
"tomli>=1; python_version < \"3.11\"", "tomli>=1; python_version < \"3.11\"",
] ]
files = [ files = [
{file = "pytest-8.4.0-py3-none-any.whl", hash = "sha256:f40f825768ad76c0977cbacdf1fd37c6f7a468e460ea6a0636078f8972d4517e"}, {file = "pytest-9.0.2-py3-none-any.whl", hash = "sha256:711ffd45bf766d5264d487b917733b453d917afd2b0ad65223959f59089f875b"},
{file = "pytest-8.4.0.tar.gz", hash = "sha256:14d920b48472ea0dbf68e45b96cd1ffda4705f33307dcc86c676c1b5104838a6"}, {file = "pytest-9.0.2.tar.gz", hash = "sha256:75186651a92bd89611d1d9fc20f0b4345fd827c41ccd5c299a868a05d70edf11"},
] ]
[[package]] [[package]]
name = "pytest-randomly" name = "pytest-randomly"
version = "3.16.0" version = "4.0.1"
requires_python = ">=3.9" requires_python = ">=3.9"
summary = "Pytest plugin to randomly order tests and control random.seed." summary = "Pytest plugin to randomly order tests and control random.seed."
groups = ["dev"] groups = ["dev"]
@@ -234,81 +256,75 @@ dependencies = [
"pytest", "pytest",
] ]
files = [ files = [
{file = "pytest_randomly-3.16.0-py3-none-any.whl", hash = "sha256:8633d332635a1a0983d3bba19342196807f6afb17c3eef78e02c2f85dade45d6"}, {file = "pytest_randomly-4.0.1-py3-none-any.whl", hash = "sha256:e0dfad2fd4f35e07beff1e47c17fbafcf98f9bf4531fd369d9260e2f858bfcb7"},
{file = "pytest_randomly-3.16.0.tar.gz", hash = "sha256:11bf4d23a26484de7860d82f726c0629837cf4064b79157bd18ec9d41d7feb26"}, {file = "pytest_randomly-4.0.1.tar.gz", hash = "sha256:174e57bb12ac2c26f3578188490bd333f0e80620c3f47340158a86eca0593cd8"},
]
[[package]]
name = "rich"
version = "14.2.0"
requires_python = ">=3.8.0"
summary = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
groups = ["default"]
dependencies = [
"markdown-it-py>=2.2.0",
"pygments<3.0.0,>=2.13.0",
]
files = [
{file = "rich-14.2.0-py3-none-any.whl", hash = "sha256:76bc51fe2e57d2b1be1f96c524b890b816e334ab4c1e45888799bfaab0021edd"},
{file = "rich-14.2.0.tar.gz", hash = "sha256:73ff50c7c0c1c77c8243079283f4edb376f0f6442433aecb8ce7e6d0b92d1fe4"},
] ]
[[package]] [[package]]
name = "ruff" name = "ruff"
version = "0.11.13" version = "0.14.10"
requires_python = ">=3.7" requires_python = ">=3.7"
summary = "An extremely fast Python linter and code formatter, written in Rust." summary = "An extremely fast Python linter and code formatter, written in Rust."
groups = ["dev"] groups = ["dev"]
files = [ files = [
{file = "ruff-0.11.13-py3-none-linux_armv6l.whl", hash = "sha256:4bdfbf1240533f40042ec00c9e09a3aade6f8c10b6414cf11b519488d2635d46"}, {file = "ruff-0.14.10-py3-none-linux_armv6l.whl", hash = "sha256:7a3ce585f2ade3e1f29ec1b92df13e3da262178df8c8bdf876f48fa0e8316c49"},
{file = "ruff-0.11.13-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:aef9c9ed1b5ca28bb15c7eac83b8670cf3b20b478195bd49c8d756ba0a36cf48"}, {file = "ruff-0.14.10-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:674f9be9372907f7257c51f1d4fc902cb7cf014b9980152b802794317941f08f"},
{file = "ruff-0.11.13-py3-none-macosx_11_0_arm64.whl", hash = "sha256:53b15a9dfdce029c842e9a5aebc3855e9ab7771395979ff85b7c1dedb53ddc2b"}, {file = "ruff-0.14.10-py3-none-macosx_11_0_arm64.whl", hash = "sha256:d85713d522348837ef9df8efca33ccb8bd6fcfc86a2cde3ccb4bc9d28a18003d"},
{file = "ruff-0.11.13-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ab153241400789138d13f362c43f7edecc0edfffce2afa6a68434000ecd8f69a"}, {file = "ruff-0.14.10-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6987ebe0501ae4f4308d7d24e2d0fe3d7a98430f5adfd0f1fead050a740a3a77"},
{file = "ruff-0.11.13-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:6c51f93029d54a910d3d24f7dd0bb909e31b6cd989a5e4ac513f4eb41629f0dc"}, {file = "ruff-0.14.10-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:16a01dfb7b9e4eee556fbfd5392806b1b8550c9b4a9f6acd3dbe6812b193c70a"},
{file = "ruff-0.11.13-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1808b3ed53e1a777c2ef733aca9051dc9bf7c99b26ece15cb59a0320fbdbd629"}, {file = "ruff-0.14.10-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7165d31a925b7a294465fa81be8c12a0e9b60fb02bf177e79067c867e71f8b1f"},
{file = "ruff-0.11.13-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:d28ce58b5ecf0f43c1b71edffabe6ed7f245d5336b17805803312ec9bc665933"}, {file = "ruff-0.14.10-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:c561695675b972effb0c0a45db233f2c816ff3da8dcfbe7dfc7eed625f218935"},
{file = "ruff-0.11.13-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:55e4bc3a77842da33c16d55b32c6cac1ec5fb0fbec9c8c513bdce76c4f922165"}, {file = "ruff-0.14.10-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4bb98fcbbc61725968893682fd4df8966a34611239c9fd07a1f6a07e7103d08e"},
{file = "ruff-0.11.13-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:633bf2c6f35678c56ec73189ba6fa19ff1c5e4807a78bf60ef487b9dd272cc71"}, {file = "ruff-0.14.10-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f24b47993a9d8cb858429e97bdf8544c78029f09b520af615c1d261bf827001d"},
{file = "ruff-0.11.13-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4ffbc82d70424b275b089166310448051afdc6e914fdab90e08df66c43bb5ca9"}, {file = "ruff-0.14.10-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:59aabd2e2c4fd614d2862e7939c34a532c04f1084476d6833dddef4afab87e9f"},
{file = "ruff-0.11.13-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:4a9ddd3ec62a9a89578c85842b836e4ac832d4a2e0bfaad3b02243f930ceafcc"}, {file = "ruff-0.14.10-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:213db2b2e44be8625002dbea33bb9c60c66ea2c07c084a00d55732689d697a7f"},
{file = "ruff-0.11.13-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:d237a496e0778d719efb05058c64d28b757c77824e04ffe8796c7436e26712b7"}, {file = "ruff-0.14.10-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b914c40ab64865a17a9a5b67911d14df72346a634527240039eb3bd650e5979d"},
{file = "ruff-0.11.13-py3-none-musllinux_1_2_i686.whl", hash = "sha256:26816a218ca6ef02142343fd24c70f7cd8c5aa6c203bca284407adf675984432"}, {file = "ruff-0.14.10-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1484983559f026788e3a5c07c81ef7d1e97c1c78ed03041a18f75df104c45405"},
{file = "ruff-0.11.13-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:51c3f95abd9331dc5b87c47ac7f376db5616041173826dfd556cfe3d4977f492"}, {file = "ruff-0.14.10-py3-none-musllinux_1_2_i686.whl", hash = "sha256:c70427132db492d25f982fffc8d6c7535cc2fd2c83fc8888f05caaa248521e60"},
{file = "ruff-0.11.13-py3-none-win32.whl", hash = "sha256:96c27935418e4e8e77a26bb05962817f28b8ef3843a6c6cc49d8783b5507f250"}, {file = "ruff-0.14.10-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:5bcf45b681e9f1ee6445d317ce1fa9d6cba9a6049542d1c3d5b5958986be8830"},
{file = "ruff-0.11.13-py3-none-win_amd64.whl", hash = "sha256:29c3189895a8a6a657b7af4e97d330c8a3afd2c9c8f46c81e2fc5a31866517e3"}, {file = "ruff-0.14.10-py3-none-win32.whl", hash = "sha256:104c49fc7ab73f3f3a758039adea978869a918f31b73280db175b43a2d9b51d6"},
{file = "ruff-0.11.13-py3-none-win_arm64.whl", hash = "sha256:b4385285e9179d608ff1d2fb9922062663c658605819a6876d8beef0c30b7f3b"}, {file = "ruff-0.14.10-py3-none-win_amd64.whl", hash = "sha256:466297bd73638c6bdf06485683e812db1c00c7ac96d4ddd0294a338c62fdc154"},
{file = "ruff-0.11.13.tar.gz", hash = "sha256:26fa247dc68d1d4e72c179e08889a25ac0c7ba4d78aecfc835d49cbfd60bf514"}, {file = "ruff-0.14.10-py3-none-win_arm64.whl", hash = "sha256:e51d046cf6dda98a4633b8a8a771451107413b0f07183b2bef03f075599e44e6"},
] {file = "ruff-0.14.10.tar.gz", hash = "sha256:9a2e830f075d1a42cd28420d7809ace390832a490ed0966fe373ba288e77aaf4"},
[[package]]
name = "sniffio"
version = "1.3.1"
requires_python = ">=3.7"
summary = "Sniff out which async library your code is running under"
groups = ["default"]
files = [
{file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"},
{file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"},
]
[[package]]
name = "terminaltables3"
version = "4.0.0"
requires_python = ">=3.8"
summary = "Generate simple tables in terminals from a nested list of strings. Fork of terminaltables."
groups = ["default"]
files = [
{file = "terminaltables3-4.0.0-py3-none-any.whl", hash = "sha256:93b4c722f35400a7869cd630e2bbab616b129d1c47c628765c7f47baab2ca270"},
{file = "terminaltables3-4.0.0.tar.gz", hash = "sha256:4e3eefe209aa89005a0a34d1525739424569729ee29b5e64a8dd51c5ebdab77f"},
] ]
[[package]] [[package]]
name = "tox" name = "tox"
version = "4.26.0" version = "4.32.0"
requires_python = ">=3.9" requires_python = ">=3.10"
summary = "tox is a generic virtualenv management and test command line tool" summary = "tox is a generic virtualenv management and test command line tool"
groups = ["dev"] groups = ["dev"]
dependencies = [ dependencies = [
"cachetools>=5.5.1", "cachetools>=6.2",
"chardet>=5.2", "chardet>=5.2",
"colorama>=0.4.6", "colorama>=0.4.6",
"filelock>=3.16.1", "filelock>=3.20",
"packaging>=24.2", "packaging>=25",
"platformdirs>=4.3.6", "platformdirs>=4.5",
"pluggy>=1.5", "pluggy>=1.6",
"pyproject-api>=1.8", "pyproject-api>=1.9.1",
"tomli>=2.2.1; python_version < \"3.11\"", "tomli>=2.3; python_version < \"3.11\"",
"typing-extensions>=4.12.2; python_version < \"3.11\"", "typing-extensions>=4.15; python_version < \"3.11\"",
"virtualenv>=20.31", "virtualenv>=20.34",
] ]
files = [ files = [
{file = "tox-4.26.0-py3-none-any.whl", hash = "sha256:75f17aaf09face9b97bd41645028d9f722301e912be8b4c65a3f938024560224"}, {file = "tox-4.32.0-py3-none-any.whl", hash = "sha256:451e81dc02ba8d1ed20efd52ee409641ae4b5d5830e008af10fe8823ef1bd551"},
{file = "tox-4.26.0.tar.gz", hash = "sha256:a83b3b67b0159fa58e44e646505079e35a43317a62d2ae94725e0586266faeca"}, {file = "tox-4.32.0.tar.gz", hash = "sha256:1ad476b5f4d3679455b89a992849ffc3367560bbc7e9495ee8a3963542e7c8ff"},
] ]
[[package]] [[package]]
@@ -328,19 +344,19 @@ files = [
[[package]] [[package]]
name = "typing-extensions" name = "typing-extensions"
version = "4.14.0" version = "4.15.0"
requires_python = ">=3.9" requires_python = ">=3.9"
summary = "Backported and Experimental Type Hints for Python 3.9+" summary = "Backported and Experimental Type Hints for Python 3.9+"
groups = ["default"] groups = ["default"]
marker = "python_version < \"3.13\"" marker = "python_version < \"3.13\""
files = [ files = [
{file = "typing_extensions-4.14.0-py3-none-any.whl", hash = "sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af"}, {file = "typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"},
{file = "typing_extensions-4.14.0.tar.gz", hash = "sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4"}, {file = "typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"},
] ]
[[package]] [[package]]
name = "virtualenv" name = "virtualenv"
version = "20.31.2" version = "20.35.4"
requires_python = ">=3.8" requires_python = ">=3.8"
summary = "Virtual Python Environment builder" summary = "Virtual Python Environment builder"
groups = ["dev"] groups = ["dev"]
@@ -349,34 +365,35 @@ dependencies = [
"filelock<4,>=3.12.2", "filelock<4,>=3.12.2",
"importlib-metadata>=6.6; python_version < \"3.8\"", "importlib-metadata>=6.6; python_version < \"3.8\"",
"platformdirs<5,>=3.9.1", "platformdirs<5,>=3.9.1",
"typing-extensions>=4.13.2; python_version < \"3.11\"",
] ]
files = [ files = [
{file = "virtualenv-20.31.2-py3-none-any.whl", hash = "sha256:36efd0d9650ee985f0cad72065001e66d49a6f24eb44d98980f630686243cf11"}, {file = "virtualenv-20.35.4-py3-none-any.whl", hash = "sha256:c21c9cede36c9753eeade68ba7d523529f228a403463376cf821eaae2b650f1b"},
{file = "virtualenv-20.31.2.tar.gz", hash = "sha256:e10c0a9d02835e592521be48b332b6caee6887f332c111aa79a09b9e79efc2af"}, {file = "virtualenv-20.35.4.tar.gz", hash = "sha256:643d3914d73d3eeb0c552cbb12d7e82adf0e504dbf86a3182f8771a153a1971c"},
] ]
[[package]] [[package]]
name = "virtualenv-pyenv" name = "virtualenv-pyenv"
version = "0.5.0" version = "0.6.0"
requires_python = ">=3.8" requires_python = ">=3.9"
summary = "A virtualenv Python discovery plugin for pyenv-installed interpreters" summary = "A virtualenv Python discovery plugin for pyenv-installed interpreters"
groups = ["dev"] groups = ["dev"]
dependencies = [ dependencies = [
"pyenv-inspect<0.5,>=0.4", "pyenv-inspect<0.6,>=0.5",
"virtualenv", "virtualenv>=20.29.0",
] ]
files = [ files = [
{file = "virtualenv-pyenv-0.5.0.tar.gz", hash = "sha256:7b0e5fe3dfbdf484f4cf9b01e1f98111e398db6942237910f666356e6293597f"}, {file = "virtualenv_pyenv-0.6.0-py3-none-any.whl", hash = "sha256:182fc36893dbf731ccdbc762d2172091f43dab90136c7755520c459054342195"},
{file = "virtualenv_pyenv-0.5.0-py3-none-any.whl", hash = "sha256:21750247e36c55b3c547cfdeb08f51a3867fe7129922991a4f9c96980c0a4a5d"}, {file = "virtualenv_pyenv-0.6.0.tar.gz", hash = "sha256:d85a1d73349203ec6605a75b596ae494263c6c32fcdafcf74c9ddfbcfdcd9094"},
] ]
[[package]] [[package]]
name = "websocket-client" name = "websocket-client"
version = "1.8.0" version = "1.9.0"
requires_python = ">=3.8" requires_python = ">=3.9"
summary = "WebSocket client for Python with low level API options" summary = "WebSocket client for Python with low level API options"
groups = ["default"] groups = ["default"]
files = [ files = [
{file = "websocket_client-1.8.0-py3-none-any.whl", hash = "sha256:17b44cc997f5c498e809b22cdf2d9c7a9e71c02c8cc2b6c56e7c2d1239bfa526"}, {file = "websocket_client-1.9.0-py3-none-any.whl", hash = "sha256:af248a825037ef591efbf6ed20cc5faa03d3b47b9e5a2230a529eeee1c1fc3ef"},
{file = "websocket_client-1.8.0.tar.gz", hash = "sha256:3239df9f44da632f96012472805d40a23281a991027ce11d2f45a6f24ac4c3da"}, {file = "websocket_client-1.9.0.tar.gz", hash = "sha256:9e813624b6eb619999a97dc7958469217c3176312b3a16a4bd1bc7e08a46ec98"},
] ]

View File

@@ -2,7 +2,12 @@
name = "slobs-cli" name = "slobs-cli"
description = "A command line application for Streamlabs Desktop" description = "A command line application for Streamlabs Desktop"
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }] authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
dependencies = ["pyslobs>=2.0.5", "asyncclick>=8.1.8", "terminaltables3>=4.0.0"] dependencies = [
"pyslobs>=2.0.5",
"asyncclick>=8.1.8",
"rich>=14.0.0",
"anyio>=4.12.0",
]
requires-python = ">=3.11" requires-python = ">=3.11"
readme = "README.md" readme = "README.md"
license = { text = "MIT" } license = { text = "MIT" }
@@ -36,6 +41,8 @@ test.keep_going = true
fmt.cmd = "ruff format {args}" fmt.cmd = "ruff format {args}"
post_fmt.cmd = "ruff check {args}" post_fmt.cmd = "ruff check {args}"
completion.cmd = "task generate-completion-scripts"
[dependency-groups] [dependency-groups]
dev = [ dev = [
"tox-pdm>=0.7.2", "tox-pdm>=0.7.2",

View File

@@ -1,3 +1,3 @@
"""module for package metadata.""" """module for package metadata."""
__version__ = '0.10.0' __version__ = '0.11.5'

View File

@@ -3,8 +3,10 @@
import asyncclick as click import asyncclick as click
from anyio import create_task_group from anyio import create_task_group
from pyslobs import AudioService from pyslobs import AudioService
from terminaltables3 import AsciiTable from rich.table import Table
from rich.text import Text
from . import console, util
from .cli import cli from .cli import cli
from .errors import SlobsCliError from .errors import SlobsCliError
@@ -25,32 +27,40 @@ async def list(ctx: click.Context, id: bool = False):
async def _run(): async def _run():
sources = await as_.get_sources() sources = await as_.get_sources()
if not sources: if not sources:
click.echo('No audio sources found.') console.out.print('No audio sources found.')
conn.close() conn.close()
return return
table_data = [ style = ctx.obj['style']
['Audio Device Name', 'ID', 'Muted'] table = Table(
if id show_header=True, header_style=style.header, border_style=style.border
else ['Audio Device Name', 'Muted'] )
]
if id:
columns = [
('Audio Source Name', 'left'),
('Muted', 'center'),
('ID', 'left'),
]
else:
columns = [
('Audio Source Name', 'left'),
('Muted', 'center'),
]
for heading, justify in columns:
table.add_column(Text(heading, justify='center'), justify=justify)
for source in sources: for source in sources:
model = await source.get_model() model = await source.get_model()
to_append = [click.style(model.name, fg='blue')] to_append = [Text(model.name, style=style.cell)]
to_append.append(util.check_mark(ctx, model.muted))
if id: if id:
to_append.append(model.source_id) to_append.append(Text(model.source_id, style=style.cell))
to_append.append('' if model.muted else '')
table_data.append(to_append) table.add_row(*to_append)
table = AsciiTable(table_data) console.out.print(table)
table.justify_columns = {
0: 'left',
1: 'left' if id else 'center',
2: 'center' if id else None,
}
click.echo(table.table)
conn.close() conn.close()
@@ -78,7 +88,7 @@ async def mute(ctx: click.Context, source_name: str):
raise SlobsCliError(f'Audio source "{source_name}" not found.') raise SlobsCliError(f'Audio source "{source_name}" not found.')
await source.set_muted(True) await source.set_muted(True)
click.echo(f'{source_name} muted successfully.') console.out.print(f'{console.highlight(ctx, source_name)} muted successfully.')
conn.close() conn.close()
try: try:
@@ -109,7 +119,9 @@ async def unmute(ctx: click.Context, source_name: str):
raise SlobsCliError(f'Audio source "{source_name}" not found.') raise SlobsCliError(f'Audio source "{source_name}" not found.')
await source.set_muted(False) await source.set_muted(False)
click.echo(f'{source_name} unmuted successfully.') console.out.print(
f'{console.highlight(ctx, source_name)} unmuted successfully.'
)
conn.close() conn.close()
try: try:
@@ -136,10 +148,14 @@ async def toggle(ctx: click.Context, source_name: str):
if model.name.lower() == source_name.lower(): if model.name.lower() == source_name.lower():
if model.muted: if model.muted:
await source.set_muted(False) await source.set_muted(False)
click.echo(f'{source_name} unmuted successfully.') console.out.print(
f'{console.highlight(ctx, source_name)} unmuted successfully.'
)
else: else:
await source.set_muted(True) await source.set_muted(True)
click.echo(f'{source_name} muted successfully.') console.out.print(
f'{console.highlight(ctx, source_name)} muted successfully.'
)
conn.close() conn.close()
break break
else: # If no source by the given name was found else: # If no source by the given name was found
@@ -168,12 +184,12 @@ async def status(ctx: click.Context, source_name: str):
for source in sources: for source in sources:
model = await source.get_model() model = await source.get_model()
if model.name.lower() == source_name.lower(): if model.name.lower() == source_name.lower():
click.echo( console.out.print(
f'"{source_name}" is {"muted" if model.muted else "unmuted"}.' f'{console.highlight(ctx, source_name)} is {"muted" if model.muted else "unmuted"}.'
) )
conn.close() conn.close()
return return
else: else: # If no source by the given name was found
conn.close() conn.close()
raise SlobsCliError(f'Audio source "{source_name}" not found.') raise SlobsCliError(f'Audio source "{source_name}" not found.')

View File

@@ -4,10 +4,25 @@ import anyio
import asyncclick as click import asyncclick as click
from pyslobs import ConnectionConfig, SlobsConnection from pyslobs import ConnectionConfig, SlobsConnection
from . import styles
from .__about__ import __version__ as version from .__about__ import __version__ as version
@click.group() def validate_style(ctx: click.Context, param: click.Parameter, value: str) -> str:
"""Validate the style option."""
if value not in styles.registry:
raise click.BadParameter(
f"Invalid style '{value}'. Available styles: {', '.join(styles.registry.keys())}"
)
return value
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.group(
context_settings=CONTEXT_SETTINGS,
)
@click.option( @click.option(
'-d', '-d',
'--domain', '--domain',
@@ -15,7 +30,7 @@ from .__about__ import __version__ as version
envvar='SLOBS_DOMAIN', envvar='SLOBS_DOMAIN',
show_default=True, show_default=True,
show_envvar=True, show_envvar=True,
help='The domain of the SLOBS server.', help='\b\nStreamlabs Desktop WebSocket domain or IP address.\t',
) )
@click.option( @click.option(
'-p', '-p',
@@ -24,7 +39,7 @@ from .__about__ import __version__ as version
envvar='SLOBS_PORT', envvar='SLOBS_PORT',
show_default=True, show_default=True,
show_envvar=True, show_envvar=True,
help='The port of the SLOBS server.', help='\b\nStreamlabs Desktop WebSocket port.\t\t\t',
) )
@click.option( @click.option(
'-t', '-t',
@@ -32,13 +47,35 @@ from .__about__ import __version__ as version
envvar='SLOBS_TOKEN', envvar='SLOBS_TOKEN',
show_envvar=True, show_envvar=True,
required=True, required=True,
help='The token for the SLOBS server.', help='\b\nStreamlabs Desktop WebSocket authentication token.\t',
)
@click.option(
'-s',
'--style',
default='disabled',
envvar='SLOBS_STYLE',
show_default=True,
show_envvar=True,
help='\b\nThe style to use for output.\t\t\t\t',
callback=validate_style,
)
@click.option(
'-b',
'--no-border',
is_flag=True,
default=False,
envvar='SLOBS_STYLE_NO_BORDER',
show_default=True,
show_envvar=True,
help='\b\nDisable borders in the output.\t\t\t\t',
) )
@click.version_option( @click.version_option(
version, '-v', '--version', message='%(prog)s version: %(version)s' version, '-v', '--version', message='%(prog)s version: %(version)s'
) )
@click.pass_context @click.pass_context
async def cli(ctx: click.Context, domain: str, port: int, token: str): async def cli(
ctx: click.Context, domain: str, port: int, token: str, style: str, no_border: bool
):
"""Command line interface for Streamlabs Desktop.""" """Command line interface for Streamlabs Desktop."""
ctx.ensure_object(dict) ctx.ensure_object(dict)
config = ConnectionConfig( config = ConnectionConfig(
@@ -47,6 +84,7 @@ async def cli(ctx: click.Context, domain: str, port: int, token: str):
token=token, token=token,
) )
ctx.obj['connection'] = SlobsConnection(config) ctx.obj['connection'] = SlobsConnection(config)
ctx.obj['style'] = styles.request_style_obj(style, no_border)
def run(): def run():

17
src/slobs_cli/console.py Normal file
View File

@@ -0,0 +1,17 @@
"""module for console output handling."""
import asyncclick as click
from rich.console import Console
out = Console()
err = Console(stderr=True, style='bold red')
def highlight(ctx: click.Context, text: str) -> str:
"""Highlight text for console output."""
return f'[{ctx.obj["style"].highlight}]{text}[/{ctx.obj["style"].highlight}]'
def warning(ctx: click.Context, text: str) -> str:
"""Format warning text for console output."""
return f'[{ctx.obj["style"].warning}]{text}[/{ctx.obj["style"].warning}]'

View File

@@ -4,6 +4,8 @@ import json
import asyncclick as click import asyncclick as click
from . import console
class SlobsCliError(click.ClickException): class SlobsCliError(click.ClickException):
"""Base class for all Slobs CLI errors.""" """Base class for all Slobs CLI errors."""
@@ -14,8 +16,8 @@ class SlobsCliError(click.ClickException):
self.exit_code = 1 self.exit_code = 1
def show(self): def show(self):
"""Display the error message in red.""" """Display the error message in red and write to stderr."""
click.secho(f'Error: {self.message}', fg='red', err=True) console.err.print(f'Error: {self.message}')
class SlobsCliProtocolError(SlobsCliError): class SlobsCliProtocolError(SlobsCliError):
@@ -36,10 +38,8 @@ class SlobsCliProtocolError(SlobsCliError):
"""Display the protocol error message in red.""" """Display the protocol error message in red."""
match self.protocol_code: match self.protocol_code:
case -32600: case -32600:
click.secho( console.err.print(
'Oops! Looks like we hit a rate limit for this command. Please try again later.', 'Oops! Looks like we hit a rate limit for this command. Please try again later.'
fg='red',
err=True,
) )
case _: case _:
# Fall back to the base error display for unknown protocol codes # Fall back to the base error display for unknown protocol codes

View File

@@ -4,6 +4,7 @@ import asyncclick as click
from anyio import create_task_group from anyio import create_task_group
from pyslobs import StreamingService from pyslobs import StreamingService
from . import console
from .cli import cli from .cli import cli
from .errors import SlobsCliError from .errors import SlobsCliError
@@ -29,7 +30,7 @@ async def start(ctx: click.Context):
raise SlobsCliError('Recording is already active.') raise SlobsCliError('Recording is already active.')
await ss.toggle_recording() await ss.toggle_recording()
click.echo('Recording started.') console.out.print('Recording started.')
conn.close() conn.close()
@@ -58,7 +59,7 @@ async def stop(ctx: click.Context):
raise SlobsCliError('Recording is already inactive.') raise SlobsCliError('Recording is already inactive.')
await ss.toggle_recording() await ss.toggle_recording()
click.echo('Recording stopped.') console.out.print('Recording stopped.')
conn.close() conn.close()
@@ -83,9 +84,9 @@ async def status(ctx: click.Context):
active = model.recording_status != 'offline' active = model.recording_status != 'offline'
if active: if active:
click.echo('Recording is currently active.') console.out.print('Recording is currently active.')
else: else:
click.echo('Recording is currently inactive.') console.out.print('Recording is currently inactive.')
conn.close() conn.close()
@@ -107,9 +108,9 @@ async def toggle(ctx: click.Context):
await ss.toggle_recording() await ss.toggle_recording()
if active: if active:
click.echo('Recording stopped.') console.out.print('Recording stopped.')
else: else:
click.echo('Recording started.') console.out.print('Recording started.')
conn.close() conn.close()

View File

@@ -4,6 +4,7 @@ import asyncclick as click
from anyio import create_task_group from anyio import create_task_group
from pyslobs import StreamingService from pyslobs import StreamingService
from . import console
from .cli import cli from .cli import cli
from .errors import SlobsCliError from .errors import SlobsCliError
@@ -29,7 +30,7 @@ async def start(ctx: click.Context):
raise SlobsCliError('Replay buffer is already active.') raise SlobsCliError('Replay buffer is already active.')
await ss.start_replay_buffer() await ss.start_replay_buffer()
click.echo('Replay buffer started.') console.out.print('Replay buffer started.')
conn.close() conn.close()
try: try:
@@ -57,7 +58,7 @@ async def stop(ctx: click.Context):
raise SlobsCliError('Replay buffer is already inactive.') raise SlobsCliError('Replay buffer is already inactive.')
await ss.stop_replay_buffer() await ss.stop_replay_buffer()
click.echo('Replay buffer stopped.') console.out.print('Replay buffer stopped.')
conn.close() conn.close()
try: try:
@@ -80,9 +81,9 @@ async def status(ctx: click.Context):
model = await ss.get_model() model = await ss.get_model()
active = model.replay_buffer_status != 'offline' active = model.replay_buffer_status != 'offline'
if active: if active:
click.echo('Replay buffer is currently active.') console.out.print('Replay buffer is currently active.')
else: else:
click.echo('Replay buffer is currently inactive.') console.out.print('Replay buffer is currently inactive.')
conn.close() conn.close()
async with create_task_group() as tg: async with create_task_group() as tg:
@@ -99,7 +100,7 @@ async def save(ctx: click.Context):
async def _run(): async def _run():
await ss.save_replay() await ss.save_replay()
click.echo('Replay buffer saved.') console.out.print('Replay buffer saved.')
conn.close() conn.close()
async with create_task_group() as tg: async with create_task_group() as tg:

View File

@@ -3,8 +3,10 @@
import asyncclick as click import asyncclick as click
from anyio import create_task_group from anyio import create_task_group
from pyslobs import ProtocolError, ScenesService, TransitionsService from pyslobs import ProtocolError, ScenesService, TransitionsService
from terminaltables3 import AsciiTable from rich.table import Table
from rich.text import Text
from . import console, util
from .cli import cli from .cli import cli
from .errors import SlobsCliError, SlobsCliProtocolError from .errors import SlobsCliError, SlobsCliProtocolError
@@ -25,34 +27,45 @@ async def list(ctx: click.Context, id: bool = False):
async def _run(): async def _run():
scenes = await ss.get_scenes() scenes = await ss.get_scenes()
if not scenes: if not scenes:
click.echo('No scenes found.') console.out.print('No scenes found.')
conn.close() conn.close()
return return
active_scene = await ss.active_scene() active_scene = await ss.active_scene()
table_data = [ style = ctx.obj['style']
['Scene Name', 'ID', 'Active'] if id else ['Scene Name', 'Active'] table = Table(
] show_header=True,
header_style=style.header,
border_style=style.border,
)
if id:
columns = [
('Scene Name', 'left'),
('Active', 'center'),
('ID', 'left'),
]
else:
columns = [
('Scene Name', 'left'),
('Active', 'center'),
]
for heading, justify in columns:
table.add_column(Text(heading, justify='center'), justify=justify)
for scene in scenes: for scene in scenes:
if scene.id == active_scene.id: to_append = [Text(scene.name, style=style.cell)]
to_append = [click.style(scene.name, fg='green')] to_append.append(
else: util.check_mark(ctx, scene.id == active_scene.id, empty_if_false=True)
to_append = [click.style(scene.name, fg='blue')] )
if id: if id:
to_append.append(scene.id) to_append.append(Text(scene.id, style=style.cell))
if scene.id == active_scene.id:
to_append.append('')
table_data.append(to_append) table.add_row(*to_append)
table = AsciiTable(table_data) console.out.print(table)
table.justify_columns = {
0: 'left',
1: 'left' if id else 'center',
2: 'center' if id else None,
}
click.echo(table.table)
conn.close() conn.close()
@@ -76,9 +89,9 @@ async def current(ctx: click.Context, id: bool = False):
async def _run(): async def _run():
active_scene = await ss.active_scene() active_scene = await ss.active_scene()
click.echo( console.out.print(
f'Current active scene: {click.style(active_scene.name, fg="green")} ' f'Current active scene: {console.highlight(ctx, active_scene.name)} '
f'{f"(ID: {active_scene.id})" if id else ""}' f'{f"(ID: {console.highlight(ctx, active_scene.id)})" if id else ""}'
) )
conn.close() conn.close()
@@ -118,18 +131,21 @@ async def switch(
if model.studio_mode: if model.studio_mode:
await ss.make_scene_active(scene.id) await ss.make_scene_active(scene.id)
if preview: if preview:
click.echo( console.out.print(
f'Switched to preview scene: {click.style(scene.name, fg="blue")} ' f'Switched to preview scene: {console.highlight(ctx, scene.name)} '
f'{f"(ID: {scene.id})." if id else ""}' f'{f"(ID: {console.highlight(ctx, scene.id)})" if id else ""}'
) )
else: else:
click.echo( console.out.print(
f'Switched to scene: {click.style(scene.name, fg="blue")} ' f'Switched to scene: {console.highlight(ctx, scene.name)} '
f'{f"(ID: {scene.id})." if id else ""}' f'{f"(ID: {console.highlight(ctx, scene.id)})" if id else ""}'
) )
await ts.execute_studio_mode_transition() console.err.print(
click.echo( console.warning(
'Executed studio mode transition to make the scene active.' ctx,
'Warning: You are in studio mode. The scene switch is not active yet.\n'
'use `slobs-cli studiomode force-transition` to activate the scene switch.',
)
) )
else: else:
if preview: if preview:
@@ -139,9 +155,9 @@ async def switch(
) )
await ss.make_scene_active(scene.id) await ss.make_scene_active(scene.id)
click.echo( console.out.print(
f'Switched to scene: {click.style(scene.name, fg="blue")} ' f'Switched to scene: {console.highlight(ctx, scene.name)} '
f'{f"(ID: {scene.id})." if id else ""}' f'{f"(ID: {console.highlight(ctx, scene.id)})" if id else ""}'
) )
conn.close() conn.close()

View File

@@ -3,8 +3,10 @@
import asyncclick as click import asyncclick as click
from anyio import create_task_group from anyio import create_task_group
from pyslobs import ISceneCollectionCreateOptions, SceneCollectionsService from pyslobs import ISceneCollectionCreateOptions, SceneCollectionsService
from terminaltables3 import AsciiTable from rich.table import Table
from rich.text import Text
from . import console, util
from .cli import cli from .cli import cli
from .errors import SlobsCliError from .errors import SlobsCliError
@@ -25,35 +27,46 @@ async def list(ctx: click.Context, id: bool):
async def _run(): async def _run():
collections = await scs.collections() collections = await scs.collections()
if not collections: if not collections:
click.echo('No scene collections found.') console.out.print('No scene collections found.')
conn.close() conn.close()
return return
active_collection = await scs.active_collection() active_collection = await scs.active_collection()
table_data = [ style = ctx.obj['style']
['Scene Collection Name', 'ID', 'Active'] table = Table(
if id show_header=True,
else ['Scene Collection Name', 'Active'] header_style=style.header,
] border_style=style.border,
for collection in collections: )
if collection.id == active_collection.id:
to_append = [click.style(collection.name, fg='green')]
else:
to_append = [click.style(collection.name, fg='blue')]
if id:
to_append.append(collection.id)
if collection.id == active_collection.id:
to_append.append('')
table_data.append(to_append)
table = AsciiTable(table_data) if id:
table.justify_columns = { columns = [
0: 'left', ('Scene Collection Name', 'left'),
1: 'left' if id else 'center', ('Active', 'center'),
2: 'center' if id else None, ('ID', 'left'),
} ]
click.echo(table.table) else:
columns = [
('Scene Collection Name', 'left'),
('Active', 'center'),
]
for heading, justify in columns:
table.add_column(Text(heading, justify='center'), justify=justify)
for collection in collections:
to_append = [Text(collection.name, style=style.cell)]
to_append.append(
util.check_mark(
ctx, collection.id == active_collection.id, empty_if_false=True
)
)
if id:
to_append.append(Text(collection.id, style=style.cell))
table.add_row(*to_append)
console.out.print(table)
conn.close() conn.close()
@@ -80,7 +93,9 @@ async def load(ctx: click.Context, scenecollection_name: str):
raise SlobsCliError(f'Scene collection "{scenecollection_name}" not found.') raise SlobsCliError(f'Scene collection "{scenecollection_name}" not found.')
await scs.load(collection.id) await scs.load(collection.id)
click.echo(f'Scene collection "{scenecollection_name}" loaded successfully.') console.out.print(
f'Scene collection {console.highlight(scenecollection_name)} loaded successfully.'
)
conn.close() conn.close()
try: try:
@@ -102,7 +117,9 @@ async def create(ctx: click.Context, scenecollection_name: str):
async def _run(): async def _run():
await scs.create(ISceneCollectionCreateOptions(scenecollection_name)) await scs.create(ISceneCollectionCreateOptions(scenecollection_name))
click.echo(f'Scene collection "{scenecollection_name}" created successfully.') console.out.print(
f'Scene collection {console.highlight(scenecollection_name)} created successfully.'
)
conn.close() conn.close()
async with create_task_group() as tg: async with create_task_group() as tg:
@@ -128,7 +145,9 @@ async def delete(ctx: click.Context, scenecollection_name: str):
raise SlobsCliError(f'Scene collection "{scenecollection_name}" not found.') raise SlobsCliError(f'Scene collection "{scenecollection_name}" not found.')
await scs.delete(collection.id) await scs.delete(collection.id)
click.echo(f'Scene collection "{scenecollection_name}" deleted successfully.') console.out.print(
f'Scene collection {console.highlight(scenecollection_name)} deleted successfully.'
)
conn.close() conn.close()
try: try:
@@ -159,8 +178,8 @@ async def rename(ctx: click.Context, scenecollection_name: str, new_name: str):
raise SlobsCliError(f'Scene collection "{scenecollection_name}" not found.') raise SlobsCliError(f'Scene collection "{scenecollection_name}" not found.')
await scs.rename(new_name, collection.id) await scs.rename(new_name, collection.id)
click.echo( console.out.print(
f'Scene collection "{scenecollection_name}" renamed to "{new_name}".' f'Scene collection {console.highlight(scenecollection_name)} renamed to {console.highlight(new_name)}.'
) )
conn.close() conn.close()

View File

@@ -4,6 +4,7 @@ import asyncclick as click
from anyio import create_task_group from anyio import create_task_group
from pyslobs import StreamingService from pyslobs import StreamingService
from . import console
from .cli import cli from .cli import cli
from .errors import SlobsCliError from .errors import SlobsCliError
@@ -29,7 +30,7 @@ async def start(ctx: click.Context):
raise SlobsCliError('Stream is already active.') raise SlobsCliError('Stream is already active.')
await ss.toggle_streaming() await ss.toggle_streaming()
click.echo('Stream started.') console.out.print('Stream started.')
conn.close() conn.close()
try: try:
@@ -57,7 +58,7 @@ async def stop(ctx: click.Context):
raise SlobsCliError('Stream is already inactive.') raise SlobsCliError('Stream is already inactive.')
await ss.toggle_streaming() await ss.toggle_streaming()
click.echo('Stream stopped.') console.out.print('Stream stopped.')
conn.close() conn.close()
try: try:
@@ -81,9 +82,9 @@ async def status(ctx: click.Context):
active = model.streaming_status != 'offline' active = model.streaming_status != 'offline'
if active: if active:
click.echo('Stream is currently active.') console.out.print('Stream is currently active.')
else: else:
click.echo('Stream is currently inactive.') console.out.print('Stream is currently inactive.')
conn.close() conn.close()
async with create_task_group() as tg: async with create_task_group() as tg:
@@ -104,9 +105,9 @@ async def toggle(ctx: click.Context):
await ss.toggle_streaming() await ss.toggle_streaming()
if active: if active:
click.echo('Stream stopped.') console.out.print('Stream stopped.')
else: else:
click.echo('Stream started.') console.out.print('Stream started.')
conn.close() conn.close()

View File

@@ -4,6 +4,7 @@ import asyncclick as click
from anyio import create_task_group from anyio import create_task_group
from pyslobs import TransitionsService from pyslobs import TransitionsService
from . import console
from .cli import cli from .cli import cli
from .errors import SlobsCliError from .errors import SlobsCliError
@@ -27,7 +28,7 @@ async def enable(ctx: click.Context):
raise SlobsCliError('Studio mode is already enabled.') raise SlobsCliError('Studio mode is already enabled.')
await ts.enable_studio_mode() await ts.enable_studio_mode()
click.echo('Studio mode enabled successfully.') console.out.print('Studio mode enabled successfully.')
conn.close() conn.close()
try: try:
@@ -53,7 +54,7 @@ async def disable(ctx: click.Context):
raise SlobsCliError('Studio mode is already disabled.') raise SlobsCliError('Studio mode is already disabled.')
await ts.disable_studio_mode() await ts.disable_studio_mode()
click.echo('Studio mode disabled successfully.') console.out.print('Studio mode disabled successfully.')
conn.close() conn.close()
try: try:
@@ -75,9 +76,9 @@ async def status(ctx: click.Context):
async def _run(): async def _run():
model = await ts.get_model() model = await ts.get_model()
if model.studio_mode: if model.studio_mode:
click.echo('Studio mode is currently enabled.') console.out.print('Studio mode is currently enabled.')
else: else:
click.echo('Studio mode is currently disabled.') console.out.print('Studio mode is currently disabled.')
conn.close() conn.close()
async with create_task_group() as tg: async with create_task_group() as tg:
@@ -96,10 +97,10 @@ async def toggle(ctx: click.Context):
model = await ts.get_model() model = await ts.get_model()
if model.studio_mode: if model.studio_mode:
await ts.disable_studio_mode() await ts.disable_studio_mode()
click.echo('Studio mode disabled successfully.') console.out.print('Studio mode disabled successfully.')
else: else:
await ts.enable_studio_mode() await ts.enable_studio_mode()
click.echo('Studio mode enabled successfully.') console.out.print('Studio mode enabled successfully.')
conn.close() conn.close()
async with create_task_group() as tg: async with create_task_group() as tg:
@@ -121,7 +122,7 @@ async def force_transition(ctx: click.Context):
raise SlobsCliError('Studio mode is not enabled.') raise SlobsCliError('Studio mode is not enabled.')
await ts.execute_studio_mode_transition() await ts.execute_studio_mode_transition()
click.echo('Forced studio mode transition.') console.out.print('Forced studio mode transition.')
conn.close() conn.close()
try: try:

211
src/slobs_cli/styles.py Normal file
View File

@@ -0,0 +1,211 @@
"""module containing style management for Slobs CLI."""
import os
from dataclasses import dataclass
registry = {}
def register_style(cls):
"""Register a style class."""
key = cls.__name__.lower()
if key in registry:
raise ValueError(f'Style {key} is already registered.')
registry[key] = cls
return cls
@dataclass
class Style:
"""Base class for styles."""
name: str
border: str
header: str
cell: str
highlight: str
warning: str
no_border: bool = False
def __post_init__(self):
"""Post-initialization to set default values and normalize the name."""
self.name = self.name.lower()
if self.no_border:
self.border = None
@register_style
@dataclass
class Disabled(Style):
"""Disabled style."""
name: str = 'disabled'
header: str = ''
border: str = 'none'
cell: str = 'none'
highlight: str = 'none'
warning: str = 'none'
@register_style
@dataclass
class Red(Style):
"""Red style."""
name: str = 'red'
header: str = ''
border: str = 'dark_red'
cell: str = 'red'
highlight: str = 'red3'
warning: str = 'magenta'
@register_style
@dataclass
class Magenta(Style):
"""Magenta style."""
name: str = 'magenta'
header: str = ''
border: str = 'dark_magenta'
cell: str = 'magenta'
highlight: str = 'magenta3'
warning: str = 'magenta'
@register_style
@dataclass
class Purple(Style):
"""Purple style."""
name: str = 'purple'
header: str = ''
border: str = 'purple'
cell: str = 'medium_orchid'
highlight: str = 'medium_orchid'
warning: str = 'magenta'
@register_style
@dataclass
class Blue(Style):
"""Blue style."""
name: str = 'blue'
header: str = ''
border: str = 'dark_blue'
cell: str = 'blue'
highlight: str = 'blue3'
warning: str = 'magenta'
@register_style
@dataclass
class Cyan(Style):
"""Cyan style."""
name: str = 'cyan'
header: str = ''
border: str = 'dark_cyan'
cell: str = 'cyan'
highlight: str = 'cyan3'
warning: str = 'magenta'
@register_style
@dataclass
class Green(Style):
"""Green style."""
name: str = 'green'
header: str = ''
border: str = 'dark_green'
cell: str = 'green'
highlight: str = 'green3'
warning: str = 'magenta'
@register_style
@dataclass
class Yellow(Style):
"""Yellow style."""
name: str = 'yellow'
header: str = ''
border: str = 'yellow3'
cell: str = 'wheat1'
highlight: str = 'yellow3'
warning: str = 'magenta'
@register_style
@dataclass
class Orange(Style):
"""Orange style."""
name: str = 'orange'
header: str = ''
border: str = 'dark_orange'
cell: str = 'orange'
highlight: str = 'orange3'
warning: str = 'magenta'
@register_style
@dataclass
class White(Style):
"""White style."""
name: str = 'white'
header: str = ''
border: str = 'white'
cell: str = 'white'
highlight: str = 'white'
warning: str = 'magenta'
@register_style
@dataclass
class Grey(Style):
"""Grey style."""
name: str = 'grey'
header: str = ''
border: str = 'grey50'
cell: str = 'grey70'
highlight: str = 'grey90'
warning: str = 'magenta'
@register_style
@dataclass
class Navy(Style):
"""Navy style."""
name: str = 'navy'
header: str = ''
border: str = 'deep_sky_blue4'
cell: str = 'light_sky_blue3'
highlight: str = 'light_sky_blue3'
warning: str = 'magenta'
@register_style
@dataclass
class Black(Style):
"""Black style."""
name: str = 'black'
header: str = ''
border: str = 'black'
cell: str = 'grey30'
highlight: str = 'grey30'
warning: str = 'magenta'
def request_style_obj(style_name: str, no_border: bool) -> Style:
"""Request a style object by name."""
if style_name == 'disabled':
os.environ['NO_COLOR'] = '1'
return registry[style_name.lower()](no_border=no_border)

19
src/slobs_cli/util.py Normal file
View File

@@ -0,0 +1,19 @@
"""module containing utility functions for Slobs CLI."""
import os
import asyncclick as click
def check_mark(ctx: click.Context, value: bool, empty_if_false: bool = False) -> str:
"""Return a check mark or cross mark based on the boolean value."""
if empty_if_false and not value:
return ''
# rich gracefully handles the absence of colour throughout the rest of the application,
# but here we must handle it manually.
# If NO_COLOR is set, we return plain text symbols.
# Otherwise, we return coloured symbols.
if os.getenv('NO_COLOR', '') != '':
return '' if value else ''
return '' if value else ''

View File

@@ -9,7 +9,13 @@ import os
import anyio import anyio
from anyio import create_task_group from anyio import create_task_group
from pyslobs import ConnectionConfig, ScenesService, SlobsConnection, StreamingService from pyslobs import (
ConnectionConfig,
ScenesService,
SlobsConnection,
StreamingService,
TransitionsService,
)
async def cleanup(conn: SlobsConnection): async def cleanup(conn: SlobsConnection):
@@ -29,6 +35,11 @@ async def cleanup(conn: SlobsConnection):
if model.recording_status != 'offline': if model.recording_status != 'offline':
await ss.toggle_recording() await ss.toggle_recording()
ts = TransitionsService(conn)
model = await ts.get_model()
if model.studio_mode:
await ts.disable_studio_mode()
conn.close() conn.close()