]> Git — Sourcephile - comptalang.git/blob - cli/Hcompta/CLI/Main.hs
Ajout : Lib.TreeMap.Zipper : en prévision de collectes « à la XSLT » sur Chart.
[comptalang.git] / cli / Hcompta / CLI / Main.hs
1 {-# LANGUAGE OverloadedStrings #-}
2 {-# LANGUAGE TupleSections #-}
3 module Main (main) where
4
5 import qualified Data.Text.Lazy as TL
6 import Prelude
7 import System.Environment (getArgs)
8
9 import qualified Hcompta.CLI.Args as Args
10 import qualified Hcompta.CLI.Command as Command
11 import qualified Hcompta.CLI.Context as C
12 import qualified Hcompta.CLI.Lang as Lang
13 import qualified Hcompta.CLI.Write as Write
14 import qualified Hcompta.Lib.Leijen as W
15 import Hcompta.Lib.Leijen ((<>))
16
17 main :: IO ()
18 main = do
19 (c, cmds) <- do
20 c <- C.context
21 getArgs >>= Args.parse c Command.usage Command.options . (c,)
22 case cmds of
23 cmd:args -> Command.run c cmd args
24 [] -> Command.usage c
25 >>= Write.fatal c .
26 ((C.translate c Lang.Error_One_command_is_required <> W.line) <>) .
27 W.text . TL.pack