Improve output formatting

Github annotations require all output to be on a single line, so let's
make the log messages do that
This commit is contained in:
Joe Rickerby
2021-01-05 19:02:15 +00:00
parent 0df5e1295f
commit ffba89dc64
3 changed files with 13 additions and 11 deletions
+3 -5
View File
@@ -244,15 +244,13 @@ def detect_ci_provider() -> Optional[CIProvider]:
return None
def wrap_text(text: str, max_width: int = 80) -> str:
def unwrap(text: str) -> str:
'''
Formats text, suitable for printing arbitrary long passages to console.
Unwraps multi-line text to a single line
'''
# remove initial line indent
text = textwrap.dedent(text)
# remove leading/trailing whitespace
text = text.strip()
# remove consecutive whitespace
text = re.sub(r'\s+', ' ', text)
# wrap to max_width
return '\n'.join(textwrap.wrap(text, width=max_width))
return re.sub(r'\s+', ' ', text)