summaryrefslogtreecommitdiff
path: root/crates/cli/bin.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/cli/bin.rs')
-rw-r--r--crates/cli/bin.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/crates/cli/bin.rs b/crates/cli/bin.rs
index 4e85481..38e30da 100644
--- a/crates/cli/bin.rs
+++ b/crates/cli/bin.rs
@@ -1,6 +1,9 @@
use argh::FromArgs;
use color_eyre::eyre::Result;
-use tinywasm::{self, Module};
+use tinywasm::{self, module::WasmValue, Module};
+use util::install_tracing;
+
+mod util;
#[derive(FromArgs)]
/// TinyWasm CLI
@@ -25,6 +28,9 @@ struct Run {
}
fn main() -> Result<()> {
+ color_eyre::install()?;
+ install_tracing(None);
+
let args: TinyWasmCli = argh::from_env();
match args.nested {
@@ -37,7 +43,14 @@ fn main() -> Result<()> {
}
fn run(wasm: &[u8]) -> Result<()> {
- let module = Module::new(wasm)?;
- println!("{:#?}", module);
+ let mut module = Module::new(wasm)?;
+ let args = [WasmValue::I32(1), WasmValue::I32(2)];
+ let res = module.run("add", &args)?;
+ println!("res: {:?}", res);
+
+ let args = [WasmValue::I64(1), WasmValue::I64(2)];
+ let res = module.run("add_64", &args)?;
+ println!("res: {:?}", res);
+
Ok(())
}