Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/labelle/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ def get_device_manager() -> DeviceManager:
return device_manager


app = typer.Typer()


@app.command(hidden=True)
def list_devices() -> NoReturn:
device_manager = get_device_manager()
console = Console()
Expand All @@ -105,6 +101,9 @@ def list_devices() -> NoReturn:
raise typer.Exit()


app = typer.Typer()


@app.callback(invoke_without_command=True)
def default(
ctx: typer.Context,
Expand All @@ -123,7 +122,8 @@ def default(
"--device",
help=(
"Select a particular device by filtering for a given substring "
"in the device's manufacturer, product or serial number"
"in the device's manufacturer, product or serial number. "
'Use "--device list" to list all available devices.'
),
rich_help_panel="Device Configuration",
),
Expand Down Expand Up @@ -378,6 +378,9 @@ def default(
# Neither --verbose flag nor the environment variable is set.
set_not_verbose()

if device_pattern == ["list"]:
list_devices()

# Raise informative errors with old dymoprint arguments
if preview:
raise typer.BadParameter(
Expand Down