From 4de2862a04cfdf18ea30f0101c1f0620f57dde60 Mon Sep 17 00:00:00 2001 From: Lennart Spitzner Date: Sun, 23 Jun 2019 17:21:02 +0200 Subject: [PATCH] Add commandline flag --no-user-config Stops brittany from trying to read a user-global config flag. Together with --config-file, this can be used to pass one single config to brittany, thereby controlling exactly and explicit what the inputs of brittany are. Should be useful for testing stuff that might depend on config. --- src-brittany/Main.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src-brittany/Main.hs b/src-brittany/Main.hs index 357a4cc..527d2e8 100644 --- a/src-brittany/Main.hs +++ b/src-brittany/Main.hs @@ -146,6 +146,7 @@ mainCmdParser helpDesc = do printHelp <- addSimpleBoolFlag "h" ["help"] mempty printVersion <- addSimpleBoolFlag "" ["version"] mempty printLicense <- addSimpleBoolFlag "" ["license"] mempty + noUserConfig <- addSimpleBoolFlag "" ["no-user-config"] mempty configPaths <- addFlagStringParams "" ["config-file"] "PATH" @@ -217,7 +218,11 @@ mainCmdParser helpDesc = do else pure configPaths config <- - runMaybeT (readConfigsWithUserConfig cmdlineConfig configsToLoad) + runMaybeT + (if noUserConfig + then readConfigs cmdlineConfig configsToLoad + else readConfigsWithUserConfig cmdlineConfig configsToLoad + ) >>= \case Nothing -> System.Exit.exitWith (System.Exit.ExitFailure 53) Just x -> return x