Skip to content

Commit

Permalink
new: added support for HL_PAGER variable
Browse files Browse the repository at this point in the history
  • Loading branch information
pamburus committed Feb 24, 2024
1 parent a7b4b54 commit 73d94cc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ categories = ["command-line-utilities"]
description = "Utility for viewing json-formatted log files."
keywords = ["cli", "human", "log"]
name = "hl"
version = "0.25.2"
version = "0.25.3-alpha.1"
edition = "2021"
build = "build.rs"

Expand Down
13 changes: 10 additions & 3 deletions src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@ pub struct Pager {

impl Pager {
pub fn new() -> Result<Self> {
let pager = match env::var("PAGER") {
Ok(pager) => pager,
_ => "less".into(),
let mut pager = "less".to_owned();

if let Ok(p) = env::var("HL_PAGER") {
if !p.is_empty() {
pager = p;
}
} else if let Ok(p) = env::var("PAGER") {
if !p.is_empty() {
pager = p;
}
};

let pager = shellwords::split(&pager).unwrap_or(vec![pager]);
Expand Down

0 comments on commit 73d94cc

Please sign in to comment.