feat: add simple check command
This commit is contained in:
@@ -20,3 +20,4 @@ pallas-traverse = "0.14.0-alpha.3"
|
||||
serde = { version = "1.0.144", features = ["derive"] }
|
||||
serde_json = "1.0.85"
|
||||
uplc = { path = '../uplc', version = "0.0.18" }
|
||||
aiken-lang = { path = "../lang", version = "0.0.17" }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user