ewels / rich-click

Format click help output nicely with rich.
https://ewels.github.io/rich-click/
MIT License
630 stars 36 forks source link

rich_click.confirm does not translate color tags #214

Open pkulev opened 1 week ago

pkulev commented 1 week ago
изображение
In [8]: rich_click.__version__
Out[8]: '1.8.3'
dwreeves commented 1 week ago

Thanks for opening this issue!

This is related to #73 and #29.

I would say this is not a bug, it is intentional. We do not rich mark-up click.confirm() (and click.prompt()) for the same reason we do not rich mark-up click.echo(). The rationale is described in this comment here: https://github.com/ewels/rich-click/pull/29#issuecomment-2081474377

Rich has an internal feature for this as well: https://rich.readthedocs.io/en/stable/prompt.html

import rich.prompt
yes = rich.prompt.Confirm.ask("Confirm?")

I'll keep this issue open for now, but I am leaning toward this not being something we will do. IMO, users interested in a click.confirm() or click.prompt() that is marked up should use the rich.prompt module.

That said, we still don't document this intentional decision, and we should point users toward this alternative.