From bc4da55dbabf85a7c1328f3c84e9021da618e650 Mon Sep 17 00:00:00 2001 From: Kyle Andelin Date: Sun, 31 Jul 2022 09:12:55 -0400 Subject: [PATCH 1/2] Add support for setting --hyperlinks via the RICH_HYPERLINKS environment variable --- CHANGELOG.md | 3 ++- README.md | 6 ++++++ pyproject.toml | 2 +- src/rich_cli/__main__.py | 10 ++++++++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b15e17..08f1d4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [1.9.0] - 2022-07-31 ### Changed - Rich-CLI now assumes that the input file is encoded in UTF-8 https://github.com/Textualize/rich-cli/pull/56 +- Add support for setting `--hyperlinks` via the `RICH_HYPERLINKS` environment variable https://github.com/Textualize/rich-cli/pull/58 ## [1.8.0] - 2022-05-07 diff --git a/README.md b/README.md index 21f9bb6..01c3e3e 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,12 @@ If your terminal supports hyperlinks, you can add `--hyperlinks` or `-y` which w rich README.md --hyperlinks ``` +This can also be set via the `RICH_HYPERLINKS` environment variable. So the following is equivalent to the above command: + +``` +RICH_HYPERLINKS=true rich README.md +``` + ## Jupyter notebook You can request Jupyter notebook rendering by adding the `--ipynb` switch. If the file ends with `.ipynb` Jupyter notebook will be auto-detected. diff --git a/pyproject.toml b/pyproject.toml index f766f86..c6cfa1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "rich-cli" homepage = "https://github.com/Textualize/rich-cli" -version = "1.8.0" +version = "1.9.0" description = "Command Line Interface to Rich" authors = ["Will McGugan "] license = "MIT" diff --git a/src/rich_cli/__main__.py b/src/rich_cli/__main__.py index aa0a068..493bcf4 100644 --- a/src/rich_cli/__main__.py +++ b/src/rich_cli/__main__.py @@ -37,7 +37,7 @@ "toml": "toml", } -VERSION = "1.8.0" +VERSION = "1.9.0" AUTO = 0 @@ -370,7 +370,13 @@ class OptionHighlighter(RegexHighlighter): default=None, help="Use [b]LEXER[/b] for syntax highlighting. [dim]See https://pygments.org/docs/lexers/", ) -@click.option("--hyperlinks", "-y", is_flag=True, help="Render hyperlinks in markdown.") +@click.option( + "--hyperlinks", + "-y", + is_flag=True, + help="Render hyperlinks in markdown.", + envvar="RICH_HYPERLINKS", +) @click.option( "--no-wrap", is_flag=True, help="Don't word wrap syntax highlighted files." ) From 86ee1a918abe2eba0b17cc4e02b8ba966522c1a9 Mon Sep 17 00:00:00 2001 From: Kyle Andelin <7277377+andelink@users.noreply.github.com> Date: Sun, 31 Jul 2022 09:40:02 -0400 Subject: [PATCH 2/2] Update PR link in CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08f1d4c..c7fd097 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Rich-CLI now assumes that the input file is encoded in UTF-8 https://github.com/Textualize/rich-cli/pull/56 -- Add support for setting `--hyperlinks` via the `RICH_HYPERLINKS` environment variable https://github.com/Textualize/rich-cli/pull/58 +- Add support for setting `--hyperlinks` via the `RICH_HYPERLINKS` environment variable https://github.com/Textualize/rich-cli/pull/61 ## [1.8.0] - 2022-05-07