feat(export): implement basic command functionality
This commit is contained in:
@@ -1,14 +1,36 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use aiken_project::{options::Options, watch::with_project};
|
||||
|
||||
#[derive(clap::Args)]
|
||||
pub struct Args {
|
||||
/// Name of the validator's module within the project. Optional if there's only one validator
|
||||
/// Path to project
|
||||
directory: Option<PathBuf>,
|
||||
|
||||
/// Name of the function's module within the project
|
||||
#[clap(short, long)]
|
||||
module: String,
|
||||
|
||||
/// Name of the validator within the module. Optional if there's only one validator
|
||||
/// Name of the function within the module
|
||||
#[clap(short, long)]
|
||||
name: String,
|
||||
}
|
||||
|
||||
pub fn exec(args: Args) -> miette::Result<()> {
|
||||
Ok(())
|
||||
pub fn exec(
|
||||
Args {
|
||||
directory,
|
||||
module,
|
||||
name,
|
||||
}: Args,
|
||||
) -> miette::Result<()> {
|
||||
with_project(directory.as_deref(), false, |p| {
|
||||
p.compile(Options::default())?;
|
||||
|
||||
let raw_uplc = p.export(&module, &name)?;
|
||||
|
||||
println!("{}", raw_uplc);
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.map_err(|_| std::process::exit(1))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user