2022-01-18 14:25:42 +03:00
|
|
|
module Main (main) where
|
|
|
|
|
2022-05-18 18:10:10 +03:00
|
|
|
import App
|
2022-09-14 17:16:15 +03:00
|
|
|
import CommonOptions
|
2023-04-13 12:27:39 +03:00
|
|
|
import GlobalOptions
|
|
|
|
import Juvix.Compiler.Pipeline.Root
|
2022-09-14 17:16:15 +03:00
|
|
|
import TopCommand
|
|
|
|
import TopCommand.Options
|
2022-03-25 02:52:30 +03:00
|
|
|
|
2022-09-14 17:16:15 +03:00
|
|
|
main :: IO ()
|
|
|
|
main = do
|
2023-01-06 19:54:13 +03:00
|
|
|
let parserPreferences = prefs showHelpOnEmpty
|
2023-04-13 12:27:39 +03:00
|
|
|
invokeDir <- getCurrentDir
|
2023-01-06 19:54:13 +03:00
|
|
|
(_runAppIOArgsGlobalOptions, cli) <- customExecParser parserPreferences descr
|
2023-04-13 12:27:39 +03:00
|
|
|
let mbuildDir = _runAppIOArgsGlobalOptions ^? globalBuildDir . _Just . pathPath
|
|
|
|
mainFileDir <- topCommandInputFile cli
|
|
|
|
_runAppIOArgsRoots <- findRootAndChangeDir mainFileDir mbuildDir invokeDir
|
|
|
|
runFinal
|
|
|
|
. resourceToIOFinal
|
|
|
|
. embedToFinal @IO
|
|
|
|
. runAppIO RunAppIOArgs {..}
|
|
|
|
$ runTopCommand cli
|