1 {-# LANGUAGE NamedFieldPuns #-}
2 {-# LANGUAGE OverloadedStrings #-}
3 module Hcompta.CLI.Context where
5 import Control.Monad (liftM)
6 import qualified Data.List
7 import Data.Maybe (catMaybes)
8 import System.Environment (getEnvironment)
9 import System.IO.Memoize (once)
15 { verbosity :: Verbosity
26 { verbosity = Verbosity_Info
37 deriving (Bounded, Enum, Eq, Ord, Show)
39 -- TODO: check that this is expected behavior
40 -- and portability issues
41 get_langs :: IO [String]
47 let short = takeWhile ('_' /=) lang in
51 . Data.List.takeWhile (\c -> c /= '.') ) $
53 [ Data.List.lookup "LC_ALL" env
54 , Data.List.lookup "LC_CTYPE" env
55 , Data.List.lookup "LANG" env