feat: add simple check command

This commit is contained in:
rvcas
2022-10-04 17:03:21 -04:00
committed by Lucas
parent 6ef8ba5c35
commit 6de41e64be
7 changed files with 57 additions and 68 deletions

View File

@@ -9,6 +9,11 @@ use clap::{Parser, Subcommand};
pub enum Args {
/// Build an aiken project
Build,
/// Check a file or project
Check {
/// Specific aiken file to check
input: Option<PathBuf>,
},
/// Start a development server
Dev,
/// Create a new aiken project

View File

@@ -33,6 +33,21 @@ fn main() -> anyhow::Result<()> {
todo!()
}
Args::Check { input } => {
if let Some(input) = input {
let src = fs::read_to_string(&input)?;
match aiken_lang::parser::script(&src) {
Ok(_) => (),
Err(errs) => {
for err in errs {
eprintln!("{:#?}", err);
}
}
}
}
}
Args::Dev => {
// launch a development server
// this should allow people to test