Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(CLI): make aliases visible in help doc #848

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub struct Args {
#[command(flatten)]
pub ledger_file: ledger_file::Args,

#[arg(long, alias = "source", env = "SOROBAN_ACCOUNT")]
#[arg(long, visible_alias = "source", env = "SOROBAN_ACCOUNT")]
/// Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed`
pub source_account: Option<String>,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct Cmd {
overwrite: bool,

/// The contract ID/address on the network
#[arg(long, alias = "id")]
#[arg(long, visible_alias = "id")]
contract_id: String,

#[command(flatten)]
Expand Down
6 changes: 4 additions & 2 deletions cmd/soroban-cli/src/commands/contract/invoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,10 @@ fn build_custom_cmd(name: &str, spec: &Spec) -> Result<clap::Command, Error> {
cmd = cmd.alias(kebab_name);
}
let func = spec.find_function(name).unwrap();
let doc: &'static str = Box::leak(arg_file_help(&func.doc.to_string_lossy()).into_boxed_str());
cmd = cmd.about(Some(doc));
let doc: &'static str = Box::leak(func.doc.to_string_lossy().into_boxed_str());
let long_doc: &'static str = Box::leak(arg_file_help(doc).into_boxed_str());

cmd = cmd.about(Some(doc)).long_about(long_doc);
for (name, type_) in inputs_map.iter() {
let mut arg = clap::Arg::new(name);
let file_arg_name = fmt_arg_file_name(name);
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct Args {
pub verbose: bool,

/// Log DEBUG and TRACE events
#[arg(long, alias = "vv")]
#[arg(long, visible_alias = "vv")]
pub very_verbose: bool,

/// List installed plugins. E.g. `soroban-hello`
Expand Down