mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-10-31 15:12:12 +00:00 
			
		
		
		
	Add --no-config option
This commit is contained in:
		| @@ -98,7 +98,9 @@ impl App { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     fn matches(interactive_output: bool) -> ArgMatches<'static> { |     fn matches(interactive_output: bool) -> ArgMatches<'static> { | ||||||
|         let args = if wild::args_os().nth(1) == Some("cache".into()) { |         let args = if wild::args_os().nth(1) == Some("cache".into()) | ||||||
|  |             || wild::args_os().any(|arg| arg == "--no-config") | ||||||
|  |         { | ||||||
|             // Skip the arguments in bats config file |             // Skip the arguments in bats config file | ||||||
|  |  | ||||||
|             wild::args_os().collect::<Vec<_>>() |             wild::args_os().collect::<Vec<_>>() | ||||||
|   | |||||||
| @@ -243,6 +243,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> { | |||||||
|                 .hidden(true) |                 .hidden(true) | ||||||
|                 .help("Set the width of the terminal"), |                 .help("Set the width of the terminal"), | ||||||
|         ) |         ) | ||||||
|  |         .arg( | ||||||
|  |             Arg::with_name("no-config") | ||||||
|  |                 .long("no-config") | ||||||
|  |                 .hidden(true) | ||||||
|  |                 .help("Do not use the configuration file"), | ||||||
|  |         ) | ||||||
|         .subcommand( |         .subcommand( | ||||||
|             SubCommand::with_name("cache") |             SubCommand::with_name("cache") | ||||||
|                 .about("Modify the syntax-definition and theme cache") |                 .about("Modify the syntax-definition and theme cache") | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ use std::process::Command; | |||||||
| fn bat() -> Command { | fn bat() -> Command { | ||||||
|     let mut cmd = Command::main_binary().unwrap(); |     let mut cmd = Command::main_binary().unwrap(); | ||||||
|     cmd.current_dir("tests/examples"); |     cmd.current_dir("tests/examples"); | ||||||
|  |     cmd.arg("--no-config"); | ||||||
|     cmd |     cmd | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -43,6 +43,7 @@ impl BatTester { | |||||||
|             .current_dir(self.temp_dir.path()) |             .current_dir(self.temp_dir.path()) | ||||||
|             .args(&[ |             .args(&[ | ||||||
|                 "sample.rs", |                 "sample.rs", | ||||||
|  |                 "--no-config", | ||||||
|                 "--paging=never", |                 "--paging=never", | ||||||
|                 "--color=never", |                 "--color=never", | ||||||
|                 "--decorations=always", |                 "--decorations=always", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user