Mercurial > python-cmd2
changeset 374:89e38f922c25
font sizes up
author | cat@eee |
---|---|
date | Sat, 20 Feb 2010 00:11:34 -0500 |
parents | a381f8dd3a45 |
children | 6cc12ad6e616 |
files | docs/pycon2010/pirate2.py docs/pycon2010/pirate3.py docs/pycon2010/pirate5.py docs/pycon2010/pirate6.py docs/pycon2010/pirate7.py docs/pycon2010/pirate8.py docs/pycon2010/pycon2010.rst docs/pycon2010/refresh.bash docs/pycon2010/script.txt docs/pycon2010/ui/pycon/pretty.css docs/pycon2010/ui/pycon/pretty.css~ docs/refresh_pycon.bash |
diffstat | 12 files changed, 135 insertions(+), 101 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/pycon2010/pirate2.py Fri Feb 19 12:20:44 2010 -0500 +++ b/docs/pycon2010/pirate2.py Sat Feb 20 00:11:34 2010 -0500 @@ -6,11 +6,13 @@ def do_loot(self, arg): 'Seize booty from a passing ship.' self.gold += 1 - print('Now we gots {0} doubloons'.format(self.gold)) + print('Now we gots {0} doubloons' + .format(self.gold)) def do_drink(self, arg): 'Drown your sorrrows in rrrum.' self.gold -= 1 - print('Now we gots {0} doubloons'.format(self.gold)) + print('Now we gots {0} doubloons' + .format(self.gold)) pirate = Pirate() -pirate.cmdloop() \ No newline at end of file +pirate.cmdloop()
--- a/docs/pycon2010/pirate3.py Fri Feb 19 12:20:44 2010 -0500 +++ b/docs/pycon2010/pirate3.py Sat Feb 20 00:11:34 2010 -0500 @@ -14,7 +14,8 @@ return line def postcmd(self, stop, line): if self.gold != self.initial_gold: - print('Now we gots {0} doubloons'.format(self.gold)) + print('Now we gots {0} doubloons' + .format(self.gold)) pirate = Pirate() -pirate.cmdloop() \ No newline at end of file +pirate.cmdloop()
--- a/docs/pycon2010/pirate5.py Fri Feb 19 12:20:44 2010 -0500 +++ b/docs/pycon2010/pirate5.py Sat Feb 20 00:11:34 2010 -0500 @@ -21,14 +21,15 @@ return line def postcmd(self, stop, line): if self.gold != self.initial_gold: - print('Now we gots {0} doubloons'.format(self.gold)) + print('Now we gots {0} doubloons' + .format(self.gold)) if self.gold < 0: - print("Off to debtorrr's prison. Game overrr.") - return True + print("Off to debtorrr's prison.") + stop = True return stop def do_quit(self, arg): print("Quiterrr!") return True pirate = Pirate() -pirate.cmdloop() \ No newline at end of file +pirate.cmdloop()
--- a/docs/pycon2010/pirate6.py Fri Feb 19 12:20:44 2010 -0500 +++ b/docs/pycon2010/pirate6.py Sat Feb 20 00:11:34 2010 -0500 @@ -1,11 +1,12 @@ -from cmd7 import Cmd +from cmd import Cmd # prompts and defaults class Pirate(Cmd): gold = 3 prompt = 'arrr> ' def default(self, line): - print('What mean ye by "{0}"?'.format(line)) + print('What mean ye by "{0}"?' + .format(line)) def do_loot(self, arg): 'Seize booty from a passing ship.' self.gold += 1 @@ -24,10 +25,11 @@ return line def postcmd(self, stop, line): if self.gold != self.initial_gold: - print('Now we gots {0} doubloons'.format(self.gold)) + print('Now we gots {0} doubloons' + .format(self.gold)) if self.gold < 0: - print("Off to debtorrr's prison. Game overrr.") - return True + print("Off to debtorrr's prison.") + stop = True return stop def do_quit(self, arg): print("Quiterrr!")
--- a/docs/pycon2010/pirate7.py Fri Feb 19 12:20:44 2010 -0500 +++ b/docs/pycon2010/pirate7.py Sat Feb 20 00:11:34 2010 -0500 @@ -24,10 +24,11 @@ return line def postcmd(self, stop, line): if self.gold != self.initial_gold: - print('Now we gots {0} doubloons'.format(self.gold)) + print('Now we gots {0} doubloons' + .format(self.gold)) if self.gold < 0: - print("Off to debtorrr's prison. Game overrr.") - return True + print("Off to debtorrr's prison.") + stop = True return stop def do_quit(self, arg): print("Quiterrr!") @@ -42,4 +43,4 @@ print(self.colorize(arg, self.songcolor)) pirate = Pirate() -pirate.cmdloop() \ No newline at end of file +pirate.cmdloop()
--- a/docs/pycon2010/pirate8.py Fri Feb 19 12:20:44 2010 -0500 +++ b/docs/pycon2010/pirate8.py Sat Feb 20 00:11:34 2010 -0500 @@ -24,10 +24,11 @@ return line def postcmd(self, stop, line): if self.gold != self.initial_gold: - print('Now we gots {0} doubloons'.format(self.gold)) + print('Now we gots {0} doubloons' + .format(self.gold)) if self.gold < 0: - print("Off to debtorrr's prison. Game overrr.") - return True + print("Off to debtorrr's prison.") + stop = True return stop def do_quit(self, arg): print("Quiterrr!")
--- a/docs/pycon2010/pycon2010.rst Fri Feb 19 12:20:44 2010 -0500 +++ b/docs/pycon2010/pycon2010.rst Sat Feb 20 00:11:34 2010 -0500 @@ -4,12 +4,7 @@ :author: Catherine Devlin :date: 2010-02-20 - -Quit scribbling -=============== - -Slides are *already* posted at -homepage: http://pypi.python.org/pypi/cmd2 +:slides: http://pypi.python.org/pypi/cmd2 Web 2.0 ======= @@ -57,28 +52,32 @@ Examples ======== -* Bash, Korn, zsh -* Python shell -* screen -* Zork -* SQL clients: psql, SQL*\Plus, mysql... -* ed +.. class:: big + + * Bash, Korn, zsh + * Python shell + * screen + * Zork + * SQL clients: psql, SQL*\Plus, mysql... + * ed .. ``ed`` proves that CLI is sometimes the wrong answer. != Command Line Utilities ========================= -(``ls``, ``grep``, ``ping``, etc.) +.. class:: big + + (``ls``, ``grep``, ``ping``, etc.) -1. Accepts arguments at invocation -2. executes -3. terminates + 1. Accept arguments at invocation + 2. execute + 3. terminate -Use ``sys.argv``, ``optparse`` + Use ``sys.argv``, ``optparse`` -!="Text User Interface", "Console" -================================== +!="Text User Interface" +======================= * Use entire (session) screen * I/O is *not* line-by-line @@ -116,9 +115,11 @@ .. class:: huge - Transform ``(Cmd) foo a b c`` + ``(Cmd) foo a b c`` - to ``self.do_foo('a b c')`` + becomes + + ``self.do_foo('a b c')`` ``do_``-methods: pirate2.py =========================== @@ -130,11 +131,13 @@ def do_loot(self, arg): 'Seize booty frrrom a passing ship.' self.gold += 1 - print('Now we gots {0} doubloons'.format(self.gold)) + print('Now we gots {0} doubloons' + .format(self.gold)) def do_drink(self, arg): 'Drown your sorrrows in rrrum.' self.gold -= 1 - print('Now we gots {0} doubloons'.format(self.gold)) + print('Now we gots {0} doubloons' + .format(self.gold)) .. do_methods; more help @@ -144,7 +147,12 @@ .. image:: hook.jpg :height: 250px -preloop, postloop, precmd, postcmd +:: + + self.preloop() + self.postloop() + self.precmd(line) + self.postcmd(stop, line) Hooks: pirate3.py ================= @@ -162,7 +170,8 @@ return line def postcmd(self, stop, line): if self.gold != self.initial_gold: - print('Now we gots {0} doubloons'.format(self.gold)) + print('Now we gots {0} doubloons' + .format(self.gold)) Arguments: pirate4.py ===================== @@ -188,17 +197,18 @@ def postcmd(self, stop, line): if self.gold != self.initial_gold: - print('Now we gots {0} doubloons'.format(self.gold)) + print('Now we gots {0} doubloons' + .format(self.gold)) if self.gold < 0: - print("Off to debtorrr's prison. Game overrr.") - return True + print("Off to debtorrr's prison.") + stop = True return stop def do_quit(self, arg): print("Quiterrr!") return True -prompts and defaults: pirate6.py -================================ +prompts, defaults: pirate6.py +============================= :: @@ -209,14 +219,22 @@ Other CLI packages ================== - - * cmdlin - * cmd2 + +.. class:: big + + * CmdLoop + * cly + * CMdO + * pycopia + * cmdlin + * cmd2 Demo ==== -Convert ``cmd`` app to ``cmd2`` +.. class:: huge + + Convert ``cmd`` app to ``cmd2`` cmd2 ==== @@ -227,18 +245,24 @@ As you wish, Guido ================== -Python 3 compatible +.. class:: huge + + Python 3 compatible (um, mostly) Absolutely free =============== - * Script files - * Commands at invocation - * Output redirection - * Python - * Transcript-based testing +Script files + +Commands at invocation + +Output redirection + +Python + +Transcript testing But wait, there's more ====================== @@ -250,15 +274,6 @@ * Echo * Debug -For a few keystrokes more... -============================ - - * Default to shell - * Color output - * Shortcuts - * Multiline commands - * Environment variables - Minor changes: pirate7.py ========================= @@ -276,10 +291,13 @@ Now how much would you pay? =========================== - * options / flags - * Quiet (suppress feedback) - * BASH-style ``select`` - * Parsing: terminators, suffixes +options / flags + +Quiet (suppress feedback) + +BASH-style ``select`` + +Parsing: terminators, suffixes Options: pirate8.py =================== @@ -296,37 +314,45 @@ Serious example: sqlpython ========================== -``cmd``-based app by Luca Canali @ CERN +.. class:: big + + ``cmd``-based app by Luca Canali @ CERN -Replacement for Oracle SQL\*Plus + Replacement for Oracle SQL\*Plus -Now ``cmd2``-based; postgreSQL; MySQL + Now ``cmd2``-based; postgreSQL; MySQL sqlpython features ================== -* from ``cmd2``: scripts, redirection, - py, etc. -* multiple connections -* UNIX: ls, cat, grep -* Special output +.. class:: big + + * from ``cmd2``: scripts, redirection, + py, etc. + * multiple connections + * UNIX: ls, cat, grep + * Special output File reporter ============= -Gather info: Python +.. class:: huge + + Gather info: Python -Store: postgresql + Store: postgresql -Report: html + Report: html Thank you ========= -pypi.python.org/pypi/cmd2 +.. class:: big + + http://pypi.python.org/pypi/cmd2 -catherinedevlin.blogspot.com + http://catherinedevlin.blogspot.com -catherinedevlin.pythoneers.com + http://catherinedevlin.pythoneers.com
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/pycon2010/refresh.bash Sat Feb 20 00:11:34 2010 -0500 @@ -0,0 +1,1 @@ +rst2s5.py --theme-url ui/pycon pycon2010.rst pycon2010.html
--- a/docs/pycon2010/script.txt Fri Feb 19 12:20:44 2010 -0500 +++ b/docs/pycon2010/script.txt Sat Feb 20 00:11:34 2010 -0500 @@ -1,5 +1,5 @@ loot loot -drink 3 +drink /* arrr */ 2 # matey drink chardonnay
--- a/docs/pycon2010/ui/pycon/pretty.css Fri Feb 19 12:20:44 2010 -0500 +++ b/docs/pycon2010/ui/pycon/pretty.css Sat Feb 20 00:11:34 2010 -0500 @@ -22,8 +22,8 @@ .slide img.leader {display: block; margin: 0 auto;} .slide tt {font-size: 90%;} -div#header, div#footer {background: #005; color: #AAB; font-family: sans-serif;} -/* background: #005 url(bodybg.gif) -16px 0 no-repeat; */ +div#header, div#footer {background: green; color: #AAB; font-family: sans-serif;} +/* background: green url(bodybg.gif) -16px 0 no-repeat; */ div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;} #footer h1 {display: block; padding: 0 1em;} #footer h2 {display: block; padding: 0.8em 1em 0;} @@ -31,7 +31,7 @@ .slide {font-size: 1.2em;} .slide h1 {position: absolute; top: 0.45em; z-index: 1; margin: 0; padding-left: 0.7em; white-space: nowrap; - font: bold 150% sans-serif; color: #DDE; background: #005;} + font: bold 150% sans-serif; color: #DDE; background: green;} .slide h2 {font: bold 120%/1em sans-serif; padding-top: 0.5em;} .slide h3 {font: bold 100% sans-serif; padding-top: 0.5em;} h1 abbr {font-variant: small-caps;} @@ -42,7 +42,7 @@ div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; margin: 0; padding: 0;} #controls #navLinks a {padding: 0; margin: 0 0.5em; - background: #005; border: none; color: #779; cursor: pointer;} + background: green; border: none; color: #779; cursor: pointer;} #controls #navList {height: 1em;} #controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;}
--- a/docs/pycon2010/ui/pycon/pretty.css~ Fri Feb 19 12:20:44 2010 -0500 +++ b/docs/pycon2010/ui/pycon/pretty.css~ Sat Feb 20 00:11:34 2010 -0500 @@ -2,7 +2,7 @@ /* Following are the presentation styles -- edit away! */ html, body {margin: 0; padding: 0;} -body {background: white; color: black;} +body {background: white; color: black; font-family: sans-serif;} /* Replace the background style above with the style below (and again for div#header) for a graphic: */ /* background: white url(bodybg.gif) -16px 0 no-repeat; */ @@ -22,8 +22,8 @@ .slide img.leader {display: block; margin: 0 auto;} .slide tt {font-size: 90%;} -div#header, div#footer {background: #005; color: #AAB; font-family: sans-serif;} -/* background: #005 url(bodybg.gif) -16px 0 no-repeat; */ +div#header, div#footer {background: lightgreen; color: #AAB; font-family: sans-serif;} +/* background: lightgreen url(bodybg.gif) -16px 0 no-repeat; */ div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;} #footer h1 {display: block; padding: 0 1em;} #footer h2 {display: block; padding: 0.8em 1em 0;} @@ -31,7 +31,7 @@ .slide {font-size: 1.2em;} .slide h1 {position: absolute; top: 0.45em; z-index: 1; margin: 0; padding-left: 0.7em; white-space: nowrap; - font: bold 150% sans-serif; color: #DDE; background: #005;} + font: bold 150% sans-serif; color: #DDE; background: lightgreen;} .slide h2 {font: bold 120%/1em sans-serif; padding-top: 0.5em;} .slide h3 {font: bold 100% sans-serif; padding-top: 0.5em;} h1 abbr {font-variant: small-caps;} @@ -42,7 +42,7 @@ div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; margin: 0; padding: 0;} #controls #navLinks a {padding: 0; margin: 0 0.5em; - background: #005; border: none; color: #779; cursor: pointer;} + background: lightgreen; border: none; color: #779; cursor: pointer;} #controls #navList {height: 1em;} #controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;} @@ -66,7 +66,7 @@ .incremental, .incremental *, .incremental *:after {visibility: visible; color: white; border: 0;} img.incremental {visibility: hidden;} -.slide .current {color: green;} +.slide .current {color: lightgreen;} .slide-display {display: inline ! important;} @@ -85,7 +85,7 @@ .orange {color: orange;} .yellow {color: yellow;} .lime {color: lime;} -.green {color: green;} +.lightgreen {color: lightgreen;} .olive {color: olive;} .teal {color: teal;} .cyan {color: cyan;}