Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAVExplorer: added "help FUNCTION" #1232

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions MAVProxy/tools/MAVExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,28 @@ def print_caught_exception(e):
else:
print(traceback.format_exc(e))

def cmd_help(args):
'''help command'''
if len(args) == 0:
k = command_map.keys()
for cmd in sorted(k):
(fn, help) = command_map[cmd]
print("%-15s : %s" % (cmd, help))
return
cmd = args[0]
if cmd in command_map.keys():
(fn, help) = command_map[cmd]
print("%-15s : %s" % (cmd, help))
return
import pymavlink.mavextra as mavextra
import math
import pydoc
for v in [mavextra,math]:
if hasattr(v,cmd):
pydoc.help(getattr(v,cmd))
return
print("%s not found" % cmd)

def process_stdin(line):
'''handle commands from user'''
if line is None:
Expand All @@ -1237,10 +1259,7 @@ def process_stdin(line):

cmd = args[0]
if cmd == 'help':
k = command_map.keys()
for cmd in sorted(k):
(fn, help) = command_map[cmd]
print("%-15s : %s" % (cmd, help))
cmd_help(args[1:])
return
if cmd == 'exit':
mestate.exit = True
Expand Down