Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 60a7ffe

Browse files
[token-cli] Upgrade to clap-v3 (#6376)
* upgrade clap version to `3.2.23` * remove lifetime parameters from `ArgMatches` * remove extra lifetime parameters from `Arg` * remove extra lifetime parameters from `App` * use `usize` type parameters for `min_values` and `max_values` * use `char` type parameters for `short` arguments * update syntax for custom validator functions * update pattern matching syntax for `subcommand` * update for new `possible_values` syntax * allow deprecated input validation for now * resolve lifetime specifier issue with higher order validator functions * directly specify positional parameter indices * remove non-functioning `owner` alias in some subcommands * remove long names for positional arguments * remove potential panice from `value_of` and `is_present` * add custom `signer_from_path` and `signer_from_path_with_config` * cargo fmt * remove duplicate addition of args in invalid config test * use `try_get_one` to parse `compute_unit_price` and `compute_unit_limit` * hard-code `signer_arg` and `OfflineArgs` * replace `value_of` function * revert direct parser for `is_amount` validation
1 parent 4ff64ce commit 60a7ffe

File tree

9 files changed

+395
-267
lines changed

9 files changed

+395
-267
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

token/cli/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ walkdir = "2"
1313

1414
[dependencies]
1515
base64 = "0.22.1"
16-
clap = "2.33.3"
16+
clap = "3.2.23"
1717
console = "0.15.8"
1818
futures = "0.3"
1919
serde = "1.0.214"
2020
serde_derive = "1.0.103"
2121
serde_json = "1.0.132"
2222
solana-account-decoder = "2.0.3"
23-
solana-clap-utils = "2.0.3"
23+
solana-clap-v3-utils = "2.0.3"
2424
solana-cli-config = "2.0.3"
2525
solana-cli-output = "2.0.3"
2626
solana-client = "2.0.3"

token/cli/src/bench.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use {
33
crate::{clap_app::Error, command::CommandResult, config::Config},
44
clap::{value_t_or_exit, ArgMatches},
5-
solana_clap_utils::input_parsers::pubkey_of_signer,
5+
solana_clap_v3_utils::input_parsers::pubkey_of_signer,
66
solana_client::{
77
nonblocking::rpc_client::RpcClient, rpc_client::RpcClient as BlockingRpcClient,
88
tpu_client::TpuClient, tpu_client::TpuClientConfig,
@@ -22,15 +22,15 @@ use {
2222
};
2323

2424
pub(crate) async fn bench_process_command(
25-
matches: &ArgMatches<'_>,
25+
matches: &ArgMatches,
2626
config: &Config<'_>,
2727
mut signers: Vec<Arc<dyn Signer>>,
2828
wallet_manager: &mut Option<Rc<RemoteWalletManager>>,
2929
) -> CommandResult {
3030
assert!(!config.sign_only);
3131

3232
match matches.subcommand() {
33-
("create-accounts", Some(arg_matches)) => {
33+
Some(("create-accounts", arg_matches)) => {
3434
let token = pubkey_of_signer(arg_matches, "token", wallet_manager)
3535
.unwrap()
3636
.unwrap();
@@ -42,7 +42,7 @@ pub(crate) async fn bench_process_command(
4242

4343
command_create_accounts(config, signers, &token, n, &owner).await?;
4444
}
45-
("close-accounts", Some(arg_matches)) => {
45+
Some(("close-accounts", arg_matches)) => {
4646
let token = pubkey_of_signer(arg_matches, "token", wallet_manager)
4747
.unwrap()
4848
.unwrap();
@@ -53,7 +53,7 @@ pub(crate) async fn bench_process_command(
5353

5454
command_close_accounts(config, signers, &token, n, &owner).await?;
5555
}
56-
("deposit-into", Some(arg_matches)) => {
56+
Some(("deposit-into", arg_matches)) => {
5757
let token = pubkey_of_signer(arg_matches, "token", wallet_manager)
5858
.unwrap()
5959
.unwrap();
@@ -68,7 +68,7 @@ pub(crate) async fn bench_process_command(
6868
)
6969
.await?;
7070
}
71-
("withdraw-from", Some(arg_matches)) => {
71+
Some(("withdraw-from", arg_matches)) => {
7272
let token = pubkey_of_signer(arg_matches, "token", wallet_manager)
7373
.unwrap()
7474
.unwrap();

0 commit comments

Comments
 (0)