mirror of
https://github.com/sharkdp/bat
synced 2024-11-08 19:10:41 +00:00
Use less binary specified in bat config for --diagnostic
This commit is contained in:
parent
025c5c061b
commit
f874c8e4db
@ -229,6 +229,8 @@ fn run() -> Result<bool> {
|
|||||||
|
|
||||||
if app.matches.is_present("diagnostic") {
|
if app.matches.is_present("diagnostic") {
|
||||||
use bugreport::{bugreport, collector::*, format::Markdown};
|
use bugreport::{bugreport, collector::*, format::Markdown};
|
||||||
|
let pager = bat::config::get_pager_executable(app.matches.value_of("pager"))
|
||||||
|
.unwrap_or("less".to_owned()); // FIXME: Avoid non-canonical path to "less".
|
||||||
|
|
||||||
bugreport!()
|
bugreport!()
|
||||||
.info(SoftwareVersion::default())
|
.info(SoftwareVersion::default())
|
||||||
@ -252,7 +254,7 @@ fn run() -> Result<bool> {
|
|||||||
]))
|
]))
|
||||||
.info(FileContent::new("Config file", config_file()))
|
.info(FileContent::new("Config file", config_file()))
|
||||||
.info(CompileTimeInformation::default())
|
.info(CompileTimeInformation::default())
|
||||||
.info(CommandOutput::new("Less version", "less", &["--version"]))
|
.info(CommandOutput::new("Less version", pager, &["--version"]))
|
||||||
.print::<Markdown>();
|
.print::<Markdown>();
|
||||||
|
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
|
@ -84,6 +84,15 @@ pub struct Config<'a> {
|
|||||||
pub highlighted_lines: HighlightedLineRanges,
|
pub highlighted_lines: HighlightedLineRanges,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(all(feature = "application", feature = "paging"))]
|
||||||
|
pub fn get_pager_executable(config_pager: Option<&str>) -> Option<String> {
|
||||||
|
if let Ok(Some(pager)) = crate::pager::get_pager(config_pager) {
|
||||||
|
Some(pager.bin)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn default_config_should_include_all_lines() {
|
fn default_config_should_include_all_lines() {
|
||||||
use crate::line_range::RangeCheckResult;
|
use crate::line_range::RangeCheckResult;
|
||||||
|
Loading…
Reference in New Issue
Block a user