Allow passing lists as comma-delimited strings
Make configs optionally a bit less verbose (esp. if passed on the
command line) by allowing lists to be passed as comma delimited strings.
In particular, this means that something like
--probe='tracing:{categories:["foo","bar"]}'
can be shortened to
--probe='tracing:{categories:"foo,bar"}'
and is a bit more amenable to copy and paste from lists of categories.
Change-Id: Id3d567c1ed21ade3442409c36e92bf2f6aacb45c
Reviewed-on: https://chromium-review.googlesource.com/c/crossbench/+/5331662
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
diff --git a/crossbench/config.py b/crossbench/config.py
index 4f6c123..e672c46 100644
--- a/crossbench/config.py
+++ b/crossbench/config.py
@@ -288,6 +288,8 @@
def parse_list_data(self, data: Any,
depending_kwargs: Dict[str, Any]) -> List[Any]:
+ if isinstance(data, str):
+ data = data.split(",")
if not isinstance(data, (list, tuple)):
raise ValueError(f"{self.cls_name}.{self.name}: "
f"Expected sequence got {type(data)}")