Skip to content

Commit de5b160

Browse files
authored
fix(cli): restore short flag for --rpc-url (foundry-rs#14246)
* fix(cli): restore short flag for `--rpc-url` * fix: requirements * fix: short flag collision * fix: restore long * fix: help message
1 parent f2b3fa2 commit de5b160

5 files changed

Lines changed: 8 additions & 9 deletions

File tree

crates/cast/tests/cli/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3977,7 +3977,7 @@ Error: Failed to estimate gas: server returned an error response: error code 3:
39773977

39783978
// <https://basescan.org/block/30558838>
39793979
casttest!(estimate_base_da, |_prj, cmd| {
3980-
cmd.args(["da-estimate", "30558838", "--rpc-url", "https://mainnet.base.org/"])
3980+
cmd.args(["da-estimate", "30558838", "-r", "https://mainnet.base.org/"])
39813981
.assert_success()
39823982
.stdout_eq(str![[r#"
39833983
Estimated data availability size for block 30558838 with 225 transactions: 52916546100

crates/cli/src/opts/evm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,21 @@ pub struct EvmArgs {
4848
/// Fetch state from a specific block number over a remote endpoint.
4949
///
5050
/// See --rpc-url.
51-
#[arg(long, requires = "url", value_name = "BLOCK")]
51+
#[arg(long, requires = "rpc_url", value_name = "BLOCK")]
5252
#[serde(skip_serializing_if = "Option::is_none")]
5353
pub fork_block_number: Option<u64>,
5454

5555
/// Number of retries.
5656
///
5757
/// See --rpc-url.
58-
#[arg(long, requires = "url", value_name = "RETRIES")]
58+
#[arg(long, requires = "rpc_url", value_name = "RETRIES")]
5959
#[serde(skip_serializing_if = "Option::is_none")]
6060
pub fork_retries: Option<u32>,
6161

6262
/// Initial retry backoff on encountering errors.
6363
///
6464
/// See --rpc-url.
65-
#[arg(long, requires = "url", value_name = "BACKOFF")]
65+
#[arg(long, requires = "rpc_url", value_name = "BACKOFF")]
6666
#[serde(skip_serializing_if = "Option::is_none")]
6767
pub fork_retry_backoff: Option<u64>,
6868

crates/cli/src/opts/rpc_common.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ use std::borrow::Cow;
2020
#[derive(Clone, Debug, Default, Serialize, Parser)]
2121
pub struct RpcCommonOpts {
2222
/// The RPC endpoint.
23-
#[arg(long = "rpc-url", visible_alias = "fork-url", env = "ETH_RPC_URL")]
23+
#[arg(short, long, visible_alias = "fork-url", env = "ETH_RPC_URL")]
2424
#[serde(rename = "eth_rpc_url", skip_serializing_if = "Option::is_none")]
25-
pub url: Option<String>,
25+
pub rpc_url: Option<String>,
2626

2727
/// Allow insecure RPC connections (accept invalid HTTPS certificates).
2828
///
@@ -80,7 +80,7 @@ impl figment::Provider for RpcCommonOpts {
8080
impl RpcCommonOpts {
8181
/// Returns the RPC endpoint URL, resolving from CLI args or config.
8282
pub fn url<'a>(&'a self, config: Option<&'a Config>) -> Result<Option<Cow<'a, str>>> {
83-
let url = match (self.url.as_deref(), config) {
83+
let url = match (self.rpc_url.as_deref(), config) {
8484
(Some(url), _) => Some(Cow::Borrowed(url)),
8585
(None, Some(config)) => config.get_rpc_url().transpose()?,
8686
(None, None) => None,

crates/forge/src/cmd/coverage.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ pub struct CoverageArgs {
5555
/// If not specified, the report will be stored in the root of the project.
5656
#[arg(
5757
long,
58-
short,
5958
value_hint = ValueHint::FilePath,
6059
value_name = "PATH"
6160
)]

crates/forge/tests/cli/script.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3201,7 +3201,7 @@ contract CounterScript is Script {
32013201
error: the following required arguments were not provided:
32023202
--broadcast
32033203
3204-
Usage: [..] script --broadcast --verify --rpc-url <URL> <PATH> [ARGS]...
3204+
Usage: [..] script --broadcast --verify --rpc-url <RPC_URL> <PATH> [ARGS]...
32053205
32063206
For more information, try '--help'.
32073207

0 commit comments

Comments
 (0)