Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
fix warn check
Browse files Browse the repository at this point in the history
  • Loading branch information
noise64 committed Dec 5, 2024
1 parent 9263c2f commit e5d88d5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions wasm-rpc-stubgen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -33,16 +37,21 @@ 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()
);
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(),
)
}
Expand Down

0 comments on commit e5d88d5

Please sign in to comment.