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

Integrate rich-argparse #1356

Merged
merged 1 commit into from
Nov 1, 2024
Merged

Integrate rich-argparse #1356

merged 1 commit into from
Nov 1, 2024

Conversation

kmvanbrunt
Copy link
Member

Added rich-argparse to cmd2.

One big change is that Cmd2ArgumentParser no longer defaults to using a raw help text formatter. Since we can use Rich renderables in descriptions and epilogs, I was able to get the desired paragraph separation with rich tables.

Only the history command needs a raw help text formatter now because of how we print the help for arg.
Since an argument's help text can't be a Rich renderable we have to include \n characters and only raw help text formatters preserve newlines.

This change is for cmd2 3.0.0.


edit_parser.epilog = edit_parser.create_text_group(
"Note",
Markdown("To set a new editor, run: `set editor <program>`"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being able to use Markdown is really cool.

@tleonhardt
Copy link
Member

I'll have to experiment with how this looks and such, but tentatively I think it is really cool and think we might want to put out an intermediate release before 3.0.0, e.g. 2.6.0, since from a quick look this doesn't really seem to break backwards compatibility in any major way.

@tleonhardt tleonhardt merged commit 5ce8407 into 3.0.0 Nov 1, 2024
44 checks passed
@tleonhardt tleonhardt deleted the rich-argparse branch November 1, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants