mirror of
https://github.com/anoma/juvix.git
synced 2024-12-15 10:03:22 +03:00
0fcf22f693
- Closes #1882
39 lines
944 B
Haskell
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")
|