Skip to content

Commit bc4da55

Browse files
committed
Add support for setting --hyperlinks via the RICH_HYPERLINKS environment variable
1 parent 0721cb1 commit bc4da55

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased]
8+
## [1.9.0] - 2022-07-31
99

1010
### Changed
1111

1212
- Rich-CLI now assumes that the input file is encoded in UTF-8 https://github.com/Textualize/rich-cli/pull/56
13+
- Add support for setting `--hyperlinks` via the `RICH_HYPERLINKS` environment variable https://github.com/Textualize/rich-cli/pull/58
1314

1415
## [1.8.0] - 2022-05-07
1516

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ If your terminal supports hyperlinks, you can add `--hyperlinks` or `-y` which w
100100
rich README.md --hyperlinks
101101
```
102102

103+
This can also be set via the `RICH_HYPERLINKS` environment variable. So the following is equivalent to the above command:
104+
105+
```
106+
RICH_HYPERLINKS=true rich README.md
107+
```
108+
103109
## Jupyter notebook
104110

105111
You can request Jupyter notebook rendering by adding the `--ipynb` switch. If the file ends with `.ipynb` Jupyter notebook will be auto-detected.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22
name = "rich-cli"
33
homepage = "https://github.com/Textualize/rich-cli"
4-
version = "1.8.0"
4+
version = "1.9.0"
55
description = "Command Line Interface to Rich"
66
authors = ["Will McGugan <[email protected]>"]
77
license = "MIT"

src/rich_cli/__main__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"toml": "toml",
3838
}
3939

40-
VERSION = "1.8.0"
40+
VERSION = "1.9.0"
4141

4242

4343
AUTO = 0
@@ -370,7 +370,13 @@ class OptionHighlighter(RegexHighlighter):
370370
default=None,
371371
help="Use [b]LEXER[/b] for syntax highlighting. [dim]See https://pygments.org/docs/lexers/",
372372
)
373-
@click.option("--hyperlinks", "-y", is_flag=True, help="Render hyperlinks in markdown.")
373+
@click.option(
374+
"--hyperlinks",
375+
"-y",
376+
is_flag=True,
377+
help="Render hyperlinks in markdown.",
378+
envvar="RICH_HYPERLINKS",
379+
)
374380
@click.option(
375381
"--no-wrap", is_flag=True, help="Don't word wrap syntax highlighted files."
376382
)

0 commit comments

Comments
 (0)