summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Nordholts <enselic@gmail.com>2021-01-07 12:56:47 +0100
committerMartin Nordholts <enselic@gmail.com>2021-01-07 12:58:26 +0100
commitda1016662588cae98aeb96b2ec570b14f02f9c62 (patch)
tree0fb64d8ab5c0427251527ff6b300f98955211bf6 /src
parent46487b201ff0f4cdcbfdea9d328cbac6d29a22d1 (diff)
parentb6b7262962ab67d34ad98788aff6ed78f1e763e3 (diff)
Merge remote-tracking branch 'origin/master' into fix-1063
Diffstat (limited to 'src')
-rw-r--r--src/bin/bat/clap_app.rs7
-rw-r--r--src/bin/bat/main.rs33
2 files changed, 38 insertions, 2 deletions
diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs
index 4e642760..87cb2a65 100644
--- a/src/bin/bat/clap_app.rs
+++ b/src/bin/bat/clap_app.rs
@@ -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.");
diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs
index af8ca787..e2862fe9 100644
--- a/src/bin/bat/main.rs
+++ b/src/bin/bat/main.rs
@@ -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,