typer
typer copied to clipboard
Passing 'context_settings' to typer.Typer has no effect, but works for app.command()
First Check
- [X] I added a very descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Typer documentation, with the integrated search.
- [X] I already searched in Google "How to X in Typer" and didn't find any information.
- [X] I already read and followed all the tutorial in the docs and didn't find an answer.
- [X] I already checked if it is not related to Typer but to Click.
Commit to Help
- [X] I commit to help with one of those options 👆
Example Code
import typer
app = typer.Typer(context_settings=dict(max_content_width=800))
@app.command()
def main(
arg: str = typer.Argument(
...,
help=(
"This is an argument with a very long help text."
"This is an argument with a very long help text."
"This is an argument with a very long help text."
"This is an argument with a very long help text."
"This is an argument with a very long help text."
),
),
):
print("hello world")
if __name__ == "__main__":
app()
Description
I wanted to configure the line wrapping for all commands so that it is not always wrapped at 80 characters.
The apparent solution to this is to set a large max_content_width
in the context_settings
.
The expected behavior would be that the lines are now not wrapped for all commands.
(Save the example code and run python example.py --help
)
The bug(?) is that when I set this on typer.Typer
, it has no effect. But when you set context_settings
for individual commands, it works as expected.
Operating System
Linux
Operating System Details
Ubuntu 21.4
Typer Version
0.4.0
Python Version
3.9
Additional Context
No response