File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
custom_components/uk_bin_collection Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -283,15 +283,28 @@ def build_ukbcd_args(config_data: dict) -> list:
283
283
"""Build the argument list for UKBinCollectionApp from config data."""
284
284
council = config_data .get ("original_parser" ) or config_data .get ("council" , "" )
285
285
url = config_data .get ("url" , "" )
286
-
287
286
args = [council , url ]
288
287
288
+ # Per-key formatters: return a list of CLI args for that key
289
+ def _format_headless (v ):
290
+ return ["--headless" ] if v else ["--not-headless" ]
291
+
292
+ def _format_web_driver (v ):
293
+ return [f"--web_driver={ v .rstrip ('/' )} " ] if v is not None else []
294
+
295
+ formatters = {
296
+ "headless" : _format_headless ,
297
+ "web_driver" : _format_web_driver ,
298
+ }
299
+
289
300
for key , value in config_data .items ():
290
301
if key in EXCLUDED_ARG_KEYS :
291
302
continue
292
- if key == "web_driver" and value is not None :
293
- value = value .rstrip ("/" )
294
- args .append (f"--{ key } ={ value } " )
303
+ fmt = formatters .get (key )
304
+ if fmt :
305
+ args .extend (fmt (value ))
306
+ else :
307
+ args .append (f"--{ key } ={ value } " )
295
308
296
309
return args
297
310
Original file line number Diff line number Diff line change 31
31
"council" ,
32
32
"url" ,
33
33
"skip_get_url" ,
34
- "headless" ,
35
34
"local_browser" ,
36
35
"timeout" ,
37
36
"icon_color_mapping" ,
You can’t perform that action at this time.
0 commit comments