diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-07-03 17:22:16 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-07-03 17:22:16 -0400 |
commit | 29eeb8996053f35572f4d7b63e7c8cb0f62b6442 (patch) | |
tree | d5ea2e52b6e3a09f54731aa4858370cdcbcb6e75 /cmd2.py | |
parent | b06c95b721b7a1096ce78ec3a96726cdbe7026ad (diff) | |
download | cmd2-git-29eeb8996053f35572f4d7b63e7c8cb0f62b6442.tar.gz |
Removed pause command
It was pretty useless, it just printed a message and sat there and waited for the user to hit enter.
It didn't feel like it belonged in a top-level framework. If a particular application wants this functionality, it is a 2 line change to add it back.
Diffstat (limited to 'cmd2.py')
-rwxr-xr-x | cmd2.py | 43 |
1 files changed, 33 insertions, 10 deletions
@@ -1128,13 +1128,6 @@ class Cmd(cmd.Cmd): except (ValueError, AttributeError): self.do_show(arg) - # noinspection PyMethodMayBeStatic - def do_pause(self, text): - """Displays the specified text then waits for the user to press <Enter>. - - Usage: pause [text]""" - sm.input(text + '\n') - def do_shell(self, command): """Execute a command as if at the OS prompt. @@ -2276,7 +2269,37 @@ class CmdResult(namedtuple_with_two_defaults('CmdResult', ['out', 'err', 'war']) if __name__ == '__main__': # If run as the main application, simply start a bare-bones cmd2 application with only built-in functionality. - # But enable the ipy command if IPython is installed, which supports advanced interactive debugging of your app, - # via introspection on self. - app = Cmd(use_ipython=True) + + # Set this to True to include the ipy command if IPython is installed, which supports advanced interactive debugging + # of your application via introspection on self. + # include_ipy = False + # + # app = Cmd(use_ipython=include_ipy) + # app.cmdloop() + + + class HelpApp(Cmd): + """Class for testing custom help_* methods which override docstring help.""" + + def __init__(self, *args, **kwargs): + # Need to use this older form of invoking super class constructor to support Python 2.x and Python 3.x + Cmd.__init__(self, *args, **kwargs) + + def do_squat(self, arg): + """This docstring help will never be shown because the help_squat method overrides it.""" + pass + + def help_squat(self): + self.stdout.write('This command does diddly squat...\n') + + def do_edit(self, arg): + """This overrides the edit command and does nothing.""" + pass + + # This command will be in the "undocumented" section of the help menu + def do_undoc(self, arg): + pass + + + app = HelpApp() app.cmdloop() |