mirror of
https://github.com/anoma/juvix.git
synced 2024-12-18 20:31:51 +03:00
830b3be304
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`
39 lines
954 B
Haskell
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")
|