diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-04-04 14:34:03 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-04-04 14:34:03 -0400 |
commit | 092e6b0f3f61ad3ede912a00bbbeb635ab9bc267 (patch) | |
tree | 57107e1a0aaedd9ceff8c4ec33ad1a8fffc6852a /Messages.hs | |
parent | b3b8a1cdfdc583159c117ebe76e3c6a4eb57114b (diff) |
well along the way to fully quiet --quiet
Came up with a generic way to filter out progress messages while keeping
errors, for commands that use stderr for both.
--json mode will disable command outputs too.
Diffstat (limited to 'Messages.hs')
-rw-r--r-- | Messages.hs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Messages.hs b/Messages.hs index 8cf4647cd..0e83a7243 100644 --- a/Messages.hs +++ b/Messages.hs @@ -31,6 +31,7 @@ module Messages ( setupConsole, enableDebugOutput, disableDebugOutput, + commandProgressDisabled, ) where import Text.JSON @@ -96,8 +97,8 @@ doSideAction' b a = do {- Make way for subsequent output of a command. -} showOutput :: Annex () -showOutput = handleMessage q $ - putStr "\n" +showOutput = unlessM commandProgressDisabled $ + handleMessage q $ putStr "\n" showLongNote :: String -> Annex () showLongNote s = handleMessage (JSON.note s) $ @@ -183,3 +184,12 @@ enableDebugOutput = updateGlobalLogger rootLoggerName $ setLevel DEBUG disableDebugOutput :: IO () disableDebugOutput = updateGlobalLogger rootLoggerName $ setLevel NOTICE + +{- Should commands that normally output progress messages have that + - output disabled? -} +commandProgressDisabled :: Annex Bool +commandProgressDisabled = withOutputType $ \t -> return $ case t of + QuietOutput -> True + ProgressOutput -> True + JSONOutput -> True + NormalOutput -> False |