summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Peter <mail@david-peter.de>2021-07-12 22:03:22 +0200
committerDavid Peter <sharkdp@users.noreply.github.com>2021-07-12 23:17:30 +0200
commit3fa09dbe2e1755740eda1de0900853c4a6ee5f3a (patch)
treea9dea7633da47b860576a6b2d2f45b1a19441ac2
parentbf2b2df9c9e218e35e5a38ce3d03cffb7c363956 (diff)
Use resolved path for --diagnostic as well
-rw-r--r--src/bin/bat/main.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs
index dadcc673..fb407b90 100644
--- a/src/bin/bat/main.rs
+++ b/src/bin/bat/main.rs
@@ -231,7 +231,7 @@ fn run() -> Result<bool> {
let pager = bat::config::get_pager_executable(app.matches.value_of("pager"))
.unwrap_or_else(|| "less".to_owned()); // FIXME: Avoid non-canonical path to "less".
- bugreport!()
+ let report = bugreport!()
.info(SoftwareVersion::default())
.info(OperatingSystem::default())
.info(CommandLine::default())
@@ -253,9 +253,19 @@ fn run() -> Result<bool> {
"MANPAGER",
]))
.info(FileContent::new("Config file", config_file()))
- .info(CompileTimeInformation::default())
- .info(CommandOutput::new("Less version", pager, &["--version"]))
- .print::<Markdown>();
+ .info(CompileTimeInformation::default());
+
+ let mut report = if let Ok(resolved_path) = grep_cli::resolve_binary(pager) {
+ report.info(CommandOutput::new(
+ "Less version",
+ resolved_path,
+ &["--version"],
+ ))
+ } else {
+ report
+ };
+
+ report.print::<Markdown>();
return Ok(true);
}