From 495e7fd3b1766c889f048a88c9702310f6d7c1a6 Mon Sep 17 00:00:00 2001
From: sharkdp <davidpeter@web.de>
Date: Thu, 11 Oct 2018 21:40:14 +0200
Subject: [PATCH] Add --no-config option

---
 src/app.rs                 | 4 +++-
 src/clap_app.rs            | 6 ++++++
 tests/integration_tests.rs | 1 +
 tests/tester.rs            | 1 +
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/app.rs b/src/app.rs
index 19f489a4..d9950c47 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -98,7 +98,9 @@ impl App {
     }
 
     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
 
             wild::args_os().collect::<Vec<_>>()
diff --git a/src/clap_app.rs b/src/clap_app.rs
index 9c1642e2..eab2e29c 100644
--- a/src/clap_app.rs
+++ b/src/clap_app.rs
@@ -243,6 +243,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
                 .hidden(true)
                 .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::with_name("cache")
                 .about("Modify the syntax-definition and theme cache")
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs
index 58482386..be68d677 100644
--- a/tests/integration_tests.rs
+++ b/tests/integration_tests.rs
@@ -6,6 +6,7 @@ use std::process::Command;
 fn bat() -> Command {
     let mut cmd = Command::main_binary().unwrap();
     cmd.current_dir("tests/examples");
+    cmd.arg("--no-config");
     cmd
 }
 
diff --git a/tests/tester.rs b/tests/tester.rs
index 859c6f12..7307e2f9 100644
--- a/tests/tester.rs
+++ b/tests/tester.rs
@@ -43,6 +43,7 @@ impl BatTester {
             .current_dir(self.temp_dir.path())
             .args(&[
                 "sample.rs",
+                "--no-config",
                 "--paging=never",
                 "--color=never",
                 "--decorations=always",