Mercurial > sqlpython
diff cmd2.py @ 39:5d29e6a21c6f
ready to package cmd2
author | devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil |
---|---|
date | Thu, 03 Jan 2008 13:48:50 -0500 |
parents | ed1f390c142d |
children |
line wrap: on
line diff
--- a/cmd2.py Thu Jan 03 13:23:06 2008 -0500 +++ b/cmd2.py Thu Jan 03 13:48:50 2008 -0500 @@ -12,10 +12,11 @@ todo: edited commands end with "EOF". Hmm. -flags -> +example of flag usage +> to dump to file """ import cmd, re, os, sys +import flagReader class Cmd(cmd.Cmd): caseInsensitive = True @@ -46,6 +47,11 @@ cmd.Cmd.__init__(self, *args, **kwargs) self.history = History() + def do_shortcuts(self, args): + """Lists single-key shortcuts available.""" + result = "\n".join('%s: %s' % (sc[0], sc[1]) for sc in self.shortcuts.items()) + self.stdout.write("Single-key shortcuts for other commands:\n%s\n" % (result)) + def onecmd(self, line): """Interpret the argument as though it had been typed in response to the prompt.