diff options
author | Joey Hess <joey@kitenet.net> | 2011-09-02 16:44:04 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-09-02 16:44:04 -0400 |
commit | d1dd40c49bb95416adec5b33e4dc1e7672a2f7f7 (patch) | |
tree | d8d1eee5f21463bd87b0b502fa54e468f34e4f9f /Messages.hs | |
parent | cb5dacfd403a5ca4e3bdeb3eb3d0009136966f91 (diff) |
avoid showing json lists of remotes when not in json mode
Diffstat (limited to 'Messages.hs')
-rw-r--r-- | Messages.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Messages.hs b/Messages.hs index 87d414f17..faa4dbcde 100644 --- a/Messages.hs +++ b/Messages.hs @@ -19,12 +19,14 @@ module Messages ( showErr, warning, indent, + maybeShowJSON, setupConsole ) where import Control.Monad.State (liftIO) import System.IO import Data.String.Utils +import Text.JSON import Types import qualified Annex @@ -106,5 +108,9 @@ handle json normal = do Annex.QuietOutput -> q Annex.JSONOutput -> liftIO json +{- Shows a JSON value only when in json mode. -} +maybeShowJSON :: JSON a => [(String, a)] -> Annex () +maybeShowJSON v = handle (JSON.add v) q + q :: Monad m => m () q = return () |