git-annex/Types/Messages.hs
Joey Hess 70b8cad9c8
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
2016-01-20 14:10:13 -04:00

44 lines
951 B
Haskell

{- git-annex Messages data types
-
- Copyright 2012 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
{-# LANGUAGE CPP #-}
module Types.Messages where
import Data.Default
#ifdef WITH_CONCURRENTOUTPUT
import System.Console.Regions (ConsoleRegion)
#endif
data OutputType = NormalOutput | QuietOutput | ConcurrentOutput Int | JSONOutput
deriving (Show)
data SideActionBlock = NoBlock | StartBlock | InBlock
deriving (Eq)
data MessageState = MessageState
{ outputType :: OutputType
, sideActionBlock :: SideActionBlock
, implicitMessages :: Bool
#ifdef WITH_CONCURRENTOUTPUT
, consoleRegion :: Maybe ConsoleRegion
, consoleRegionErrFlag :: Bool
#endif
}
instance Default MessageState
where
def = MessageState
{ outputType = NormalOutput
, sideActionBlock = NoBlock
, implicitMessages = True
#ifdef WITH_CONCURRENTOUTPUT
, consoleRegion = Nothing
, consoleRegionErrFlag = False
#endif
}