From 1a5415ba53e2c231eef4801a928a175ca7fe4c1f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 5 Sep 2016 15:32:59 -0400 Subject: Make --json and --quiet suppress automatic init messages And any other messages that might be output before a command starts. Fixes a reversion introduced in version 5.20150727. During the optparse-applicative conversion, I needed a place to run per-command global option setters, and I made it get run during the seek stage. But that is too late to have --json and --quiet disable output produced in the check stage. Fix is just to run those per-command global option setters at the same time as the all-command global option setters. This commit was sponsored by Thom May. --- Command.hs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'Command.hs') diff --git a/Command.hs b/Command.hs index 4ffc7c319..94a474257 100644 --- a/Command.hs +++ b/Command.hs @@ -33,7 +33,7 @@ import Types.ActionItem command :: String -> CommandSection -> String -> CmdParamsDesc -> (CmdParamsDesc -> CommandParser) -> Command command name section desc paramdesc mkparser = Command commonChecks False False name paramdesc - section desc (mkparser paramdesc) Nothing + section desc (mkparser paramdesc) [] Nothing {- Simple option parser that takes all non-option params as-is. -} withParams :: (CmdParams -> v) -> CmdParamsDesc -> Parser v @@ -68,18 +68,9 @@ noMessages c = c { cmdnomessages = True } noRepo :: (String -> Parser (IO ())) -> Command -> Command noRepo a c = c { cmdnorepo = Just (a (cmdparamdesc c)) } -{- Adds global options to a command's option parser, and modifies its seek - - option to first run actions for them. - -} +{- Adds global options to a command's. -} withGlobalOptions :: [GlobalOption] -> Command -> Command -withGlobalOptions os c = c { cmdparser = apply <$> mixin (cmdparser c) } - where - mixin p = (,) - <$> p - <*> combineGlobalOptions os - apply (seek, globalsetters) = do - void $ getParsed globalsetters - seek +withGlobalOptions os c = c { cmdglobaloptions = cmdglobaloptions c ++ os } {- For start and perform stages to indicate what step to run next. -} next :: a -> Annex (Maybe a) -- cgit v1.2.3