Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format help strings #104

Merged
merged 3 commits into from
Aug 30, 2024
Merged

Format help strings #104

merged 3 commits into from
Aug 30, 2024

Conversation

Pennycook
Copy link
Contributor

Related issues

Closes #45.

Proposed changes

  • Adds _help_string function to consistently format help strings.
  • Adds \n and \b characters in the right places to adjust argparse formatting.

This might look like a bit of a hack, but all other solutions I could find to this problem rely on creating a subclass of HelpFormatter that relies on undocumented behavior.

Intent is to make spacing consistent for short and long options.

Signed-off-by: John Pennycook <[email protected]>
Hopefully more readable and maintainable than manually inserting
seemingly magic newlines and spaces.

Signed-off-by: John Pennycook <[email protected]>
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]>
@Pennycook Pennycook added the enhancement New feature or request label Aug 30, 2024
@Pennycook Pennycook added this to the 2.0.0 milestone Aug 30, 2024
@Pennycook Pennycook merged commit 356b121 into intel:main Aug 30, 2024
3 checks passed
@Pennycook Pennycook deleted the help-format branch August 30, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Help strings have inconsistent formatting
2 participants