-
-
Notifications
You must be signed in to change notification settings - Fork 57
/
Main.hs
38 lines (31 loc) · 1.21 KB
/
Main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module Main where
import CommandParsers ( parseRomeOptions )
import Control.Monad.Except
import Control.Monad.Reader ( runReaderT )
import Data.Monoid ( (<>) )
import Data.UUID.V4 as UUID
( nextRandom )
import Lib
import Options.Applicative as Opts
import System.Exit
romeVersion :: RomeVersion
romeVersion = (0, 24, 0, 65)
-- Main
main :: IO ()
main = do
let opts = info
( Opts.helper
<*> Opts.flag' Nothing (Opts.long "version" <> Opts.help "Prints the version information" <> Opts.hidden)
<|> Just
<$> parseRomeOptions
)
(header "Cache tool for Carthage")
cmd <- execParser opts
case cmd of
Nothing -> putStrLn $ romeVersionToString romeVersion ++ " - Romam uno die non fuisse conditam."
Just romeOptions -> do
globalUUID <- UUID.nextRandom
p <- runReaderT (runExceptT (runRomeWithOptions romeOptions romeVersion)) globalUUID
case p of
Right _ -> return ()
Left e -> die e