From fcc9a087c400575428945923d0301bc3ff6243af Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Fri, 30 Aug 2024 14:58:29 +0100 Subject: [PATCH] Adjust indentation of help strings Uses backspace character (\b) because argparse does not provide any way to override the amount of indentation. Although argparse.HelpFormatter exposes an option for the amount of indendation, it is undocumented and not part of the public interface. Signed-off-by: John Pennycook --- bin/codebasin | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/codebasin b/bin/codebasin index 4c776d0..5ced861 100755 --- a/bin/codebasin +++ b/bin/codebasin @@ -40,6 +40,10 @@ def _help_string(*lines: str, is_long=False, is_last=False): if not is_long: result = "\n" + # argparse.HelpFormatter indents by 24 characters. + # We cannot override this directly, but can delete them with backspaces. + lines = ["\b" * 20 + x for x in lines] + # The additional space is required for argparse to respect newlines. result += "\n".join(lines)