Skip to content

Commit

Permalink
Add support for setting --hyperlinks via the RICH_HYPERLINKS environm…
Browse files Browse the repository at this point in the history
…ent variable
  • Loading branch information
andelink committed Jul 31, 2022
1 parent 0721cb1 commit bc4da55
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "MIT"
Expand Down
10 changes: 8 additions & 2 deletions src/rich_cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"toml": "toml",
}

VERSION = "1.8.0"
VERSION = "1.9.0"


AUTO = 0
Expand Down Expand Up @@ -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."
)
Expand Down

0 comments on commit bc4da55

Please sign in to comment.