diff options
| author | Henry <mail@henrygressmann.de> | 2026-04-26 19:44:34 +0200 |
|---|---|---|
| committer | Henry <mail@henrygressmann.de> | 2026-04-26 19:44:34 +0200 |
| commit | 463a3a6f56a5ca06cda890fd6fe7f16485ef70a0 (patch) | |
| tree | bfa657a2de16c04cd36f4b6c61e77b370fcd46fc /crates/cli/src/cmd/inspect.rs | |
| parent | 27004a8738c7a3c32ac4fb6966f32647b4c96db7 (diff) | |
feat: new tinywasm cli
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/cli/src/cmd/inspect.rs')
| -rw-r--r-- | crates/cli/src/cmd/inspect.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/crates/cli/src/cmd/inspect.rs b/crates/cli/src/cmd/inspect.rs new file mode 100644 index 0000000..ea2cec7 --- /dev/null +++ b/crates/cli/src/cmd/inspect.rs @@ -0,0 +1,35 @@ +use eyre::Result; + +use crate::cli::ModuleInputArgs; +use crate::load::load_module; +use crate::output::{format_export_type, format_import_type}; +use anstream::println; +use owo_colors::OwoColorize; + +pub fn run(args: ModuleInputArgs) -> Result<()> { + let loaded = load_module(&args.module)?; + let module = loaded.module; + + println!("{}", "Imports".bold()); + let mut import_count = 0usize; + for import in module.imports() { + import_count += 1; + println!(" {}.{}: {}", import.module.blue(), import.name.cyan(), format_import_type(import.ty).yellow()); + } + if import_count == 0 { + println!(" {}", "(none)".yellow()); + } + + println!(); + println!("{}", "Exports".bold()); + let mut export_count = 0usize; + for export in module.exports() { + export_count += 1; + println!(" {}: {}", export.name.green(), format_export_type(export.ty).yellow()); + } + if export_count == 0 { + println!(" {}", "(none)".yellow()); + } + + Ok(()) +} |
