| 13 | pub use cli::{Cli, Commands}; |
| 14 | |
| 15 | pub fn run_cli(cli: Cli) -> Result<()> { |
| 16 | match cli.command { |
| 17 | Some(Commands::Run(args)) => cmd::run::run(args), |
| 18 | Some(Commands::Compile(args)) => cmd::compile::run(args), |
| 19 | Some(Commands::Dump(args)) => cmd::dump::run(args), |
| 20 | Some(Commands::Inspect(args)) => cmd::inspect::run(args), |
| 21 | #[cfg(feature = "wast")] |
| 22 | Some(Commands::Wast(args)) => cmd::wast::run(args), |
| 23 | Some(Commands::Completion(args)) => cmd::completion::run(args), |
| 24 | None => match cli.run.module.as_deref() { |
| 25 | Some(_) => cmd::run::run(cli.run), |
| 26 | None => { |
| 27 | let mut cmd = Cli::command(); |
| 28 | cmd.print_help()?; |
| 29 | println!(); |
| 30 | Ok(()) |
| 31 | } |
| 32 | }, |
| 33 | } |
| 34 | } |