From 26111950b368f9ce5552284b5d923bc62568bc9b Mon Sep 17 00:00:00 2001 From: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com> Date: Sat, 5 Aug 2023 21:18:38 +0200 Subject: [PATCH] Add environment variable `BAT_PAGING` --- CHANGELOG.md | 2 ++ doc/long-help.txt | 4 ++-- src/bin/bat/clap_app.rs | 2 +- src/bin/bat/config.rs | 1 + src/bin/bat/main.rs | 1 + 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4d076a3..30bc2627 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Features +- Add environment variable `BAT_PAGING`, see #2629 (@einfachIrgendwer0815) + ## Bugfixes - Fix `more` not being found on Windows when provided via `BAT_PAGER`, see #2570, #2580, and #2651 (@mataha) diff --git a/doc/long-help.txt b/doc/long-help.txt index dafcfd7a..247120fb 100644 --- a/doc/long-help.txt +++ b/doc/long-help.txt @@ -89,8 +89,8 @@ Options: --paging Specify when to use the pager. To disable the pager, use --paging=never' or its - alias,'-P'. To disable the pager permanently, set BAT_PAGER to an empty string. To control - which pager is used, see the '--pager' option. Possible values: *auto*, never, always. + alias,'-P'. To disable the pager permanently, set BAT_PAGING to 'never'. To control which + pager is used, see the '--pager' option. Possible values: *auto*, never, always. --pager Determine which pager is used. This option will override the PAGER and BAT_PAGER diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs index 2f632686..acdd1d08 100644 --- a/src/bin/bat/clap_app.rs +++ b/src/bin/bat/clap_app.rs @@ -311,7 +311,7 @@ pub fn build_app(interactive_output: bool) -> Command { .long_help( "Specify when to use the pager. To disable the pager, use \ --paging=never' or its alias,'-P'. To disable the pager permanently, \ - set BAT_PAGER to an empty string. To control which pager is used, see the \ + set BAT_PAGING to 'never'. To control which pager is used, see the \ '--pager' option. Possible values: *auto*, never, always." ), ) diff --git a/src/bin/bat/config.rs b/src/bin/bat/config.rs index 4abae4a6..9e38dfa4 100644 --- a/src/bin/bat/config.rs +++ b/src/bin/bat/config.rs @@ -142,6 +142,7 @@ pub fn get_args_from_env_vars() -> Vec { ("--tabs", "BAT_TABS"), ("--theme", "BAT_THEME"), ("--pager", "BAT_PAGER"), + ("--paging", "BAT_PAGING"), ("--style", "BAT_STYLE"), ] .iter() diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs index 65eb6f53..385140e6 100644 --- a/src/bin/bat/main.rs +++ b/src/bin/bat/main.rs @@ -255,6 +255,7 @@ fn invoke_bugreport(app: &App, cache_dir: &Path) { "LANG", "LC_ALL", "BAT_PAGER", + "BAT_PAGING", "BAT_CACHE_PATH", "BAT_CONFIG_PATH", "BAT_OPTS",