mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-05-16 06:20:23 +01:00
enable no_args_is_help for all typers subclassing AliasGroup
This includes the root typer patch bump
This commit is contained in:
parent
d945a6fa40
commit
023fdf708b
@ -1,4 +1,4 @@
|
|||||||
# SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online>
|
# SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
__version__ = "0.6.6"
|
__version__ = "0.6.7"
|
||||||
|
@ -10,6 +10,11 @@ class AliasGroup(typer.core.TyperGroup):
|
|||||||
|
|
||||||
_CMD_SPLIT_P = re.compile(r' ?[,|] ?')
|
_CMD_SPLIT_P = re.compile(r' ?[,|] ?')
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
"""Initialize the AliasGroup."""
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
self.no_args_is_help = True
|
||||||
|
|
||||||
def get_command(self, ctx, cmd_name):
|
def get_command(self, ctx, cmd_name):
|
||||||
"""Get a command by name."""
|
"""Get a command by name."""
|
||||||
cmd_name = self._group_cmd_name(cmd_name)
|
cmd_name = self._group_cmd_name(cmd_name)
|
||||||
|
@ -9,6 +9,7 @@ from pydantic import ConfigDict
|
|||||||
from pydantic_settings import BaseSettings
|
from pydantic_settings import BaseSettings
|
||||||
|
|
||||||
from . import group, input, record, scene, scenecollection, sceneitem, stream
|
from . import group, input, record, scene, scenecollection, sceneitem, stream
|
||||||
|
from .alias import AliasGroup
|
||||||
|
|
||||||
|
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
@ -29,7 +30,7 @@ class Settings(BaseSettings):
|
|||||||
TIMEOUT: int = 5 # Timeout for requests in seconds
|
TIMEOUT: int = 5 # Timeout for requests in seconds
|
||||||
|
|
||||||
|
|
||||||
app = typer.Typer()
|
app = typer.Typer(cls=AliasGroup)
|
||||||
app.add_typer(scene.app, name='scene')
|
app.add_typer(scene.app, name='scene')
|
||||||
app.add_typer(sceneitem.app, name='scene-item')
|
app.add_typer(sceneitem.app, name='scene-item')
|
||||||
app.add_typer(group.app, name='group')
|
app.add_typer(group.app, name='group')
|
||||||
|
@ -39,7 +39,7 @@ obsws-cli = "obsws_cli:app"
|
|||||||
path = "obsws_cli/__about__.py"
|
path = "obsws_cli/__about__.py"
|
||||||
|
|
||||||
[tool.hatch.envs.default.scripts]
|
[tool.hatch.envs.default.scripts]
|
||||||
cli = "obsws-cli {args:obsws_cli}"
|
cli = "obsws-cli {args:}"
|
||||||
test = "pytest {args:obsws_cli tests}"
|
test = "pytest {args:obsws_cli tests}"
|
||||||
|
|
||||||
[tool.hatch.envs.hatch-test]
|
[tool.hatch.envs.hatch-test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user