From 092e6b0f3f61ad3ede912a00bbbeb635ab9bc267 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 4 Apr 2015 14:34:03 -0400 Subject: 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. --- Messages.hs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Messages.hs') 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 -- cgit v1.2.3