1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-15 10:03:22 +03:00
juvix/app/Commands/Dev/Runtime/Options.hs
2023-04-13 14:16:07 +02:00

39 lines
944 B
Haskell

module Commands.Dev.Runtime.Options where
import Commands.Dev.Runtime.Compile.Options
import CommonOptions
import Data.List.NonEmpty qualified as NonEmpty
newtype RuntimeCommand
= Compile CompileOptions
deriving stock (Data)
runtimeSupportedTargets :: NonEmpty CompileTarget
runtimeSupportedTargets =
NonEmpty.fromList
[ TargetWasm32Wasi,
TargetNative64
]
parseRuntimeOptions :: Parser CompileOptions
parseRuntimeOptions =
parseCompileOptions
runtimeSupportedTargets
parseInputJuvixFile
parseRuntimeCommand :: Parser RuntimeCommand
parseRuntimeCommand =
hsubparser $
mconcat
[ commandCompile
]
where
commandCompile :: Mod CommandFields RuntimeCommand
commandCompile = command "compile" compileInfo
compileInfo :: ParserInfo RuntimeCommand
compileInfo =
info
(Compile <$> parseRuntimeOptions)
(progDesc "Compile a C file with Juvix runtime included")