Skip to content

Commit d8ad970

Browse files
authored
Add a way to have wasm-tools compose print no output (bytecodealliance#2601)
Make it opt-in though.
1 parent 6c79879 commit d8ad970

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

crates/wasm-compose/src/composer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl<'a> CompositionGraphBuilder<'a> {
198198
);
199199
}
200200

201-
log::warn!(
201+
log::info!(
202202
"instance `{name}` will be imported because a dependency named `{component_name}` could not be found"
203203
);
204204
Ok(None)

src/bin/wasm-tools/compose.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ pub struct Opts {
4545
/// Output the text format of WebAssembly instead of the binary format.
4646
#[clap(short = 't', long)]
4747
wat: bool,
48+
49+
/// Don't print warnings.
50+
#[clap(short, long)]
51+
quiet: bool,
4852
}
4953

5054
impl Opts {
@@ -53,11 +57,13 @@ impl Opts {
5357
}
5458

5559
pub fn run(self) -> Result<()> {
56-
eprintln!("WARNING: `wasm-tools compose` has been deprecated.");
57-
eprintln!("");
58-
eprintln!(
59-
"Please use `wac` instead. You can find more information about `wac` at https://github.com/bytecodealliance/wac."
60-
);
60+
if !self.quiet {
61+
eprintln!("WARNING: `wasm-tools compose` has been deprecated.");
62+
eprintln!("");
63+
eprintln!(
64+
"Please use `wac` instead. You can find more information about `wac` at https://github.com/bytecodealliance/wac."
65+
);
66+
}
6167
let config = self.create_config()?;
6268
log::debug!("configuration:\n{config:#?}");
6369

@@ -82,7 +88,9 @@ impl Opts {
8288
}
8389

8490
if let Some(path) = self.output.output_path() {
85-
println!("composed component `{}`", path.display());
91+
if !self.quiet {
92+
println!("composed component `{}`", path.display());
93+
}
8694
}
8795

8896
Ok(())

0 commit comments

Comments
 (0)