mirror of
https://github.com/onyx-and-iris/vban-cli.git
synced 2026-03-02 21:19:11 +00:00
remove StripSubcommandHelpFormatter, StripHelpFormatter now handles commands + command groups.
This commit is contained in:
parent
c642bbc1f2
commit
b3cfc6bc4a
@ -5,11 +5,7 @@ description = "A command-line interface for Voicemeeter leveraging VBAN."
|
|||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { text = "LICENSE" }
|
license = { text = "LICENSE" }
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
dependencies = [
|
dependencies = ["cyclopts>=4.6.0", "loguru>=0.7.3", "vban-cmd>=2.6.0"]
|
||||||
"cyclopts>=4.6.0",
|
|
||||||
"loguru>=0.7.3",
|
|
||||||
"vban-cmd>=2.6.0",
|
|
||||||
]
|
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 3 - Alpha",
|
"Development Status :: 3 - Alpha",
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
@ -28,4 +24,4 @@ vban-cli = "vban_cli.app:run"
|
|||||||
package = true
|
package = true
|
||||||
|
|
||||||
[tool.uv.sources]
|
[tool.uv.sources]
|
||||||
vban-cmd = { path = "../vban-cmd-python" }
|
vban-cmd = { path = "../vban-cmd-python", editable = true }
|
||||||
|
|||||||
@ -3,9 +3,9 @@ from typing import Annotated
|
|||||||
from cyclopts import App, Argument, Parameter
|
from cyclopts import App, Argument, Parameter
|
||||||
|
|
||||||
from .context import Context
|
from .context import Context
|
||||||
from .help import StripSubcommandHelpFormatter
|
from .help import StripHelpFormatter
|
||||||
|
|
||||||
app = App(name='comp', help_formatter=StripSubcommandHelpFormatter())
|
app = App(name='comp', help_formatter=StripHelpFormatter())
|
||||||
|
|
||||||
|
|
||||||
@app.meta.default
|
@app.meta.default
|
||||||
|
|||||||
@ -3,9 +3,9 @@ from typing import Annotated
|
|||||||
from cyclopts import App, Argument, Parameter
|
from cyclopts import App, Argument, Parameter
|
||||||
|
|
||||||
from .context import Context
|
from .context import Context
|
||||||
from .help import StripSubcommandHelpFormatter
|
from .help import StripHelpFormatter
|
||||||
|
|
||||||
app = App(name='denoiser', help_formatter=StripSubcommandHelpFormatter())
|
app = App(name='denoiser', help_formatter=StripHelpFormatter())
|
||||||
|
|
||||||
|
|
||||||
@app.meta.default
|
@app.meta.default
|
||||||
|
|||||||
@ -3,9 +3,9 @@ from typing import Annotated
|
|||||||
from cyclopts import App, Argument, Parameter
|
from cyclopts import App, Argument, Parameter
|
||||||
|
|
||||||
from .context import Context
|
from .context import Context
|
||||||
from .help import StripSubcommandHelpFormatter
|
from .help import StripHelpFormatter
|
||||||
|
|
||||||
app = App(name='gate', help_formatter=StripSubcommandHelpFormatter())
|
app = App(name='gate', help_formatter=StripHelpFormatter())
|
||||||
|
|
||||||
|
|
||||||
@app.meta.default
|
@app.meta.default
|
||||||
|
|||||||
@ -61,18 +61,6 @@ class StripHelpFormatter(BaseHelpFormatter):
|
|||||||
console.print(f'[bold]Usage:[/bold] {modified_usage}')
|
console.print(f'[bold]Usage:[/bold] {modified_usage}')
|
||||||
|
|
||||||
|
|
||||||
class StripSubcommandHelpFormatter(BaseHelpFormatter):
|
|
||||||
"""Help formatter for strip subcommands that injects <index> after 'strip'."""
|
|
||||||
|
|
||||||
def render_usage(self, console: Console, options: ConsoleOptions, usage) -> None:
|
|
||||||
"""Render the usage line with index argument injected after 'strip'."""
|
|
||||||
if usage:
|
|
||||||
modified_usage = re.sub(
|
|
||||||
r'(\S+\s+strip)\s+(\w+)\s+(COMMAND)', r'\1 <index> \2 \3', str(usage)
|
|
||||||
)
|
|
||||||
console.print(f'[bold]Usage:[/bold] {modified_usage}')
|
|
||||||
|
|
||||||
|
|
||||||
class BusHelpFormatter(BaseHelpFormatter):
|
class BusHelpFormatter(BaseHelpFormatter):
|
||||||
"""Help formatter for bus commands that injects <index> after 'bus'."""
|
"""Help formatter for bus commands that injects <index> after 'bus'."""
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user