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.
This commit is contained in:
parent
ff2eeaf054
commit
2343f99c85
11 changed files with 117 additions and 59 deletions
14
Messages.hs
14
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue