Skip to content

Commit a5e58ad

Browse files
authored
chore: improve output of -h/--help (#1268)
* chore: improve some help text in cast * fix: re-rename arg * chore: `cast calldata` * chore: more cast commands * chore: the rest of cast conversion commands * chore: all cast util commands * fix: `cast --to-unit` * chore: `cast wallet` * chore: minor changes to help text * style: add long option for etherscan key * style: clearer arg names for `cast index` * style: minor adjustments * style: wording in `forge --help` * style: adjustments to `forge init` * style: `forge clean` adjustments * style: adjustments to `forge install` * style: improvements to `forge remappings` * style: improvements to `forge flatten` * refactor: extract `ProjectPathsArgs` * style: various adjustments * chore: add link to book at end of `--help` * style: more verify improvements * style: minor adjustments to `forge bind` * refactor: split `BuildArgs` into smaller pieces * style: minor adjustments to `forge build` * style: `forge inspect` improvements * style: various improvements * style: various adjustments * style: remaining help text * fix: missing import after rebase
1 parent 3474f6b commit a5e58ad

File tree

22 files changed

+893
-683
lines changed

22 files changed

+893
-683
lines changed

cli/src/cast.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ async fn main() -> eyre::Result<()> {
133133
}
134134
Subcommands::ToUnit { value, unit } => {
135135
let val = unwrap_or_stdin(value)?;
136-
println!("{}", SimpleCast::to_unit(val, unit.unwrap_or_else(|| String::from("wei")))?);
136+
println!("{}", SimpleCast::to_unit(val, unit)?);
137137
}
138138
Subcommands::ToWei { value, unit } => {
139139
let val = unwrap_or_stdin(value)?;
@@ -159,7 +159,7 @@ async fn main() -> eyre::Result<()> {
159159
let provider = Provider::try_from(eth.rpc_url()?)?;
160160
let mut builder = TxBuilder::new(
161161
&provider,
162-
eth.from.unwrap_or(Address::zero()),
162+
eth.wallet.from.unwrap_or(Address::zero()),
163163
address,
164164
eth.chain,
165165
false,
@@ -322,7 +322,7 @@ async fn main() -> eyre::Result<()> {
322322
.await?;
323323
}
324324
}
325-
} else if let Some(from) = eth.from {
325+
} else if let Some(from) = eth.wallet.from {
326326
if resend {
327327
nonce = Some(provider.get_transaction_count(from, None).await?);
328328
}
@@ -391,8 +391,8 @@ async fn main() -> eyre::Result<()> {
391391
Subcommands::AbiEncode { sig, args } => {
392392
println!("{}", SimpleCast::abi_encode(&sig, &args)?);
393393
}
394-
Subcommands::Index { from_type, to_type, from_value, slot_number } => {
395-
let encoded = SimpleCast::index(&from_type, &to_type, &from_value, &slot_number)?;
394+
Subcommands::Index { key_type, value_type, key, slot_number } => {
395+
let encoded = SimpleCast::index(&key_type, &value_type, &key, &slot_number)?;
396396
println!("{}", encoded);
397397
}
398398
Subcommands::FourByte { selector } => {
@@ -669,7 +669,6 @@ async fn main() -> eyre::Result<()> {
669669
// TODO: Figure out better way to get wallet only.
670670
let wallet = EthereumOpts {
671671
wallet,
672-
from: None,
673672
rpc_url: Some("http://localhost:8545".to_string()),
674673
flashbots: false,
675674
chain: Chain::Mainnet,
@@ -690,7 +689,6 @@ async fn main() -> eyre::Result<()> {
690689
// TODO: Figure out better way to get wallet only.
691690
let wallet = EthereumOpts {
692691
wallet,
693-
from: None,
694692
rpc_url: Some("http://localhost:8545".to_string()),
695693
flashbots: false,
696694
chain: Chain::Mainnet,

cli/src/cmd/cast/call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl figment::Provider for CallArgs {
4949
dict.insert("eth_rpc_url".to_string(), Value::from(rpc_url.to_string()));
5050
}
5151

52-
if let Some(from) = self.eth.from {
52+
if let Some(from) = self.eth.wallet.from {
5353
dict.insert("sender".to_string(), Value::from(format!("{:?}", from)));
5454
}
5555

cli/src/cmd/forge/bind.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ pub struct BindArgs {
4040

4141
#[clap(
4242
long = "crate-name",
43-
help = "The name of the rust crate to generate. This should be a valid crates.io crate name. However, it is not currently validated by this command.",
43+
help = "The name of the Rust crate to generate. This should be a valid crates.io crate name. However, it is not currently validated by this command.",
4444
default_value = DEFAULT_CRATE_NAME,
4545
)]
4646
#[serde(skip)]
4747
crate_name: String,
4848

4949
#[clap(
5050
long = "crate-version",
51-
help = "The version of the rust crate to generate. This should be a standard semver version string. However, it is not currently validated by this command.",
51+
help = "The version of the Rust crate to generate. This should be a standard semver version string. However, it is not currently validated by this command.",
5252
default_value = DEFAULT_CRATE_VERSION,
5353
)]
5454
#[serde(skip)]
@@ -59,7 +59,7 @@ pub struct BindArgs {
5959

6060
#[clap(
6161
long = "overwrite",
62-
help = "Overwrite existing generated bindings. If set to false, the command will check that the bindings are correct, and then exit. If set to true, it will instead delete and overwrite the bindings."
62+
help = "Overwrite existing generated bindings. By default, the command will check that the bindings are correct, and then exit. If --overwrite is passed, it will instead delete and overwrite the bindings."
6363
)]
6464
#[serde(skip)]
6565
overwrite: bool,

0 commit comments

Comments
 (0)