2012-04-27 17:23:52 +00:00
|
|
|
{- git-annex Messages data types
|
|
|
|
-
|
2015-01-21 16:50:09 +00:00
|
|
|
- Copyright 2012 Joey Hess <id@joeyh.name>
|
2012-04-27 17:23:52 +00:00
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
2015-11-04 20:19:00 +00:00
|
|
|
{-# LANGUAGE CPP #-}
|
|
|
|
|
2012-04-27 17:23:52 +00:00
|
|
|
module Types.Messages where
|
|
|
|
|
2015-04-03 23:56:56 +00:00
|
|
|
import Data.Default
|
2016-09-09 19:49:44 +00:00
|
|
|
import qualified Data.ByteString.Lazy as B
|
2015-04-03 23:56:56 +00:00
|
|
|
|
2015-11-04 20:19:00 +00:00
|
|
|
#ifdef WITH_CONCURRENTOUTPUT
|
|
|
|
import System.Console.Regions (ConsoleRegion)
|
|
|
|
#endif
|
|
|
|
|
2016-09-09 19:06:54 +00:00
|
|
|
data OutputType = NormalOutput | QuietOutput | JSONOutput Bool
|
2015-11-04 20:19:00 +00:00
|
|
|
deriving (Show)
|
2012-04-27 17:23:52 +00:00
|
|
|
|
|
|
|
data SideActionBlock = NoBlock | StartBlock | InBlock
|
2012-11-25 21:54:08 +00:00
|
|
|
deriving (Eq)
|
2012-04-27 17:23:52 +00:00
|
|
|
|
|
|
|
data MessageState = MessageState
|
|
|
|
{ outputType :: OutputType
|
2016-09-09 16:57:42 +00:00
|
|
|
, concurrentOutputEnabled :: Bool
|
2012-04-27 17:23:52 +00:00
|
|
|
, sideActionBlock :: SideActionBlock
|
2016-01-20 18:07:13 +00:00
|
|
|
, implicitMessages :: Bool
|
2015-11-06 16:51:25 +00:00
|
|
|
#ifdef WITH_CONCURRENTOUTPUT
|
2015-11-04 20:19:00 +00:00
|
|
|
, consoleRegion :: Maybe ConsoleRegion
|
|
|
|
, consoleRegionErrFlag :: Bool
|
2015-11-06 16:51:25 +00:00
|
|
|
#endif
|
2016-09-09 19:49:44 +00:00
|
|
|
, jsonBuffer :: B.ByteString
|
2012-04-27 17:23:52 +00:00
|
|
|
}
|
|
|
|
|
2015-04-03 23:56:56 +00:00
|
|
|
instance Default MessageState
|
|
|
|
where
|
2015-11-06 16:51:25 +00:00
|
|
|
def = MessageState
|
|
|
|
{ outputType = NormalOutput
|
2016-09-09 16:57:42 +00:00
|
|
|
, concurrentOutputEnabled = False
|
2015-11-06 16:51:25 +00:00
|
|
|
, sideActionBlock = NoBlock
|
2016-01-20 18:07:13 +00:00
|
|
|
, implicitMessages = True
|
2015-11-06 16:51:25 +00:00
|
|
|
#ifdef WITH_CONCURRENTOUTPUT
|
|
|
|
, consoleRegion = Nothing
|
|
|
|
, consoleRegionErrFlag = False
|
|
|
|
#endif
|
2016-09-09 19:49:44 +00:00
|
|
|
, jsonBuffer = B.empty
|
2015-11-06 16:51:25 +00:00
|
|
|
}
|