Skip to content

Commit

Permalink
Adjust indentation of help strings
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Pennycook committed Aug 30, 2024
1 parent f5fcd01 commit fcc9a08
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/codebasin
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit fcc9a08

Please sign in to comment.