diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-03-12 15:54:59 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-03-12 15:54:59 +0800 |
| commit | 9d812580557cdc343378816cd65678b8aa75d944 (patch) | |
| tree | b1a3397e38d9620a487aed409fc94310f101bc27 /utils/src/env/pager.rs | |
| parent | 0a95bae451c1847f4f0b9601e60959f4e8e6b669 (diff) | |
Add lang field to command context and reorganize utils modules
Diffstat (limited to 'utils/src/env/pager.rs')
| -rw-r--r-- | utils/src/env/pager.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/src/env/pager.rs b/utils/src/env/pager.rs new file mode 100644 index 0000000..3fdb1c3 --- /dev/null +++ b/utils/src/env/pager.rs @@ -0,0 +1,15 @@ +/// Gets the default pager based on environment variables. +/// +/// The function checks the JV_PAGER environment variable +/// and returns its value if it is set. If the variable is not set, +/// it returns "less" as the default pager. +/// +/// # Returns +/// A String containing the default pager +pub async fn get_default_pager() -> String { + if let Ok(pager) = std::env::var("JV_PAGER") { + return pager; + } + + "less".to_string() +} |
