Difference in epilog handling vs main help handling #1400
Unanswered
EnigmaticCypher
asked this question in
Questions
Replies: 2 comments
-
|
Showing an example of what the output looks like with the line stripping in place (ie the default behaviour): But what I'd like is to have the output actually match what's in the string, where it'd look like this: |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Hi @EnigmaticCypher, thanks for the report! I had a look into this and created a PR #1405. If you could check whether that solves your issues, that'd be great. Feel free to leave a review directly on the PR 🙏 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
My main question is simple: why is the handling for epilog different from the main help string? Typer strips out additional line endings from the epilog, which is not always desirable (especially in the case of wanting to list examples commands with newlines between the example commands to prevent the examples being too densely packed together. Investigation of the code contained in https://github.com/fastapi/typer/blob/master/typer/rich_utils.py shows how this occurs.
The main help string is being formatted & handled like this: (inside
rich_format_help())Source: https://github.com/fastapi/typer/blob/master/typer/rich_utils.py#L574
But then the epilog is being handled very differently:
Source: https://github.com/fastapi/typer/blob/master/typer/rich_utils.py#L685
Can we make it configurable so that the epilog does not strip out extra newlines unless the person desires it? I would be quite happy if there was a flag that a user can specify that causes the epilog to be handled the same way that the normal help string is handled in terms of newline stripping.
Operating System
Windows, macOS, Other
Operating System Details
Applies to all operating systems (I've tested on Windows 10/11/RHEL 8)
Typer Version
0.20.0
Python Version
3.11.9
Additional Context
The only other conversation related to epilog formatting I've found is this one here: #1211 but this seems specifically interested in an additional newline at the end which always gets printed, and that's not overly impactful to what I'm building.
Beta Was this translation helpful? Give feedback.
All reactions