From 84d716b2ad2f944e9177fdb1353235ca78726c8a Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sun, 1 Mar 2026 17:58:08 +0000 Subject: [PATCH] add command subcommand group --- src/vban_cli/app.py | 3 ++- src/vban_cli/command.py | 49 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 src/vban_cli/command.py diff --git a/src/vban_cli/app.py b/src/vban_cli/app.py index 0ee0298..c04b6dc 100644 --- a/src/vban_cli/app.py +++ b/src/vban_cli/app.py @@ -5,7 +5,7 @@ import vban_cmd from cyclopts import App, Argument, Parameter, config from . import __version__ as version -from . import bus, console, strip +from . import bus, command, console, strip from .context import Context app = App( @@ -16,6 +16,7 @@ app = App( ) app.command(strip.app.meta, name='strip') app.command(bus.app.meta, name='bus') +app.command(command.app, name='command') app.register_install_completion_command() diff --git a/src/vban_cli/command.py b/src/vban_cli/command.py new file mode 100644 index 0000000..34a0fb3 --- /dev/null +++ b/src/vban_cli/command.py @@ -0,0 +1,49 @@ +from typing import Annotated + +from cyclopts import App, Parameter + +from . import console +from .context import Context +from .help import BaseHelpFormatter + +app = App(name='command', help_formatter=BaseHelpFormatter()) + + +@app.command(name='show') +def show( + *, + ctx: Annotated[Context, Parameter(show=False)] = None, +): + """Bring the Voicemeeter GUI to the foreground.""" + ctx.client.command.show() + console.out.print('Voicemeeter GUI should now be in the foreground.') + + +@app.command(name='hide') +def hide( + *, + ctx: Annotated[Context, Parameter(show=False)] = None, +): + """Send the Voicemeeter GUI to the background.""" + ctx.client.command.hide() + console.out.print('Voicemeeter GUI should now be in the background.') + + +@app.command(name='shutdown') +def shutdown( + *, + ctx: Annotated[Context, Parameter(show=False)] = None, +): + """Shut down Voicemeeter.""" + ctx.client.command.shutdown() + console.out.print('Voicemeeter should now be shut down.') + + +@app.command(name='restart') +def restart( + *, + ctx: Annotated[Context, Parameter(show=False)] = None, +): + """Restart the Voicemeeter engine.""" + ctx.client.command.restart() + console.out.print('Voicemeeter engine should now be restarting.')