[PATCH]: Optional explanation for options

Magnus Therning magnus at therning.org
Sun Sep 11 12:08:39 BST 2005


On Sun, Sep 11, 2005 at 11:54:23AM +0200, Harald Meland wrote:
>[Magnus Therning]
>
>> OK, here's a second stab at it. Let me know what you think. It isn't
>> complete, but it's enough to get my thought across, I hope.
>>
>> Commands are written like this:
>>
>>  class cmd_my_command(Command):
>>      ...
>>      takes_options = bzrlib.commands.prep_ops('option1', option2='description')
>
>How would you add a dash-containing option (like "--no-backup") with a
>non-global description using this syntax?

I was hoping the code in prep_ops would handle it:

 def prep_ops(*args, **kwargs):
     res = []
     for arg in args:
         res.append((arg, OPTIONS[arg][1]))
     for kw in kwargs:
         res.append((kw.replace('_', '-'), kwargs[kw]))
     return res

/M

-- 
Magnus Therning                    (OpenPGP: 0xAB4DFBA4)
magnus at therning.org
http://therning.org/magnus

Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.

Ain't no place like ${HOME}; not even C:\.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050911/915eb619/attachment.pgp 


More information about the bazaar mailing list