]> Git — Sourcephile - comptalang.git/blob - cli/Hcompta/CLI/Main.hs
Correction : Calc.Balance : infer_equilibrium : préservation du Posting lors de l...
[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 Context
12 import qualified Hcompta.CLI.Write as Write
13 import qualified Hcompta.Lib.Leijen as W
14 import Hcompta.Lib.Leijen ((<>))
15
16 main :: IO ()
17 main = do
18 (context, cmds) <- do
19 context <- Context.context
20 getArgs >>= Args.parse
21 context
22 Command.usage
23 Command.options .
24 (context,)
25 case cmds of
26 cmd:args -> Command.run context cmd args
27 [] -> Command.usage
28 >>= Write.fatal context .
29 ((W.text "one command is required" <> W.line) <>) .
30 W.text . TL.pack