Skip to content

Commit

Permalink
feat(cli): TANKA_PAGER environment variable (#1047)
Browse files Browse the repository at this point in the history
Adds TANKA_PAGER environment variable. Takes precedence over PAGER. If
unset, PAGER works as it did before.
  • Loading branch information
rrotter authored Jun 4, 2024
1 parent 6def867 commit ce9a47a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cmd/tk/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ func pageln(i ...interface{}) error {
// If the PAGER environment variable is empty, no pager is used.
// If the PAGER environment variable is unset, use GNU less with convenience flags.
func fPageln(r io.Reader) error {
pager, ok := os.LookupEnv("PAGER")
pager, ok := os.LookupEnv("TANKA_PAGER")
if !ok {
pager, ok = os.LookupEnv("PAGER")
}
if !ok {
// --RAW-CONTROL-CHARS Honors colors from diff. Must be in all caps, otherwise display issues occur.
// --quit-if-one-screen Closer to the git experience.
Expand Down
7 changes: 6 additions & 1 deletion docs/src/content/docs/env-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ sidebar:
**Description**: Path to the `kustomize` executable
**Default**: `$PATH/kustomize`

## PAGER
## TANKA_PAGER

**Description**: Pager to use when displaying output. Set to an empty string to disable paging.
**Default**: `$PAGER`

## PAGER

**Description**: Pager to use when displaying output. Only used if TANKA_PAGER is not set. Set to an empty string to disable paging.
**Default**: `less --RAW-CONTROL-CHARS --quit-if-one-screen --no-init`

0 comments on commit ce9a47a

Please sign in to comment.