mirror of
https://github.com/sharkdp/bat.git
synced 2025-08-09 23:57:48 +02:00
Add --diagnostic option to bat
This commit is contained in:
@ -477,6 +477,12 @@ 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")
|
||||
.hidden_short_help(true)
|
||||
.help("Show diagnostic information for bug reports.")
|
||||
)
|
||||
.help_message("Print this help message.")
|
||||
.version_message("Show version information.");
|
||||
|
||||
|
@ -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,27 @@ 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, collectors::*};
|
||||
|
||||
bugreport!()
|
||||
.info(SoftwareVersion::default())
|
||||
.info(OperatingSystem::default())
|
||||
.info(CommandLine::default())
|
||||
.info(EnvironmentVariables::list(&[
|
||||
"SHELL",
|
||||
"PAGER",
|
||||
"BAT_PAGER",
|
||||
"BAT_CONFIG_PATH",
|
||||
"BAT_STYLE",
|
||||
"BAT_THEME",
|
||||
"BAT_TABS",
|
||||
]))
|
||||
.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,
|
||||
|
Reference in New Issue
Block a user