Skip to content

Commit

Permalink
replace simple value_of and is_present with try_get_one and `tr…
Browse files Browse the repository at this point in the history
…y_contains_id`
  • Loading branch information
samkim-crypto committed Apr 15, 2024
1 parent 17c3a33 commit e40125f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions token/transfer-hook/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub mod meta;

use {
crate::meta::parse_transfer_hook_account_arg,
clap::{crate_description, crate_name, crate_version, Arg, Command},
clap::{crate_description, crate_name, crate_version, Arg, ArgAction, Command},
solana_clap_v3_utils::{
input_parsers::{
parse_url_or_moniker, pubkey_of_signer, signer::SignerSourceParserBuilder,
Expand Down Expand Up @@ -254,7 +254,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.value_parser(parse_transfer_hook_account_arg)
.value_name("TRANSFER_HOOK_ACCOUNTS")
.takes_value(true)
.multiple(true)
.action(ArgAction::Append)
.min_values(0)
.index(3)
.help(r#"Additional account(s) required for a transfer hook and their respective configurations, whether they are a fixed address or PDA.
Expand Down Expand Up @@ -338,7 +338,7 @@ extraMetas:
.value_parser(parse_transfer_hook_account_arg)
.value_name("TRANSFER_HOOK_ACCOUNTS")
.takes_value(true)
.multiple(true)
.action(ArgAction::Append)
.min_values(0)
.index(3)
.help(r#"Additional account(s) required for a transfer hook and their respective configurations, whether they are a fixed address or PDA.
Expand Down Expand Up @@ -400,7 +400,7 @@ extraMetas:
let (command, matches) = app_matches.subcommand().unwrap();
let mut wallet_manager: Option<Rc<RemoteWalletManager>> = None;

let cli_config = if let Some(config_file) = matches.value_of("config_file") {
let cli_config = if let Some(config_file) = matches.try_get_one::<String>("config_file")? {
solana_cli_config::Config::load(config_file).unwrap_or_default()
} else {
solana_cli_config::Config::default()
Expand All @@ -417,7 +417,7 @@ extraMetas:

let json_rpc_url = normalize_to_url_if_moniker(
matches
.value_of("json_rpc_url")
.try_get_one::<String>("json_rpc_url")?
.unwrap_or(&cli_config.json_rpc_url),
);

Expand All @@ -430,7 +430,7 @@ extraMetas:
exit(1);
}),
json_rpc_url,
verbose: matches.is_present("verbose"),
verbose: matches.try_contains_id("verbose")?,
}
};
solana_logger::setup_with_default("solana=info");
Expand Down

0 comments on commit e40125f

Please sign in to comment.