jenkins-bot merged this change.
[IMPR] Wrap formatted options of an option bar to prevent ugly line breaks
e.g. a lot of input_choice options may break inside the option text;
this patch solves this.
Change-Id: I0e8f7398592795e0277e84437e783acd044e8d50
---
M pywikibot/bot_choice.py
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py
index ddc04ec..db6b1bd 100755
--- a/pywikibot/bot_choice.py
+++ b/pywikibot/bot_choice.py
@@ -7,6 +7,8 @@
#
from __future__ import absolute_import, unicode_literals
+from textwrap import fill
+
import pywikibot
@@ -40,7 +42,8 @@
formatted_options = []
for option in options:
formatted_options.append(option.format(default=default))
- return '{0} ({1})'.format(text, ', '.join(formatted_options))
+ return fill('{0} ({1})'.format(text, ', '.join(formatted_options)),
+ width=77)
@property
def stop(self):
To view, visit change 428927. To unsubscribe, visit settings.