1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-01 19:02:22 +01:00

Merge remote-tracking branch 'origin/master' into fix-1063

This commit is contained in:
Martin Nordholts
2021-01-07 12:56:47 +01:00
8 changed files with 243 additions and 354 deletions

View File

@@ -477,6 +477,13 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
.hidden(true)
.help("Show bat's cache directory."),
)
.arg(
Arg::with_name("diagnostic")
.long("diagnostic")
.alias("diagnostics")
.hidden_short_help(true)
.help("Show diagnostic information for bug reports.")
)
.help_message("Print this help message.")
.version_message("Show version information.");

View File

@@ -35,8 +35,7 @@ use bat::{
error::*,
input::Input,
style::{StyleComponent, StyleComponents},
MappingTarget,
PagingMode,
MappingTarget, PagingMode,
};
const THEME_PREVIEW_DATA: &[u8] = include_bytes!("../../../assets/theme_preview.rs");
@@ -228,6 +227,36 @@ fn run_controller(inputs: Vec<Input>, config: &Config) -> Result<bool> {
fn run() -> Result<bool> {
let app = App::new()?;
if app.matches.is_present("diagnostic") {
use bugreport::{bugreport, collector::*, format::Markdown};
bugreport!()
.info(SoftwareVersion::default())
.info(OperatingSystem::default())
.info(CommandLine::default())
.info(EnvironmentVariables::list(&[
"SHELL",
"PAGER",
"BAT_CACHE_PATH",
"BAT_CONFIG_PATH",
"BAT_OPTS",
"BAT_PAGER",
"BAT_STYLE",
"BAT_TABS",
"BAT_THEME",
"XDG_CONFIG_HOME",
"XDG_CACHE_HOME",
"COLORTERM",
"NO_COLOR",
]))
.info(FileContent::new("Config file", config_file()))
.info(CompileTimeInformation::default())
.info(CommandOutput::new("Less version", "less", &["--version"]))
.print::<Markdown>();
return Ok(true);
}
match app.matches.subcommand() {
("cache", Some(cache_matches)) => {
// If there is a file named 'cache' in the current working directory,