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

Feature request: support setting --hyperlinks via the RICH_HYPERLINKS environment variable #62

Open
andelink opened this issue Jul 31, 2022 · 3 comments

Comments

@andelink
Copy link

Hi team, I've just discovered Rich and this CLI and I'm a big fan. Thanks for making this such an awesome tool!

While using it, I quickly noticed a desire to set-and-forget the --hyperlinks flag so I would not need to pass it every time. So making this an official request and have opened a PR for your review:

This is the only change:

envvar="RICH_HYPERLINKS",

Hopefully you can take a look when you have a chance. Thanks!

@andelink
Copy link
Author

andelink commented Aug 16, 2022

@willmcgugan
Copy link
Collaborator

Seems reasonable. There are probably a few other env vars that could be added. Such as default theme.

@andelink
Copy link
Author

I believe a default theme is already supported via RICH_THEME:

@click.option(
"--theme",
metavar="THEME",
help="Set syntax theme to [b]THEME[/b]. [dim]See https://pygments.org/styles/",
default="ansi_dark",
envvar="RICH_THEME",
)


There are a few more listed in the rich docs:

Rich respects some standard environment variables.

Setting the environment variable TERM to "dumb" or "unknown" will disable color/style and some features that require moving the cursor, such as progress bars.

If the environment variable NO_COLOR is set, Rich will disable all color in the output.

If width/height arguments are not explicitly provided as arguments to Console then the environment variables COLUMNS/LINES can be used to set the console width/height. JUPYTER_COLUMNS/JUPYTER_LINES behave similarly and are used in Jupyter.

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

No branches or pull requests

2 participants