Skip to content

Commit c59a4c9

Browse files
committed
Enable listing of devices without list-devices subcommand
1 parent f442494 commit c59a4c9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/labelle/cli/cli.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ def get_device_manager() -> DeviceManager:
8888
return device_manager
8989

9090

91-
app = typer.Typer()
92-
93-
94-
@app.command(hidden=True)
9591
def list_devices() -> NoReturn:
9692
device_manager = get_device_manager()
9793
console = Console()
@@ -105,6 +101,9 @@ def list_devices() -> NoReturn:
105101
raise typer.Exit()
106102

107103

104+
app = typer.Typer()
105+
106+
108107
@app.callback(invoke_without_command=True)
109108
def default(
110109
ctx: typer.Context,
@@ -123,7 +122,8 @@ def default(
123122
"--device",
124123
help=(
125124
"Select a particular device by filtering for a given substring "
126-
"in the device's manufacturer, product or serial number"
125+
"in the device's manufacturer, product or serial number. "
126+
'Use "--device list" to list all available devices.'
127127
),
128128
rich_help_panel="Device Configuration",
129129
),
@@ -378,6 +378,9 @@ def default(
378378
# Neither --verbose flag nor the environment variable is set.
379379
set_not_verbose()
380380

381+
if device_pattern == ["list"]:
382+
list_devices()
383+
381384
# Raise informative errors with old dymoprint arguments
382385
if preview:
383386
raise typer.BadParameter(

0 commit comments

Comments
 (0)