Skip to content

Commit

Permalink
make verbosity silent by default in script interpreter mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kadoban committed Dec 10, 2015
1 parent 296c16b commit f6a387d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/Stack/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,12 @@ execOptsExtraParser = eoPlainParser <|>
help "Use an unmodified environment (only useful with Docker)")

-- | Parser for global command-line options.
globalOptsParser :: Bool -> Parser GlobalOptsMonoid
globalOptsParser hide0 =
globalOptsParser :: Bool -> Maybe LogLevel -> Parser GlobalOptsMonoid
globalOptsParser hide0 defLogLevel =
GlobalOptsMonoid <$>
optional (strOption (long Docker.reExecArgName <> hidden <> internal)) <*>
optional (option auto (long dockerEntrypointArgName <> hidden <> internal)) <*>
logLevelOptsParser hide0 <*>
logLevelOptsParser hide0 defLogLevel <*>
configOptsParser hide0 <*>
optional (abstractResolverOptsParser hide0) <*>
optional (compilerOptsParser hide0) <*>
Expand Down Expand Up @@ -629,8 +629,8 @@ initOptsParser =
help "Use the given resolver, even if not all dependencies are met")

-- | Parser for a logging level.
logLevelOptsParser :: Bool -> Parser (Maybe LogLevel)
logLevelOptsParser hide =
logLevelOptsParser :: Bool -> Maybe LogLevel -> Parser (Maybe LogLevel)
logLevelOptsParser hide defLogLevel =
fmap (Just . parse)
(strOption (long "verbosity" <>
metavar "VERBOSITY" <>
Expand All @@ -640,7 +640,7 @@ logLevelOptsParser hide =
(short 'v' <> long "verbose" <>
help ("Enable verbose mode: verbosity level \"" <> showLevel verboseLevel <> "\"") <>
hideMods hide) <|>
pure Nothing
pure defLogLevel
where verboseLevel = LevelDebug
showLevel l =
case l of
Expand Down
4 changes: 3 additions & 1 deletion src/main/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ main = withInterpreterArgs stackProgName $ \args isInterpreter -> do
let globalOpts hide =
extraHelpOption hide progName (Docker.dockerCmdName ++ "*") dockerHelpOptName <*>
extraHelpOption hide progName (Nix.nixCmdName ++ "*") nixHelpOptName <*>
globalOptsParser hide
globalOptsParser hide (if isInterpreter
then Just $ LevelOther "silent"
else Nothing)
addCommand' cmd title footerStr constr =
addCommand cmd title footerStr constr (globalOpts True)
addSubCommands' cmd title footerStr =
Expand Down

0 comments on commit f6a387d

Please sign in to comment.