mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
Made an empty stings cancel out of the plugin selection.
This commit is contained in:
parent
b63fc24865
commit
53f9c0aa94
@ -430,7 +430,8 @@ def main():
|
|||||||
# until we get example strings again, this will default to false
|
# until we get example strings again, this will default to false
|
||||||
#showUsage =yn('Would you like the option of seeing usage examples?')
|
#showUsage =yn('Would you like the option of seeing usage examples?')
|
||||||
showUsage = False
|
showUsage = False
|
||||||
name = expect('What plugin would you like to look at?', plugins)
|
name = expect('What plugin would you like to look at?',
|
||||||
|
plugins, acceptEmpty=True)
|
||||||
while name:
|
while name:
|
||||||
module = loadPlugin(name)
|
module = loadPlugin(name)
|
||||||
if module is not None:
|
if module is not None:
|
||||||
|
@ -49,7 +49,8 @@ def output(s, unformatted=True):
|
|||||||
print
|
print
|
||||||
|
|
||||||
# doindent is used in yn().
|
# doindent is used in yn().
|
||||||
def expect(prompt, possibilities, recursed=False, doindent=True, default=None):
|
def expect(prompt, possibilities, recursed=False,
|
||||||
|
doindent=True, default=None, acceptEmpty=False):
|
||||||
"""Prompt the user with prompt, allow them to choose from possibilities.
|
"""Prompt the user with prompt, allow them to choose from possibilities.
|
||||||
|
|
||||||
If possibilities is empty, allow anything.
|
If possibilities is empty, allow anything.
|
||||||
@ -82,6 +83,8 @@ def expect(prompt, possibilities, recursed=False, doindent=True, default=None):
|
|||||||
return s
|
return s
|
||||||
elif not s and default is not None:
|
elif not s and default is not None:
|
||||||
return default
|
return default
|
||||||
|
elif not s and acceptEmpty:
|
||||||
|
return s
|
||||||
else:
|
else:
|
||||||
return expect(originalPrompt, possibilities, recursed=True,
|
return expect(originalPrompt, possibilities, recursed=True,
|
||||||
doindent=doindent, default=default)
|
doindent=doindent, default=default)
|
||||||
|
Loading…
Reference in New Issue
Block a user