Skip to content

Commit 2b229d4

Browse files
ohemorangeschoen
authored andcommitted
Allow notification interface to not wrap text (certbot#3728)
1 parent df10a64 commit 2b229d4

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

certbot/display/util.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,19 @@ def __init__(self, outfile):
5555
super(FileDisplay, self).__init__()
5656
self.outfile = outfile
5757

58-
def notification(self, message, pause=True):
58+
def notification(self, message, pause=True, wrap=True):
5959
# pylint: disable=unused-argument
6060
"""Displays a notification and waits for user acceptance.
6161
6262
:param str message: Message to display
6363
:param bool pause: Whether or not the program should pause for the
6464
user's confirmation
65+
:param bool wrap: Whether or not the application should wrap text
6566
6667
"""
6768
side_frame = "-" * 79
68-
message = _wrap_lines(message)
69+
if wrap:
70+
message = _wrap_lines(message)
6971
self.outfile.write(
7072
"{line}{frame}{line}{msg}{line}{frame}{line}".format(
7173
line=os.linesep, frame=side_frame, msg=message))
@@ -322,16 +324,18 @@ def _interaction_fail(self, message, cli_flag, extra=""):
322324
msg += "\n\n(You can set this with the {0} flag)".format(cli_flag)
323325
raise errors.MissingCommandlineFlag(msg)
324326

325-
def notification(self, message, pause=False):
327+
def notification(self, message, pause=False, wrap=True):
326328
# pylint: disable=unused-argument
327329
"""Displays a notification without waiting for user acceptance.
328330
329331
:param str message: Message to display to stdout
330332
:param bool pause: The NoninteractiveDisplay waits for no keyboard
333+
:param bool wrap: Whether or not the application should wrap text
331334
332335
"""
333336
side_frame = "-" * 79
334-
message = _wrap_lines(message)
337+
if wrap:
338+
message = _wrap_lines(message)
335339
self.outfile.write(
336340
"{line}{frame}{line}{msg}{line}{frame}{line}".format(
337341
line=os.linesep, frame=side_frame, msg=message))

certbot/interfaces.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,13 @@ def restart():
365365
class IDisplay(zope.interface.Interface):
366366
"""Generic display."""
367367

368-
def notification(message, pause):
368+
def notification(message, pause, wrap=True):
369369
"""Displays a string message
370370
371371
:param str message: Message to display
372372
:param bool pause: Whether or not the application should pause for
373373
confirmation (if available)
374+
:param bool wrap: Whether or not the application should wrap text
374375
375376
"""
376377

0 commit comments

Comments
 (0)