1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-09-27 09:55:23 +00:00

Help now accepts command shortcuts.

This commit is contained in:
Mike Naberezny 2009-08-22 13:12:26 -07:00
parent 4245b24a40
commit 2b25cc9f90
2 changed files with 19 additions and 0 deletions

View File

@ -124,6 +124,10 @@ class Monitor(cmd.Cmd):
if stuff is not None:
self.stdout.write(stuff + "\n")
def do_help(self, args):
args = self._shortcuts.get(args.strip(), args)
return cmd.Cmd.do_help(self, args)
def help_version(self):
self._output("version\t\tDisplay Py65 version information.")

View File

@ -99,6 +99,21 @@ class MonitorTests(unittest.TestCase):
out = stdout.getvalue()
self.assertTrue(out.startswith("assemble <address>"))
# help
def test_help_accepts_command_shortcuts(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)
mon.onecmd("help assemble \t ")
help_for_command = stdout.getvalue()
stdout.truncate(0)
mon.onecmd("help a \t ")
help_for_shortcut = stdout.getvalue()
self.assertEqual(help_for_command, help_for_shortcut)
# mpu
def test_mpu_with_no_args_prints_current_lists_available_mpus(self):