main: fix up help printing

We are getting an extra newline at the end of our help, which is
inconsistent with how argparse usually works and is causing tox issues
on Windows.

Avoid having an empty line at the end of help messages.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2019-11-15 15:30:57 -08:00 committed by Carles Cufí
parent c528dd62b3
commit 564e1d4659
2 changed files with 2 additions and 3 deletions

View File

@ -65,7 +65,7 @@ class WestArgumentParser(argparse.ArgumentParser):
self.mve = None # a ManifestVersionError, if any
def print_help(self, file=None, top_level=False):
print(self.format_help(top_level=top_level),
print(self.format_help(top_level=top_level), end='',
file=file or sys.stdout)
def format_help(self, top_level=False):
@ -153,7 +153,7 @@ class WestArgumentParser(argparse.ArgumentParser):
if self.epilog:
append(self.epilog)
return sio.getvalue().rstrip()
return sio.getvalue()
def format_west_optional(self, append, wo, width):
metavar = wo['metavar']

View File

@ -34,5 +34,4 @@ usage: west test-extension [-h]
optional arguments:
-h, --help show this help message and exit
'''