mirror of
https://github.com/anoma/juvix.git
synced 2024-12-28 10:04:49 +03:00
138d9e545d
1. Adds the `--log-level LOG_LEVEL` flag to the CLI. This flag can be given `error`, `warn`, `info`, `progress`, `debug` as argument to filter the logged messages. 2. Removes the `--only-errors` flag. 3. Adds the `--ide-end-error-char CHAR`, which receives a character as an argument, which is appended to the end of error messages. This is handy to facilitate parsing of errors messages from the ide. This functionality was previously embeded in the old `--only-errors` flag.
26 lines
837 B
Haskell
26 lines
837 B
Haskell
module Commands.Compile.Cairo where
|
|
|
|
import Commands.Base
|
|
import Commands.Compile.Cairo.Options
|
|
import Commands.Extra.NewCompile
|
|
import Data.Aeson qualified as JSON
|
|
|
|
runCommand :: (Members AppEffects r) => CairoOptions 'InputMain -> Sem r ()
|
|
runCommand opts = do
|
|
let opts' = opts ^. cairoCompileCommonOptions
|
|
inputFile = opts' ^. compileInputFile
|
|
moutputFile = opts' ^. compileOutputFile
|
|
coreRes <- fromCompileCommonOptionsMain opts' >>= compileToCore
|
|
entryPoint <-
|
|
applyOptions opts
|
|
<$> getEntryPoint (opts' ^. compileInputFile)
|
|
cairoFile :: Path Abs File <- getOutputFile FileExtJson inputFile moutputFile
|
|
r <-
|
|
runReader entryPoint
|
|
. runError @JuvixError
|
|
. coreToCairo
|
|
$ coreRes
|
|
^. coreResultModule
|
|
res <- getRight r
|
|
liftIO (JSON.encodeFile (toFilePath cairoFile) res)
|