Skip to content

Commit

Permalink
cargo args
Browse files Browse the repository at this point in the history
  • Loading branch information
0xForerunner committed May 10, 2024
1 parent 2de656b commit 9570cd4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
19 changes: 15 additions & 4 deletions wasm-deploy/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ where
{
#[command(subcommand)]
pub command: Commands<C, S>,

/// Add additional args to cargo build
#[arg(long, required = false)]
pub cargo_args: Vec<String>,
// /// Add additional args to cargo build
// #[arg(long, required = false)]
// pub cargo_args: Vec<String>,
}

#[derive(Parser, Clone, Debug)]
Expand Down Expand Up @@ -46,6 +45,10 @@ where
/// Name of the contract
#[arg(short, long, use_value_delimiter=true, value_delimiter=',', default_values=get_all::<C>())]
contracts: Vec<C>,

/// Pass arguments to cargo
#[arg(short, long, use_value_delimiter = true, value_delimiter = ' ')]
cargo_args: Vec<String>,
},

/// Modify chains
Expand Down Expand Up @@ -102,6 +105,10 @@ where
/// Does not execute transactions, prints txs to console
#[arg(short, long, required = false)]
dry_run: bool,

/// Pass arguments to cargo
#[arg(short, long, use_value_delimiter = true, value_delimiter = ' ')]
cargo_args: Vec<String>,
},

/// Modify deployment environments
Expand Down Expand Up @@ -175,6 +182,10 @@ where
/// Does not execute transactions, prints txs to console
#[arg(short, long, required = false)]
dry_run: bool,

/// Pass arguments to cargo
#[arg(short, long, use_value_delimiter = true, value_delimiter = ' ')]
cargo_args: Vec<String>,
},

/// Sets the config of a contract
Expand Down
11 changes: 8 additions & 3 deletions wasm-deploy/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,19 @@ where
match &cli.command {
Commands::Update { features } => update::<C, S>(settings, features).await?,
Commands::Init {} => init(settings).await?,
Commands::Build { contracts } => build(settings, contracts, &cli.cargo_args).await?,
Commands::Build {
contracts,
cargo_args,
} => build(settings, contracts, cargo_args).await?,
Commands::Chain { add, delete } => chain(settings, add, delete).await?,
Commands::Key { add, delete, show } => key(settings, add, delete, show).await?,
Commands::Contract { add, delete } => contract(settings, add, delete).await?,
Commands::Deploy {
contracts,
no_build,
dry_run,
} => deploy(settings, contracts, *no_build, *dry_run, &cli.cargo_args).await?,
cargo_args,
} => deploy(settings, contracts, *no_build, *dry_run, cargo_args).await?,
Commands::Env {
add,
delete,
Expand All @@ -93,14 +97,15 @@ where
interactive,
no_build,
dry_run,
cargo_args,
} => {
migrate(
settings,
contracts,
*interactive,
*no_build,
*dry_run,
&cli.cargo_args,
cargo_args,
)
.await?
}
Expand Down

0 comments on commit 9570cd4

Please sign in to comment.