Working on a testing method
This commit is contained in:
17
src/main.rs
17
src/main.rs
@ -2,6 +2,9 @@ use anyhow::Result;
|
||||
use clap::{Parser, Subcommand};
|
||||
use libjrpc::{targets::rust::RustCompiler, FileProcessor};
|
||||
|
||||
#[cfg(test)]
|
||||
mod test;
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Cli {
|
||||
#[command(subcommand)]
|
||||
@ -14,6 +17,7 @@ struct Cli {
|
||||
enum Commands {
|
||||
Compile {
|
||||
input: String,
|
||||
#[arg(short, long)]
|
||||
output: String,
|
||||
#[arg(short, long)]
|
||||
definition: Option<String>,
|
||||
@ -39,7 +43,18 @@ pub fn main() -> Result<()> {
|
||||
let mut fp = FileProcessor::new();
|
||||
let ir = fp.start_compile(&input)?;
|
||||
|
||||
libjrpc::targets::compile::<RustCompiler>(ir, &output)?;
|
||||
let output_split = output.split(':').collect::<Vec<&str>>();
|
||||
let output_target = output_split[0];
|
||||
let output_dir = output_split[1];
|
||||
|
||||
match output_target {
|
||||
"rust" => {
|
||||
libjrpc::targets::compile::<RustCompiler>(ir, output_dir)?;
|
||||
}
|
||||
_ => {
|
||||
println!("Unsupported target: {}", output_target);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Implement definition output!
|
||||
}
|
||||
|
Reference in New Issue
Block a user