Skip to content

Commit 4ca13bc

Browse files
committed
fix setting of list item on configure
When setting the whole configuration via --configure, list types like adminKey need special handling. Previously this failed as a list cannot be appended to a list. The new code adds dedicated logic to replace the repeated value when passing a list. Also, all items of that list are converted into the correct (typed) form before setting them.
1 parent 6ceae7c commit 4ca13bc

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

meshtastic/__main__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ def setPref(config, comp_name, raw_val) -> bool:
241241
# The setter didn't like our arg type guess try again as a string
242242
config_values = getattr(config_part, config_type.name)
243243
setattr(config_values, pref.name, str(val))
244+
elif type(val) == list:
245+
new_vals = [meshtastic.util.fromStr(x) for x in val]
246+
config_values = getattr(config, config_type.name)
247+
getattr(config_values, pref.name)[:] = new_vals
244248
else:
245249
config_values = getattr(config, config_type.name)
246250
if val == 0:

0 commit comments

Comments
 (0)