diff --git a/FULL_HELP_DOCS.md b/FULL_HELP_DOCS.md index d80a45803..2894cec62 100644 --- a/FULL_HELP_DOCS.md +++ b/FULL_HELP_DOCS.md @@ -4502,6 +4502,7 @@ Print version information - `--only-version` — Print only the version - `--only-version-major` — Print only the major version +- `--only-commit` — Print only the commit sha ## `stellar plugin` diff --git a/cmd/soroban-cli/src/commands/version.rs b/cmd/soroban-cli/src/commands/version.rs index 7b9670af6..96689456e 100644 --- a/cmd/soroban-cli/src/commands/version.rs +++ b/cmd/soroban-cli/src/commands/version.rs @@ -5,11 +5,14 @@ use std::fmt::Debug; #[group(skip)] pub struct Cmd { /// Print only the version. - #[arg(long)] + #[arg(long, group = "only")] only_version: bool, /// Print only the major version. - #[arg(long)] + #[arg(long, group = "only")] only_version_major: bool, + /// Print only the commit sha. + #[arg(long, group = "only")] + only_commit: bool, } impl Cmd { @@ -19,6 +22,8 @@ impl Cmd { println!("{}", pkg()); } else if self.only_version_major { println!("{}", major()); + } else if self.only_commit { + println!("{}", git()); } else { println!("stellar {}", long()); }