mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 17:09:27 +01:00
Gave output an option fd.
This commit is contained in:
parent
920b4cfd18
commit
c63c7a1764
@ -42,14 +42,14 @@ import supybot.utils as utils
|
||||
|
||||
useBold = False
|
||||
|
||||
def output(s, unformatted=True):
|
||||
def output(s, unformatted=True, fd=sys.stdout):
|
||||
if unformatted:
|
||||
s = textwrap.fill(utils.normalizeWhitespace(s), width=65)
|
||||
print s
|
||||
print
|
||||
print >>fd, s
|
||||
print >>fd
|
||||
|
||||
def expect(prompt, possibilities, recursed=False, default=None,
|
||||
acceptEmpty=False):
|
||||
acceptEmpty=False, fd=sys.stdout):
|
||||
"""Prompt the user with prompt, allow them to choose from possibilities.
|
||||
|
||||
If possibilities is empty, allow anything.
|
||||
@ -72,12 +72,12 @@ def expect(prompt, possibilities, recursed=False, default=None,
|
||||
prompt = prompt.replace('/ ', '/')
|
||||
prompt = prompt.strip() + ' '
|
||||
if useBold:
|
||||
print ansi.BOLD,
|
||||
print >>fd, ansi.BOLD,
|
||||
s = raw_input(prompt)
|
||||
if useBold:
|
||||
print ansi.RESET
|
||||
print >>fd, ansi.RESET
|
||||
s = s.strip()
|
||||
print
|
||||
print >>fd
|
||||
if possibilities:
|
||||
if s in possibilities:
|
||||
return s
|
||||
|
Loading…
Reference in New Issue
Block a user