1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-18 20:31:51 +03:00
juvix/app/Commands/Dev/Runtime/Options.hs
Jonathan Cubides 830b3be304
Add FileExt type (#2467)
This PR introduces FileExt type, and consequently, one can generalise
methods and matches based on the file extension; for example,
`parseInputJuvixAsmFile` is now an app. `parseInputFile FileExtJuvixAsm`
2023-10-25 12:02:12 +02:00

39 lines
954 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
(parseInputFile FileExtJuvix)
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")