From ab27cac0cc1fe0290ccbb1985cceef7c24815544 Mon Sep 17 00:00:00 2001 From: Rodrigo Orem <8618619+rodorgas@users.noreply.github.com> Date: Mon, 5 Nov 2018 18:54:49 -0200 Subject: [PATCH] Remove args when change from bat to less --- src/output.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/output.rs b/src/output.rs index 7c007c00..193f2554 100644 --- a/src/output.rs +++ b/src/output.rs @@ -37,11 +37,15 @@ impl OutputType { .chain_err(|| "Could not parse (BAT_)PAGER environment variable.")?; match pagerflags.split_first() { - Some((initial_pager, args)) => { - let pager_name = match initial_pager.as_ref() { - "bat" => "less", - _ => initial_pager, - }; + Some((initial_pager, mut args)) => { + let pager_name; + if initial_pager == "bat" { + pager_name = "less"; + args = &[]; + } + else { + pager_name = initial_pager; + } let pager_path = PathBuf::from(pager_name); let is_less = pager_path.file_stem() == Some(&OsString::from("less"));