[PATCH 0 of 1] ui: add function 'promptselection'

Matt Mackall mpm at selenic.com
Mon Aug 8 17:42:19 CDT 2011


On Mon, 2011-08-08 at 16:50 +0200, Ingo Proetel wrote:
> Hello,
> 
> This patch introduces a new function 'prompselection' which adds some functionality over 'promptchoice':
> For the hg user it will provide the possible choices in an consistent way (in square brackes with the default capitalized), the sequence of commands will not change through localization, and '?' will provide verbose help.
> The programmer does not need to create the possible choices by hand, can work with readable command instead of indices, and gets a help function for free.
> 
> Example usage:
>     choices = (('abort',_('&Abort command')),
>                ('new',_('Create &new request')),
>                ('reopen',_('&Reopen request')) )
>     request = ui.promptselection('now what?', choices,'new')
>     if    request == 'abort':
>       raise util.Abort('User aborted')
>     elif  request == 'new':
>       ui.status('creating new')
>     else:#request == 'reopen'
>       ui.status('reopen existing')

I guess this looks good, but I'd like to see an opinion from the
translators or THG folks.

Are translations translating the -keys- used as well?

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list