On 2013-06-28 09:02, Cameron Simpson wrote: > On 27Jun2013 11:50, Ethan Furman <et...@stoneleaf.us> wrote: > | If the OP is writing an interactive shell, shouldn't `cmd` be used > | instead of `argparse`? argparse is, after all, intended for > | argument parsing of command line scripts, not for interactive > work. > > I invoke command line scripts interactively. There's no special > case here. > > To add to the use case stats, I also subclass cmd and parse > interactive command lines. I'm beginning to be pleased I'm still > using Getopt for that instead of feeling I'm lagging behind the > times.
I too have several small utilities that use a combination of cmd.Cmd, shlex.shlex(), and command-processing libraries. However, much like Cameron's code using getopt, my older code is still using optparse which gives me the ability to override the error() method's default sys.exit() behavior and instead raise the exception of your choice. -tkc -- http://mail.python.org/mailman/listinfo/python-list