1pub mod cli;
2pub mod cmd;
3pub mod engine_flags;
4pub mod load;
5pub mod output;
6pub mod value_parse;
7#[cfg(feature = "wast")]
8pub mod wast_runner;
9
10use clap::CommandFactory;
11use eyre::Result;
12
13pub use cli::{Cli, Commands};
14
15pub 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}