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

Add support for setting --hyperlinks via the RICH_HYPERLINKS environment variable #61

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/61

## [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