cmd2, an extenstion of cmd that parses its argument list
Adam Tauno Williams
awilliam at whitemice.org
Thu May 31 15:42:19 EDT 2012
On Thu, 2012-05-31 at 15:21 -0400, Adam Tauno Williams wrote:
> On Thu, 2012-04-26 at 12:16 -0700, anntzer.lee at gmail.com wrote:
> > On Sunday, March 18, 2012 10:12:24 PM UTC-7, anntz... at gmail.com wrote:
> > > Dear all,
> > > I would like to announce the first public release of cmd2, an extension of the standard library's cmd with argument parsing, here: https://github.com/anntzer/cmd2.
> > Due to an already existing Cmd2 on PyPI, I have renamed the project to parsedcmd, which is also a better description of what the module does.
> > https://github.com/anntzer/parsedcmd
> > > Cmd2 is an extension built around the excellent cmd module of the standard
> > > library. Cmd allows one to build simple custom shells using ``do_*`` methods,
> > > taking care in particular of the REPL loop and the interactive help. However,
> > > no facility is given for parsing the argument line (do_* methods are passed the
> > > rest of the line as a single string argument).
> > > With Cmd2, ``do_*`` methods are type-annotated, either using Python 3's
> > > function annotation syntax, or with an ad-hoc ``annotate`` decorator, allowing
> > > the dispatcher to parse the argument list for them.
> This is much the same functionality added to Cmd by Cmd2.
> Perhaps you could collaborate with Cmd2's author and merge your two
> extensions.
Since you split() the string in argument parsing document values cannot
contain whitespace; such as -file="Yo Yo Ma Ma.txt". Perhaps using
shlex() or some other means to initially break-up the strings would be a
better option?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/python-list/attachments/20120531/fcb24025/attachment.sig>
More information about the Python-list
mailing list