| ... | ... | @@ -66,7 +66,11 @@ fn main() -> Result<()> { |
| 66 | 66 | let cli = Cli::parse(); |
| 67 | 67 | |
| 68 | 68 | match cli.command { |
| 69 | | Commands::Compile { file, stdout, target: _ } => { |
| 69 | Commands::Compile { |
| 70 | file, |
| 71 | stdout, |
| 72 | target: _, |
| 73 | } => { |
| 70 | 74 | let contents = std::fs::read_to_string(file.clone()).unwrap(); |
| 71 | 75 | let result = transpile(contents.clone())?; |
| 72 | 76 | |
| ... | ... | @@ -85,35 +89,34 @@ fn main() -> Result<()> { |
| 85 | 89 | |
| 86 | 90 | let rt = get_runtime(&target); |
| 87 | 91 | |
| 88 | | match rt.as_str() { |
| 92 | let command = match rt.as_str() { |
| 89 | 93 | "deno" => { |
| 90 | | let output = std::process::Command::new("deno") |
| 94 | std::process::Command::new("deno") |
| 91 | 95 | .arg("run") |
| 92 | 96 | .arg("-A") |
| 93 | 97 | .arg(temp_file) |
| 94 | | .output() |
| 95 | | .expect("Failed to execute process"); |
| 96 | | println!("{}", String::from_utf8_lossy(&output.stdout)); |
| 98 | .spawn() |
| 99 | .expect("Failed to execute process") |
| 97 | 100 | } |
| 98 | 101 | "node" => { |
| 99 | | let output = std::process::Command::new("node") |
| 102 | std::process::Command::new("node") |
| 100 | 103 | .arg(temp_file) |
| 101 | | .output() |
| 102 | | .expect("Failed to execute process"); |
| 103 | | println!("{}", String::from_utf8_lossy(&output.stdout)); |
| 104 | .spawn() |
| 105 | .expect("Failed to execute process") |
| 104 | 106 | } |
| 105 | 107 | "bun" => { |
| 106 | | let output = std::process::Command::new("bun") |
| 108 | std::process::Command::new("bun") |
| 107 | 109 | .arg("run") |
| 108 | 110 | .arg(temp_file) |
| 109 | | .output() |
| 110 | | .expect("Failed to execute process"); |
| 111 | | println!("{}", String::from_utf8_lossy(&output.stdout)); |
| 111 | .spawn() |
| 112 | .expect("Failed to execute process") |
| 112 | 113 | } |
| 113 | 114 | _ => { |
| 114 | 115 | println!("Unknown runtime: {}", target); |
| 115 | 116 | } |
| 116 | 117 | } |
| 118 | |
| 119 | command.wait().unwrap(); |
| 117 | 120 | } |
| 118 | 121 | } |
| 119 | 122 | |