From 856dd5bcda09185d3eb34dfb3d26fe8f0a930621 Mon Sep 17 00:00:00 2001 From: sharmis-tp Date: Tue, 20 Oct 2026 23:26:41 +0000 Subject: [PATCH] fix(cli): use the stellar-scaffold name in help and version output Closes #596 --- .../stellar-scaffold-cli/src/commands/mod.rs | 2 +- .../src/commands/version.rs | 23 ++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/crates/stellar-scaffold-cli/src/commands/mod.rs b/crates/stellar-scaffold-cli/src/commands/mod.rs index 671973cd..5120c2f0 100644 --- a/crates/stellar-scaffold-cli/src/commands/mod.rs +++ b/crates/stellar-scaffold-cli/src/commands/mod.rs @@ -90,7 +90,7 @@ impl FromStr for Root { pub enum Cmd { /// Initialize the project Init(init::Cmd), - /// Version of the scaffold-stellar-cli + /// Version of the stellar-scaffold-cli Version(version::Cmd), /// Build contracts, resolving dependencies in the correct order. If you have an `environments.toml` file, it will also follow its instructions to configure the environment set by the `STELLAR_SCAFFOLD_ENV` environment variable, turning your contracts into frontend packages (JS dependencies). diff --git a/crates/stellar-scaffold-cli/src/commands/version.rs b/crates/stellar-scaffold-cli/src/commands/version.rs index 796917f4..12e99205 100644 --- a/crates/stellar-scaffold-cli/src/commands/version.rs +++ b/crates/stellar-scaffold-cli/src/commands/version.rs @@ -8,7 +8,7 @@ pub struct Cmd; impl Cmd { #[allow(clippy::unused_self)] pub fn run(&self) { - println!("scaffold {}", long()); + println!("stellar-scaffold {}", long()); } } @@ -38,3 +38,24 @@ xdr ({})", ] .join("\n") } + +#[cfg(test)] +mod tests { + use clap::CommandFactory; + + #[test] + fn help_uses_the_current_package_name() { + let mut root = crate::commands::Root::command(); + let about = root + .find_subcommand("version") + .and_then(|version| version.get_about()) + .map(ToString::to_string) + .unwrap_or_default(); + assert_eq!(about, "Version of the stellar-scaffold-cli"); + let help = root.render_long_help().to_string(); + assert!( + !help.contains("scaffold-stellar"), + "old package name in help:\n{help}" + ); + } +}