token-cli: Dedupe 'transfer' help message --owner value name

This commit is contained in:
Trent Nelson 2021-07-06 14:14:30 -06:00 committed by mergify[bot]
parent e8b555f69d
commit 7b5afeac8d
1 changed files with 8 additions and 6 deletions

View File

@ -98,15 +98,19 @@ pub fn owner_address_arg<'a, 'b>() -> Arg<'a, 'b> {
.help(OWNER_ADDRESS_ARG.help) .help(OWNER_ADDRESS_ARG.help)
} }
pub fn owner_keypair_arg<'a, 'b>() -> Arg<'a, 'b> { pub fn owner_keypair_arg_with_value_name<'a, 'b>(value_name: &'static str) -> Arg<'a, 'b> {
Arg::with_name(OWNER_KEYPAIR_ARG.name) Arg::with_name(OWNER_KEYPAIR_ARG.name)
.long(OWNER_KEYPAIR_ARG.long) .long(OWNER_KEYPAIR_ARG.long)
.takes_value(true) .takes_value(true)
.value_name("OWNER_KEYPAIR") .value_name(value_name)
.validator(is_valid_signer) .validator(is_valid_signer)
.help(OWNER_KEYPAIR_ARG.help) .help(OWNER_KEYPAIR_ARG.help)
} }
pub fn owner_keypair_arg<'a, 'b>() -> Arg<'a, 'b> {
owner_keypair_arg_with_value_name("OWNER_KEYPAIR")
}
pub fn mint_address_arg<'a, 'b>() -> Arg<'a, 'b> { pub fn mint_address_arg<'a, 'b>() -> Arg<'a, 'b> {
Arg::with_name(MINT_ADDRESS_ARG.name) Arg::with_name(MINT_ADDRESS_ARG.name)
.long(MINT_ADDRESS_ARG.long) .long(MINT_ADDRESS_ARG.long)
@ -1629,8 +1633,7 @@ fn main() {
.help("Specify the sending token account \ .help("Specify the sending token account \
[default: owner's associated token account]") [default: owner's associated token account]")
) )
.arg(owner_keypair_arg() .arg(owner_keypair_arg_with_value_name("SENDER_TOKEN_OWNER_KEYPAIR")
.value_name("SENDER_TOKEN_OWNER_KEYPAIR")
.help( .help(
"Specify the owner of the sending token account. \ "Specify the owner of the sending token account. \
This may be a keypair file, the ASK keyword. \ This may be a keypair file, the ASK keyword. \
@ -1694,8 +1697,7 @@ fn main() {
.required(true) .required(true)
.help("Amount to burn, in tokens"), .help("Amount to burn, in tokens"),
) )
.arg(owner_keypair_arg() .arg(owner_keypair_arg_with_value_name("SOURCE_TOKEN_OWNER_KEYPAIR")
.value_name("SOURCE_TOKEN_OWNER_KEYPAIR")
.help( .help(
"Specify the source token owner account. \ "Specify the source token owner account. \
This may be a keypair file, the ASK keyword. \ This may be a keypair file, the ASK keyword. \