eonu / feud

Build powerful CLIs with simple idiomatic Python, driven by type hints. Not all arguments are bad.
https://feud.readthedocs.io
MIT License
57 stars 2 forks source link

Define `feud.click.is_rich` to check if `rich_click` is installed #130

Closed eonu closed 10 months ago

eonu commented 10 months ago

Does this suggestion already exist?

Feature description

There is currently no easy way to check whether rich_click is installed and being used.

A simple way to do this is to change:

https://github.com/eonu/feud/blob/e196e2ad15711eb0fdd9e38886c702a48081a0e3/feud/click/__init__.py#L8-L11

To:


#: Whether ``rich_click`` is installed or not.
is_rich: bool

try: 
    from rich_click import * 
    is_rich = True
except ImportError: 
    from click import * 
    is_rich = False

Then feud.click.is_rich can be used within the code base or by the user.

Existing parts of the code base relying on similar checks should be updated to re-use this variable.

eonu commented 10 months ago

Fixed in #132.