46
46
except ImportError :
47
47
pass
48
48
49
- webcli = typer .Typer ()
50
-
51
49
52
50
@cli .callback (invoke_without_command = True , no_args_is_help = True )
53
51
def precommand_callback (
@@ -86,25 +84,7 @@ def precommand_callback(
86
84
help = "Time out command in seconds." ,
87
85
),
88
86
) -> None :
89
- """Control USB connected presence lights.
90
-
91
- :param ctx: Typer context for sharing state between commands
92
- :param debug: Enable debug logging output
93
- :param targets: Comma-separated list of light indices to target
94
- :param all_lights: Override target selection to use all lights
95
- :param dim: Brightness percentage from 0-100
96
- :param timeout: Maximum operation duration in seconds
97
-
98
- This callback function processes global CLI options and sets up the
99
- application state before any subcommand runs. It handles:
100
-
101
- - Parsing light target specifications
102
- - Configuring logging based on debug flag
103
- - Setting up the global options object
104
- - Special handling for the 'list' command with no targets
105
-
106
- The function exits with help text if no subcommand is specified.
107
- """
87
+ """Control USB connected presence lights."""
108
88
(logger .enable if debug else logger .disable )("busylight" )
109
89
110
90
options = ctx .ensure_object (GlobalOptions )
@@ -117,13 +97,10 @@ def precommand_callback(
117
97
if ctx .invoked_subcommand == "list" and targets is None :
118
98
all_lights = True
119
99
120
- # Parse light targets - simple conversion for now
121
100
if targets :
122
- # Convert comma-separated string to list of indices
123
101
try :
124
102
options .lights = [int (x .strip ()) for x in targets .split ("," )]
125
103
except ValueError :
126
- # If parsing fails, use empty list (all lights)
127
104
options .lights = []
128
105
129
106
logger .info (f"version { __version__ } " )
0 commit comments