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

Panels Can Fit To Content #1096

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

harkabeeparolus
Copy link

@harkabeeparolus harkabeeparolus commented Dec 20, 2024

Provide an option for using Rich Panel.fit() aka Panel(expand=False) for help panels and errors. This was mentioned in discussion #607 and #680. To opt into this new, non-default behavior, just use:

app = typer.Typer(rich_expand=False)

I think this can look nicer on very wide terminals, especially for CLIs with few parameters, or short parameter descriptions, so I would prefer to have the option to choose this style sometimes.

Status

  • The code worked fine on all the examples I tried from the Typer tutorial
  • The documentation I added is perhaps a little sparse.
    • I don't know yet how to capture command output for the Typer docs, and I think an example is needed. Help?
  • I'm not sure how to write tests for this. Suggestions are welcome!

Example

rich_expand_example

Copy link

@svlandeg svlandeg added the feature New feature, enhancement or request label Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature, enhancement or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants