[PATCH]: shell-complete command

Martin Pool martinpool at gmail.com
Wed Aug 24 02:15:03 BST 2005


On 8/23/05, John A Meinel <john at arbash-meinel.com> wrote:

> Right now the -r code is all parsed at the same point, and it is up to
> the individual command to detect if it is passed too many (or too few)
> revisions, and complain accordingly. (This doesn't necessarily help your
> autocomplete code, though).

It's good to have options be consistent across commands, but I'm not
sure anymore if having them globally defined is really the best way. 
Particularly because, as you say, the values available for the options
will differ.

Perhaps something like:

  class cmd_foo(...):
    takes_options = [Option('verbose', 'v', help='show progress of foo'),
         Option('format', optarg=FooFormat)]

So options that take an argument are specified with a class that
parses the optarg, and that could potentially also provide help for
completion.

-- 
Martin




More information about the bazaar mailing list