diff options
author | Zearin <zearin@gonk.net> | 2011-10-17 10:00:31 -0400 |
---|---|---|
committer | Zearin <zearin@gonk.net> | 2011-10-17 10:00:31 -0400 |
commit | 9eff62ead67072e4348f56c000854da6e6177cda (patch) | |
tree | 13c31aa58bae7a6feac87bcdfc0326c030637cce | |
parent | 4b45997e02fca4f78e85f4ab2d43fe7adc213246 (diff) | |
download | cmd2-9eff62ead67072e4348f56c000854da6e6177cda.tar.gz |
Whitespace adjustments (for readability)
Mostly aligned comments, variable assignments, and OptParse decorators
to align vertically (so they read like a “table”).
(And of course, this was done with respect for scope!)
-rwxr-xr-x | cmd2/example/example.py | 22 | ||||
-rw-r--r-- | cmd2/tests.py | 2 | ||||
-rwxr-xr-x | setup.py | 25 |
3 files changed, 26 insertions, 23 deletions
diff --git a/cmd2/example/example.py b/cmd2/example/example.py index 88cefd4..bbe7a8e 100755 --- a/cmd2/example/example.py +++ b/cmd2/example/example.py @@ -3,16 +3,18 @@ from cmd2 import Cmd, make_option, options import unittest, optparse, sys + class CmdLineApp(Cmd): - multilineCommands = ['orate'] + multilineCommands = ['orate'] Cmd.shortcuts.update({'&': 'speak'}) - maxrepeats = 3 - redirector = '->' + maxrepeats = 3 + redirector = '->' + Cmd.settable.append('maxrepeats Max number of `--repeat`s allowed') @options([make_option('-p', '--piglatin', action="store_true", help="atinLay"), - make_option('-s', '--shout', action="store_true", help="N00B EMULATION MODE"), - make_option('-r', '--repeat', type="int", help="output [n] times") + make_option('-s', '--shout' , action="store_true", help="N00B EMULATION MODE"), + make_option('-r', '--repeat' , type ="int" , help="output [n] times") ], arg_desc = '(text to say)') def do_speak(self, arg, opts=None): """Repeats what you tell me to.""" @@ -25,11 +27,11 @@ class CmdLineApp(Cmd): for i in range(min(repetitions, self.maxrepeats)): self.stdout.write(arg) self.stdout.write('\n') - # self.stdout.write is better than "print", because Cmd can be - # initialized with a non-standard output destination + # self.stdout.write is better than "print", because Cmd may be + # initialized with a non-standard output destination - do_say = do_speak # now "say" is a synonym for "speak" - do_orate = do_speak # another synonym, but this one takes multi-line input + do_say = do_speak # now "say" is a synonym for "speak" + do_orate = do_speak # another synonym, but this one takes multi-line input c = CmdLineApp() -c.cmdloop() +c.cmdloop()
\ No newline at end of file diff --git a/cmd2/tests.py b/cmd2/tests.py index ec3b413..e841f28 100644 --- a/cmd2/tests.py +++ b/cmd2/tests.py @@ -26,7 +26,7 @@ class Cmd2TestCase(unittest.TestCase): def setUp(self): if self.CmdApp: self.outputTrap = OutputTrap() - self.cmdapp = self.CmdApp() + self.cmdapp = self.CmdApp() self.fetchTranscripts() def runTest(self): # was testall @@ -11,22 +11,23 @@ except ImportError: from distutils.core import setup def find_packages(): return ['sqlpython'] + import sys install_requires = ['pyparsing>=1.5.6'] setup( - name="cmd2", - version="0.6.4", - py_modules=["cmd2"], - use_2to3=True, - + name ="cmd2", + version ="0.6.4", + py_modules =["cmd2"], + use_2to3 =True, + # metadata for upload to PyPI - author = 'Catherine Devlin', - author_email = 'catherine.devlin@gmail.com', - description = "Extra features for standard library's cmd module", - license = 'MIT', - keywords = 'command prompt console cmd', - url = 'http://packages.python.org/cmd2/', + author = 'Catherine Devlin', + author_email = 'catherine.devlin@gmail.com', + description = "Extra features for standard library's cmd module", + license = 'MIT', + keywords = 'command prompt console cmd', + url = 'http://packages.python.org/cmd2/', install_requires = install_requires, long_description = """Enhancements for standard library's cmd module. @@ -48,7 +49,7 @@ Drop-in replacement adds several features for command-prompt tools: Useable without modification anywhere cmd is used; simply import cmd2.Cmd in place of cmd.Cmd. -Running `2to3 <http://docs.python.org/library/2to3.html>` against ``cmd2.py`` +Running `2to3 <http://docs.python.org/library/2to3.html>` against ``cmd2.py`` generates working, Python3-based code. See docs at http://packages.python.org/cmd2/ |