Mercurial > python-cmd2
diff docs/pycon2010/pycon2010.rst @ 372:bf314710e64b
can't make theme work
author | cat@eee |
---|---|
date | Fri, 19 Feb 2010 00:23:18 -0500 |
parents | 40cba30b6125 |
children | a381f8dd3a45 |
line wrap: on
line diff
--- a/docs/pycon2010/pycon2010.rst Thu Feb 18 16:31:27 2010 -0500 +++ b/docs/pycon2010/pycon2010.rst Fri Feb 19 00:23:18 2010 -0500 @@ -15,7 +15,7 @@ ======= .. image:: web-2-0-logos.gif - :height: 250px + :height: 350px But first... ============ @@ -43,6 +43,8 @@ Defining CLI ============ + +Also known as - "Line-oriented command interpreter" - "Command-line interface" @@ -75,22 +77,22 @@ Use ``sys.argv``, ``optparse`` -!= "Text User Interfaces", "Consoles" -===================================== +!="Text User Interface", "Console" +================================== * Use entire (session) screen * I/O is *not* line-by-line +* See ``curses``, ``urwid`` .. image:: urwid.png :height: 250px -Use ``curses``, ``urwid`` -Priorities -========== +Decide your priorities +====================== .. image:: strategy.png - :height: 250px + :height: 350px A ``cmd`` app: pirate.py ======================== @@ -113,12 +115,10 @@ ======================= .. class:: huge - - :: - (Cmd) foo a b c + Transform ``(Cmd) foo a b c`` - ``self.do_foo('a b c')`` + to ``self.do_foo('a b c')`` ``do_``-methods: pirate2.py =========================== @@ -206,12 +206,23 @@ def default(self, line): print('What mean ye by "{0}"?' .format(line)) - + +Other CLI packages +================== + + * cmdlin + * cmd2 + +Demo +==== + +Convert ``cmd`` app to ``cmd2`` + cmd2 ==== .. image:: schematic.png - :height: 250px + :height: 350px Absolutely free =============== @@ -268,16 +279,12 @@ :: - @options([make_option('--ho', type='int', help="How often to chant 'ho'", default=2), - make_option('-c', '--commas', action="store_true", help="Interspers commas")]) def do_yo(self, arg, opts): chant = ['yo'] + ['ho'] * opts.ho - if opts.commas: - separator = ', ' - else: - separator = ' ' + separator = ', ' if opts.commas else ' ' chant = separator.join(chant) - print('{0} and a bottle of {1}'.format(chant, arg)) + print('{0} and a bottle of {1}' + .format(chant, arg)) Serious example: sqlpython ========================== @@ -291,17 +298,28 @@ sqlpython features ================== -Everything in ``cmd2`` - (scripts, redirection, py) +* from ``cmd2``: scripts, redirection, + py, etc. +* multiple connections +* UNIX: ls, cat, grep +* Special output -Multi connections +File reporter +============= + +Gather info: Python -ls, grep +Store: postgresql + +Report: html -Output to html, csv, inserts, bar graphs +Thank you +========= -py session with bind variables +pypi. + +catherinedevlin.blogspot.com + +catherinedevlin.pythoneers.com - -