From f80152a5b26ce8074696f163ff513aa67c9f73be Mon Sep 17 00:00:00 2001 From: Nando Vieira Date: Thu, 16 Jan 2025 12:13:38 -0800 Subject: [PATCH] Include the license text when running in verbose mode. --- FULL_HELP_DOCS.md | 6 +++++- cmd/soroban-cli/src/commands/licenses.rs | 13 ++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/FULL_HELP_DOCS.md b/FULL_HELP_DOCS.md index cf44ff796..68852dd53 100644 --- a/FULL_HELP_DOCS.md +++ b/FULL_HELP_DOCS.md @@ -2343,7 +2343,11 @@ Print version information Show dependency licenses -**Usage:** `stellar licenses` +**Usage:** `stellar licenses [OPTIONS]` + +###### **Options:** + +* `-v`, `--verbose` — Display the license text diff --git a/cmd/soroban-cli/src/commands/licenses.rs b/cmd/soroban-cli/src/commands/licenses.rs index b34c15c09..8e60073af 100644 --- a/cmd/soroban-cli/src/commands/licenses.rs +++ b/cmd/soroban-cli/src/commands/licenses.rs @@ -5,7 +5,11 @@ use license_fetcher::get_package_list_macro; #[derive(Parser, Debug, Clone)] #[group(skip)] -pub struct Cmd; +pub struct Cmd { + /// Display the license text. + #[arg(long, short)] + pub verbose: bool, +} impl Cmd { #[allow(clippy::unused_self)] @@ -31,6 +35,13 @@ impl Cmd { println!("URL: {url}"); } + if self.verbose { + if let Some(text) = pkg.license_text.clone() { + println!("{text}"); + println!("———"); + } + } + println!(); }); }