[PATCH 0 of 1] ui: add function 'promptselection'
Ingo Proetel
proetel at aicas.de
Thu Aug 4 07:26:01 CDT 2011
Hello,
I have a patch proposal for a new function to replace 'promptchoice'.
The function 'promptselection' provides more automatic support for user selections:
- always provide a help
- uniform representation of possible choices
- return command strings instead of indexes
Its use is similar to 'promptchoice':
choices = (_('&Abort command'),
_('Create &new request'),
_('&Reopen request') )
request = ui.promptselection('now what?', choices,'new')
if request == 'abort':
util.Abort('User aborted')
elif request == 'new':
ui.status('creating new')
else:#request == 'reopen'
ui.status('reopen existing')
The output will look like this:
$>now what? [aNr?] ?
a Abort command
n Create new request
r Reopen request
$>now what? [aNr?] n
creating new
If this function was accepted I would go through all uses of 'promptchoice' and replace them.
Best Regards,
Ingo
More information about the Mercurial-devel
mailing list