Skip to content

Commit

Permalink
do not double-print value when setting a repeated value
Browse files Browse the repository at this point in the history
When clearning or appending to a repeated value, both the "Clearing..."
/ "Adding..." line and the "Set..." line were shown. However, this is
misleading as the only performed operation is the clearing / appending.

We fix this by directly returning from the function in case of clearing
/ appending.
  • Loading branch information
fmoessbauer committed Oct 25, 2024
1 parent d393051 commit e69b2e6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions meshtastic/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ def setPref(config, comp_name, raw_val) -> bool:
cur_vals = [x for x in getattr(config_values, pref.name) if x not in [0, "", b""]]
cur_vals.append(val)
getattr(config_values, pref.name)[:] = cur_vals
return True

prefix = f"{'.'.join(name[0:-1])}." if config_type.message_type is not None else ""
print(f"Set {prefix}{uni_name} to {raw_val}")
Expand Down

0 comments on commit e69b2e6

Please sign in to comment.