equal
deleted
inserted
replaced
286 |
286 |
287 def promptchoice(self, msg, choices, default=0): |
287 def promptchoice(self, msg, choices, default=0): |
288 """Prompt user with msg, read response, and ensure it matches |
288 """Prompt user with msg, read response, and ensure it matches |
289 one of the provided choices. The index of the choice is returned. |
289 one of the provided choices. The index of the choice is returned. |
290 choices is a sequence of acceptable responses with the format: |
290 choices is a sequence of acceptable responses with the format: |
291 ('&None', 'E&xec', 'Sym&link') Responses are case insensitive. |
291 ('&None', 'E&xec', 'Sym&link') Responses are case insensitive. |
292 If ui is not interactive, the default is returned. |
292 If ui is not interactive, the default is returned. |
293 """ |
293 """ |
294 resps = [s[s.index('&')+1].lower() for s in choices] |
294 resps = [s[s.index('&')+1].lower() for s in choices] |
295 while True: |
295 while True: |
296 r = self.prompt(msg, resps[default]) |
296 r = self.prompt(msg, resps[default]) |