Skip to content

Commit

Permalink
param_help.py: pretty-print Bitmask in eg. 'param help GUID_OPTIONS' …
Browse files Browse the repository at this point in the history
…output
  • Loading branch information
peterbarker committed Sep 24, 2024
1 parent 6eaee8f commit 4cabd74
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions MAVProxy/modules/lib/param_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ def param_help(self, args):
try:
print("\n")
for f in help.field:
if f.get('name') == 'Bitmask':
# handled specially below
continue
print("%s : %s" % (f.get('name'), str(f)))
except Exception as e:
pass
Expand All @@ -177,6 +180,16 @@ def param_help(self, args):
except Exception as e:
print("Caught exception %s" % repr(e))
pass
try:
# note this is a dictionary:
values = self.get_bitmask_from_help(help)
if values is not None and len(values):
print("\nBitmask: ")
for (n, v) in values.items():
print(f"\t{int(n):3d} : {v}")
except Exception as e:
print("Caught exception %s" % repr(e))
pass
else:
print("Parameter '%s' not found in documentation" % h)

Expand Down

0 comments on commit 4cabd74

Please sign in to comment.