aboutsummaryrefslogtreecommitdiff
path: root/Command.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-09-05 15:32:59 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-09-05 15:34:38 -0400
commit1a5415ba53e2c231eef4801a928a175ca7fe4c1f (patch)
treed29e09a3356201c8e9f21c7fd164157188859523 /Command.hs
parent31f118f51dc3a8a32c0257209544dfb50542f696 (diff)
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.
Diffstat (limited to 'Command.hs')
-rw-r--r--Command.hs15
1 files changed, 3 insertions, 12 deletions
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)