From e5d88d595d44159d5fae6da974b255c6bc228773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Istv=C3=A1n=20B=C3=ADr=C3=B3?= Date: Thu, 5 Dec 2024 18:20:03 +0100 Subject: [PATCH] fix warn check --- wasm-rpc-stubgen/src/main.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/wasm-rpc-stubgen/src/main.rs b/wasm-rpc-stubgen/src/main.rs index fd98fc5..1cb4cf5 100644 --- a/wasm-rpc-stubgen/src/main.rs +++ b/wasm-rpc-stubgen/src/main.rs @@ -24,7 +24,11 @@ use golem_wasm_rpc_stubgen::model::app::ComponentPropertiesExtensionsNone; async fn main() -> ExitCode { pretty_env_logger::init(); + #[cfg(feature = "app-command")] let mut clap_command = Command::command(); + #[cfg(not(feature = "app-command"))] + let clap_command = Command::command(); + // Based on Command::parse, but using cloned command, so we avoid creating clap_command twice let parsed_command = { let mut matches = clap_command.clone().get_matches(); @@ -33,7 +37,12 @@ async fn main() -> ExitCode { res.unwrap_or_else(|e| e.exit()) }; - if !matches!(parsed_command, Command::App { .. }) { + #[cfg(feature = "app-command")] + let show_warning = !matches!(parsed_command, Command::App { .. }); + #[cfg(not(feature = "app-command"))] + let show_warning = true; + + if show_warning { eprintln!( "{}", "WARNING: THIS COMMAND IS DEPRECATED AND MIGHT MODIFY SOURCE WIT FILES!".yellow() @@ -41,8 +50,8 @@ async fn main() -> ExitCode { eprintln!( "{}", format!( - "\nThe recommended new way to handle wasm-rpc stub generation and linking is the {} subcommand.\n", - "app".bold().underline(), + "\nThe recommended new way to handle wasm-rpc stub generation and linking is the {} command.\n", + "wasm-rpc-stubgen app".bold().underline(), ).yellow(), ) }