Skip to content

Commit 1dd2c0e

Browse files
committed
Restored newlines to ACArgumentParser help and error text
1 parent 68b03bf commit 1dd2c0e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

cmd2/argparse_completer.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -999,9 +999,7 @@ def error(self, message: str) -> None:
999999
linum += 1
10001000

10011001
self.print_usage(sys.stderr)
1002-
sys.stderr.write(Fore.LIGHTRED_EX + '{}\n'.format(formatted_message) + Fore.RESET)
1003-
1004-
sys.exit(1)
1002+
self.exit(2, Fore.LIGHTRED_EX + '{}\n\n'.format(formatted_message) + Fore.RESET)
10051003

10061004
def format_help(self) -> str:
10071005
"""Copy of format_help() from argparse.ArgumentParser with tweaks to separately display required parameters"""
@@ -1051,7 +1049,7 @@ def format_help(self) -> str:
10511049
formatter.add_text(self.epilog)
10521050

10531051
# determine help from format above
1054-
return formatter.format_help()
1052+
return formatter.format_help() + '\n'
10551053

10561054
def _get_nargs_pattern(self, action) -> str:
10571055
# Override _get_nargs_pattern behavior to use the nargs ranges provided by AutoCompleter

0 commit comments

Comments
 (0)