From 713f688cf40a205e9d9a2e86bb36af1b247c6a06 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 12 Aug 2026 19:45:15 -0700 Subject: [PATCH] Add a way to have `wasm-tools compose` print no output Make it opt-in though. --- crates/wasm-compose/src/composer.rs | 2 +- src/bin/wasm-tools/compose.rs | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/crates/wasm-compose/src/composer.rs b/crates/wasm-compose/src/composer.rs index 6088bcdd6a..89fc1a1355 100644 --- a/crates/wasm-compose/src/composer.rs +++ b/crates/wasm-compose/src/composer.rs @@ -198,7 +198,7 @@ impl<'a> CompositionGraphBuilder<'a> { ); } - log::warn!( + log::info!( "instance `{name}` will be imported because a dependency named `{component_name}` could not be found" ); Ok(None) diff --git a/src/bin/wasm-tools/compose.rs b/src/bin/wasm-tools/compose.rs index 07b1df78b0..deec423eb4 100644 --- a/src/bin/wasm-tools/compose.rs +++ b/src/bin/wasm-tools/compose.rs @@ -45,6 +45,10 @@ pub struct Opts { /// Output the text format of WebAssembly instead of the binary format. #[clap(short = 't', long)] wat: bool, + + /// Don't print warnings. + #[clap(short, long)] + quiet: bool, } impl Opts { @@ -53,11 +57,13 @@ impl Opts { } pub fn run(self) -> Result<()> { - eprintln!("WARNING: `wasm-tools compose` has been deprecated."); - eprintln!(""); - eprintln!( - "Please use `wac` instead. You can find more information about `wac` at https://github.com/bytecodealliance/wac." - ); + if !self.quiet { + eprintln!("WARNING: `wasm-tools compose` has been deprecated."); + eprintln!(""); + eprintln!( + "Please use `wac` instead. You can find more information about `wac` at https://github.com/bytecodealliance/wac." + ); + } let config = self.create_config()?; log::debug!("configuration:\n{config:#?}"); @@ -82,7 +88,9 @@ impl Opts { } if let Some(path) = self.output.output_path() { - println!("composed component `{}`", path.display()); + if !self.quiet { + println!("composed component `{}`", path.display()); + } } Ok(())