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.
remotes/felixonmars/release
Lennart Spitzner 2019-06-23 17:21:02 +02:00
parent 033fdc6517
commit 4de2862a04
1 changed files with 6 additions and 1 deletions

View File

@ -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