diff options
Diffstat (limited to 'Messages.hs')
-rw-r--r-- | Messages.hs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Messages.hs b/Messages.hs index 6f4880e2d..d7eabccbb 100644 --- a/Messages.hs +++ b/Messages.hs @@ -20,6 +20,8 @@ module Messages ( warning, indent, maybeShowJSON, + showWith, + setupConsole ) where @@ -31,7 +33,7 @@ import qualified Annex import qualified Messages.JSON as JSON showStart :: String -> String -> Annex () -showStart command file = handle (JSON.start command file) $ +showStart command file = handle (JSON.start command $ Just file) $ flushed $ putStr $ command ++ " " ++ file ++ " " showNote :: String -> Annex () @@ -111,6 +113,16 @@ handle json normal = do maybeShowJSON :: JSON a => [(String, a)] -> Annex () maybeShowJSON v = handle (JSON.add v) q +{- Performs an a action (such as displaying something) only when + - not in json mode, and not quiet. -} +showWith :: Annex () -> Annex () +showWith a = do + output <- Annex.getState Annex.output + case output of + Annex.NormalOutput -> a + Annex.QuietOutput -> q + Annex.JSONOutput -> q + q :: Monad m => m () q = return () |