[Svnmerge] Status update on help conversion

Giovanni Bajo rasky at develer.com
Wed Oct 19 08:47:41 PDT 2005


Hello,

since I was at modifying the command line handling to split help in separate
parts, I had a go at modifying the code to be totally data driven.
Basically, I have a data structure which lists the subcommands (init, avail,
merge, block, unblock), and for each subcommand I have:

- Function to call
- Description
- List of accepted command line options

Each option is then described with its flags, its description, its default
value and more.

I ended up writing about 250 lines to handle this with getopt. There's
advanced stuff in there (auto-wrapping of text at console width,
auto-generation of help, support for sharing options across commands, and
more). I believe that the count could be cut in half if I were to use
optparse in Python 2.3+, but that would require users of older versions to
download the module elsewhere. In the end, I didn't feel like adding this
dependency.

I committed it as r170. Testing and any kind of feedback is much
appreciated.
-- 
Giovanni Bajo




More information about the Svnmerge mailing list