use existing debug machinery for explain
explain is a kind of debug message, but not formatted in the same way. So it makes sense to reuse the debug machinery for it, since that is already quite optimised. Sponsored-by: Dartmouth College's DANDI project
This commit is contained in:
parent
fbf19338be
commit
409572c9e4
3 changed files with 49 additions and 16 deletions
|
@ -50,6 +50,7 @@ module Messages (
|
|||
outputMessage,
|
||||
withMessageState,
|
||||
MessageState,
|
||||
explain,
|
||||
prompt,
|
||||
mkPrompter,
|
||||
sanitizeTopLevelExceptionMessages,
|
||||
|
@ -281,6 +282,11 @@ debugDisplayer = do
|
|||
S.hPutStr stderr (safeOutput s <> "\n")
|
||||
hFlush stderr
|
||||
|
||||
explain :: Maybe String -> String -> Annex ()
|
||||
explain Nothing _ = return ()
|
||||
explain (Just f) msg = fastDebug' "explain" $
|
||||
RawDebugMessage ('[' : f ++ " " ++ msg ++ "]")
|
||||
|
||||
{- Should commands that normally output progress messages have that
|
||||
- output disabled? -}
|
||||
commandProgressDisabled :: Annex Bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue