Skip to content

Commit

Permalink
Display running command when showing help on `stellar contract invoke…
Browse files Browse the repository at this point in the history
…`. (#1859)
  • Loading branch information
fnando authored Jan 30, 2025
1 parent cb33c96 commit b29b0e6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/soroban-cli/src/commands/contract/arg_parsing.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::collections::HashMap;
use std::convert::TryInto;
use std::env;
use std::ffi::OsString;
use std::fmt::Debug;
use std::path::PathBuf;
Expand Down Expand Up @@ -51,14 +52,25 @@ pub enum Error {
Config(#[from] config::Error),
}

fn running_cmd() -> String {
let mut args: Vec<String> = env::args().collect();

if let Some(pos) = args.iter().position(|arg| arg == "--") {
args.truncate(pos);
}

format!("{} --", args.join(" "))
}

pub fn build_host_function_parameters(
contract_id: &stellar_strkey::Contract,
slop: &[OsString],
spec_entries: &[ScSpecEntry],
config: &config::Args,
) -> Result<(String, Spec, InvokeContractArgs, Vec<SigningKey>), Error> {
let spec = Spec(Some(spec_entries.to_vec()));
let mut cmd = clap::Command::new(contract_id.to_string())

let mut cmd = clap::Command::new(running_cmd())
.no_binary_name(true)
.term_width(300)
.max_term_width(300);
Expand Down

0 comments on commit b29b0e6

Please sign in to comment.