]> Git — Sourcephile - comptalang.git/blob - cli/Hcompta/CLI/Main.hs
Correction : Lib.Parsec : détection et propagation des erreurs.
[comptalang.git] / cli / Hcompta / CLI / Main.hs
1 {-# LANGUAGE TupleSections #-}
2 module Main (main) where
3 import Prelude
4 import System.Environment (getArgs)
5
6 import qualified Hcompta.CLI.Command as Command
7 import qualified Hcompta.CLI.Write as Write
8 import qualified Hcompta.CLI.Context as Context
9 import qualified Hcompta.CLI.Args as Args
10
11 main :: IO ()
12 main = do
13 (context, cmds) <- getArgs >>= Args.parse Context.nil Command.usage Command.options . (Context.nil,)
14 case cmds of
15 cmd:args -> Command.run context cmd args
16 [] -> Command.usage >>= Write.fatal context . ("one command is required\n" ++)