RegistryOption does not show possible values with value_switches=False

Alexander Belchenko bialix at ukr.net
Fri Dec 7 13:07:08 GMT 2007


Adeodato Simó пишет:
> * Adeodato Simó [Sun, 25 Nov 2007 20:09:56 +0100]:
> 
>> I tried to implement this, so that tags' --sort option gets useable
>> help, but it doesn't seem possible to do it right away, because
>> optparse.OptionParser inconditionally wraps the help for an option as a
>> single paragraph, even if there are newlines in it.
> 
>> OptionParser accepts a formatter kwarg, and it will use it instead of
>> the standard IndentedHelpFormatter, but it would still mean duplicating
>> most of optparser.HelpFormatter.format_option().
> 
>> Other option would be to somehow place the documentation for possible
>> values in a separate paragraph, like it happens with value_switches=True.
>> I guess for that one could subclass OptionParser. I may try this approach 
>> during the upcoming week.
> 
>> CCing Aaron in case he has any comments.
> 
> Or you can provide a custom formatter that, instead of duplicating code
> from the standard formatter, gets in the verge of evil and substitutes
> textwrap.wrap by a function that will respect newlines. I have no idea
> if this would be allowed in the Bazaar codebase, but a patch without
> tests is attached.
> 
> Output is like:
> 
> % bzr help tags
> Purpose: List tags.
> Usage:   bzr tags
> 
> Options:
>   --sort=ARG            Sort tags by different criteria. Posible values:
>                           - alpha: Sort tags lexicographically (default).
>                           - time: Sort tags chronologically.
>   -v, --verbose         Display more information.
>   ...
> 

If you want to get your patch merged or at least reviewed, please 
re-send it with [MERGE] in the subject. It seems that it was forgotten 
in the battle for 1.0.



More information about the bazaar mailing list