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

Split extra help item computing with help record rendering #2516

Open
kdeldycke opened this issue May 16, 2023 · 2 comments · May be fixed by #2517
Open

Split extra help item computing with help record rendering #2516

kdeldycke opened this issue May 16, 2023 · 2 comments · May be fixed by #2517
Milestone

Comments

@kdeldycke
Copy link
Contributor

kdeldycke commented May 16, 2023

I maintain Click Extra, a drop-in replacement for Click which adds colorization of the help screen.

I am currently relying on finicky regular expressions to identify and match the extra items that are displayed at the end of each option's help. These extra items are rendered in square brackets and looks like:

  • [default: None]
  • [default: (unlimited)]
  • [env var: COLOR_CLI8_TIME; default: no-time]
  • and a variety of other formats.

The problem is that the generation of these extra items are deeply embedded within Click and are impossible to fetch independently.

That's why I propose a simple refactor of the Option.get_help_record() method, and split it in two:

  • a new method to compute the values of these extra items
  • keep the original get_help_record() as-is, but dedicated to help message rendering only

I have a PR that is ready at #2517.

@kdeldycke kdeldycke linked a pull request May 16, 2023 that will close this issue
6 tasks
@kdeldycke
Copy link
Contributor Author

Just wanted to ping @janluke on that issue, as he also maintain a Click-based extension that is also deep into help screen customization and coloring.

@kdeldycke
Copy link
Contributor Author

I've also heard rumors of upcoming big refactors regarding help screen generation, so I propose this small, un intrusive one as a small step towards the big one.

kdeldycke added a commit to kdeldycke/click-extra that referenced this issue May 16, 2023
@davidism davidism added this to the 8.2.0 milestone Jul 4, 2023
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 a pull request may close this issue.

2 participants