1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-14 08:27:03 +03:00
juvix/app/Commands/Dev/Asm/Options.hs
2022-12-06 11:33:20 +01:00

49 lines
1.2 KiB
Haskell

module Commands.Dev.Asm.Options where
import Commands.Dev.Asm.Compile.Options
import Commands.Dev.Asm.Run.Options
import Commands.Dev.Asm.Validate.Options
import CommonOptions
data AsmCommand
= Run AsmRunOptions
| Validate AsmValidateOptions
| Compile AsmCompileOptions
deriving stock (Data)
parseAsmCommand :: Parser AsmCommand
parseAsmCommand =
hsubparser $
mconcat
[ commandRun,
commandValidate,
commandCompile
]
where
commandRun :: Mod CommandFields AsmCommand
commandRun = command "run" runInfo
commandValidate :: Mod CommandFields AsmCommand
commandValidate = command "validate" validateInfo
commandCompile :: Mod CommandFields AsmCommand
commandCompile = command "compile" compileInfo
runInfo :: ParserInfo AsmCommand
runInfo =
info
(Run <$> parseAsmRunOptions)
(progDesc "Run a JuvixAsm file and pretty print the result")
validateInfo :: ParserInfo AsmCommand
validateInfo =
info
(Validate <$> parseAsmValidateOptions)
(progDesc "Validate a JuvixAsm file")
compileInfo :: ParserInfo AsmCommand
compileInfo =
info
(Compile <$> parseAsmCompileOptions)
(progDesc "Compile a JuvixAsm file")