From 67ed2e37cb0dcdd46356a1e92a0fb8fb0a8a56db Mon Sep 17 00:00:00 2001 From: Zapta Date: Tue, 3 Sep 2024 22:03:00 -0700 Subject: [PATCH] Now preserving trailing whitespaces in stderr and stdout of subprocesses to keep any potential indentation for better readability. Also, fixed a lint warning in __main__.py. --- apio/__main__.py | 5 +++-- apio/util.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apio/__main__.py b/apio/__main__.py index cbc4a9f4..4c36c382 100644 --- a/apio/__main__.py +++ b/apio/__main__.py @@ -11,8 +11,8 @@ # -------------------------------------------- import string -import click import re +import click from apio import util @@ -128,7 +128,8 @@ def cli(ctx): # -- We later split the command lines into command groups. index = help_lines.index("Commands:") header_lines = help_lines[:index] - command_lines = help_lines[index + 1 :] + index += 1 # Skip the Commands: line. + command_lines = help_lines[index:] # -- Select project commands: project_help = select_commands_help( diff --git a/apio/util.py b/apio/util.py index b6e81df7..62cdb537 100644 --- a/apio/util.py +++ b/apio/util.py @@ -86,7 +86,8 @@ def run(self): """DOC: TODO""" for line in iter(self._pipe_reader.readline, ""): - line = line.strip() + # We do preserve trailing whitespace and indentation. + line = line.rstrip() self._buffer.append(line) if self.outcallback: self.outcallback(line)