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

Commit bc91372

Browse files
Enable spl-token-cli args (#510)
1 parent 90b5ce6 commit bc91372

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

token/cli/src/main.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use clap::{
2-
crate_description, crate_name, crate_version, value_t, value_t_or_exit, App, AppSettings, Arg,
2+
crate_description, crate_name, crate_version, value_t_or_exit, App, AppSettings, Arg,
33
SubCommand,
44
};
55
use solana_account_decoder::{parse_token::TokenAccountType, UiAccountData};
@@ -477,6 +477,7 @@ fn main() {
477477
.long("url")
478478
.value_name("URL")
479479
.takes_value(true)
480+
.global(true)
480481
.validator(is_url)
481482
.help("JSON RPC URL for the cluster. Default from the configuration file."),
482483
)
@@ -486,6 +487,7 @@ fn main() {
486487
.value_name("KEYPAIR")
487488
.validator(is_keypair)
488489
.takes_value(true)
490+
.global(true)
489491
.help(
490492
"Specify the token owner account. \
491493
This may be a keypair file, the ASK keyword. \
@@ -498,6 +500,7 @@ fn main() {
498500
.value_name("KEYPAIR")
499501
.validator(is_keypair)
500502
.takes_value(true)
503+
.global(true)
501504
.help(
502505
"Specify the fee-payer account. \
503506
This may be a keypair file, the ASK keyword. \
@@ -735,12 +738,16 @@ fn main() {
735738
} else {
736739
solana_cli_config::Config::default()
737740
};
738-
let json_rpc_url = value_t!(matches, "json_rpc_url", String)
739-
.unwrap_or_else(|_| cli_config.json_rpc_url.clone());
741+
let json_rpc_url = matches
742+
.value_of("json_rpc_url")
743+
.unwrap_or(&cli_config.json_rpc_url)
744+
.to_string();
740745

741746
let owner = signer_from_path(
742747
&matches,
743-
&cli_config.keypair_path,
748+
matches
749+
.value_of("owner")
750+
.unwrap_or(&cli_config.keypair_path),
744751
"owner",
745752
&mut wallet_manager,
746753
)
@@ -750,7 +757,9 @@ fn main() {
750757
});
751758
let fee_payer = signer_from_path(
752759
&matches,
753-
&cli_config.keypair_path,
760+
matches
761+
.value_of("fee_payer")
762+
.unwrap_or(&cli_config.keypair_path),
754763
"fee_payer",
755764
&mut wallet_manager,
756765
)

0 commit comments

Comments
 (0)