summaryrefslogtreecommitdiff
path: root/Messages.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-01-20 14:07:13 -0400
committerJoey Hess <joeyh@joeyh.name>2016-01-20 14:10:13 -0400
commit70b8cad9c826ed57e9607a7ac9436e67d050413d (patch)
treece71c3434120996ad72017905e96a58c838651ba /Messages.hs
parent7aac76d40e1d397faddc649405310ed94399c106 (diff)
make noMessages disable closing of json object in --json mode
This allows things like Command.Find to use noMessages and generate their own complete json objects. Previouly, Command.Find managed that only via a hack, which wasn't compatable with batch mode. Only Command.Find, Command.Smudge, and Commange.Status use noMessages currently, and none except for Command.Find are impacted by this change. Fixes find --json --batch output
Diffstat (limited to 'Messages.hs')
-rw-r--r--Messages.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/Messages.hs b/Messages.hs
index 7b4cff1021..cec0cb8a32 100644
--- a/Messages.hs
+++ b/Messages.hs
@@ -36,6 +36,7 @@ module Messages (
debugEnabled,
commandProgressDisabled,
outputMessage,
+ implicitMessage,
) where
import Text.JSON
@@ -212,3 +213,9 @@ commandProgressDisabled = withOutputType $ \t -> return $ case t of
JSONOutput -> True
NormalOutput -> False
ConcurrentOutput _ -> True
+
+{- Use to show a message that is displayed implicitly, and so might be
+ - disabled when running a certian command that needs more control over its
+ - output. -}
+implicitMessage :: Annex () -> Annex ()
+implicitMessage = whenM (implicitMessages <$> Annex.getState Annex.output)