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

Commit ba5a67a

Browse files
committed
Add conflicts_with and shortened command
1 parent bda540d commit ba5a67a

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

token/cli/src/clap_app.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,15 @@ pub fn app<'a, 'b>(
591591
.possible_values(&["json", "json-compact"])
592592
.help("Return information in specified output format"),
593593
)
594+
.arg(
595+
Arg::with_name("program_2022")
596+
.short("2")
597+
.long("program-2022")
598+
.takes_value(false)
599+
.global(true)
600+
.conflicts_with("program_id")
601+
.help("Use token extension program token 2022 with program id: TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),
602+
)
594603
.arg(
595604
Arg::with_name("program_id")
596605
.short("p")
@@ -599,6 +608,7 @@ pub fn app<'a, 'b>(
599608
.takes_value(true)
600609
.global(true)
601610
.validator(is_valid_token_program_id)
611+
.conflicts_with("program_2022")
602612
.help("SPL Token program id"),
603613
)
604614
.arg(
@@ -693,13 +703,6 @@ pub fn app<'a, 'b>(
693703
"Enable the mint authority to close this mint"
694704
),
695705
)
696-
.arg(
697-
Arg::with_name("token_program_2022")
698-
.value_name("token-program-2022")
699-
.short("2")
700-
.long("token-program-2022")
701-
.takes_value(false)
702-
.help("Use token extension program token 2022 with program id: TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"))
703706
.arg(
704707
Arg::with_name("interest_rate")
705708
.long("interest-rate")

token/cli/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ impl<'a> Config<'a> {
261261

262262
let default_program_id = spl_token::id();
263263
let (program_id, restrict_to_program_id) =
264-
if matches.is_present("token_program_2022") {
264+
if matches.is_present("program_2022") {
265265
(spl_token_2022::id(), true)
266266
} else if let Some(program_id) = value_of(matches, "program_id") {
267267
(program_id, true)

token/cli/tests/command.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,6 @@ async fn create_token_default(test_validator: &TestValidator, payer: &Keypair) {
496496
}
497497
}
498498

499-
500499
async fn create_token_2022(test_validator: &TestValidator, payer: &Keypair) {
501500
let config = test_config_with_default_signer(test_validator, payer, &spl_token_2022::id());
502501
let mut wallet_manager = None;
@@ -506,7 +505,7 @@ async fn create_token_2022(test_validator: &TestValidator, payer: &Keypair) {
506505
let args = &[
507506
"spl-token",
508507
CommandName::CreateToken.into(),
509-
"--token-program-2022"
508+
"--program-2022"
510509
];
511510

512511
let default_decimals = format!("{}", spl_token_2022::native_mint::DECIMALS);
@@ -520,11 +519,8 @@ async fn create_token_2022(test_validator: &TestValidator, payer: &Keypair) {
520519
)
521520
.get_matches_from(args);
522521

523-
let (_sub_command, sub_matches) = app_matches.subcommand();
524-
let matches = sub_matches.unwrap();
525-
526522
let config = Config::new_with_clients_and_ws_url(
527-
matches,
523+
&app_matches,
528524
&mut wallet_manager,
529525
&mut bulk_signers,
530526
&mut multisigner_ids,

0 commit comments

Comments
 (0)