]> Git — Sourcephile - comptalang.git/blob - cli/Hcompta/CLI/Context.hs
Ajout : Chart : Tags : Équilibre.
[comptalang.git] / cli / Hcompta / CLI / Context.hs
1 {-# LANGUAGE NamedFieldPuns #-}
2 {-# LANGUAGE FlexibleInstances #-}
3 {-# LANGUAGE OverloadedStrings #-}
4 module Hcompta.CLI.Context where
5
6 import Control.Monad (Monad(..))
7 import Data.Bool
8 import Data.String (String)
9 import Data.Eq (Eq)
10 import Data.Maybe (Maybe(..))
11 import Data.Ord (Ord)
12 import Text.Show (Show)
13 import Prelude (($), Bounded(..), Enum(..), IO)
14
15 import Hcompta.CLI.Lang
16
17 data App = App
18
19 data Context
20 = Context
21 { verbosity :: Verbosity
22 , command :: String
23 , color :: Maybe Bool
24 , lang :: Lang
25 } deriving (Show)
26
27 context :: IO Context
28 context = do
29 lang <- get_lang
30 return $
31 Context
32 { verbosity = Verbosity_Info
33 , command = ""
34 , color = Nothing
35 , lang
36 }
37
38 data Verbosity
39 = Verbosity_Error
40 | Verbosity_Warn
41 | Verbosity_Info
42 | Verbosity_Debug
43 deriving (Bounded, Enum, Eq, Ord, Show)
44