In Wallet, make --tokens required and --to optional
This commit is contained in:
committed by
Greg Fitzgerald
parent
97372b8e63
commit
eb6a30cb7c
@ -100,6 +100,7 @@ fn parse_args() -> Result<WalletConfig, Box<error::Error>> {
|
|||||||
.long("tokens")
|
.long("tokens")
|
||||||
.value_name("NUMBER")
|
.value_name("NUMBER")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
|
.required(true)
|
||||||
.help("The number of tokens to request"),
|
.help("The number of tokens to request"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -121,7 +122,6 @@ fn parse_args() -> Result<WalletConfig, Box<error::Error>> {
|
|||||||
.long("to")
|
.long("to")
|
||||||
.value_name("PUBKEY")
|
.value_name("PUBKEY")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.required(true)
|
|
||||||
.help("The pubkey of recipient"),
|
.help("The pubkey of recipient"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -155,11 +155,7 @@ fn parse_args() -> Result<WalletConfig, Box<error::Error>> {
|
|||||||
|
|
||||||
let command = match matches.subcommand() {
|
let command = match matches.subcommand() {
|
||||||
("airdrop", Some(airdrop_matches)) => {
|
("airdrop", Some(airdrop_matches)) => {
|
||||||
let tokens = if airdrop_matches.is_present("tokens") {
|
let tokens = airdrop_matches.value_of("tokens").unwrap().parse()?;
|
||||||
airdrop_matches.value_of("tokens").unwrap().parse()?
|
|
||||||
} else {
|
|
||||||
100
|
|
||||||
};
|
|
||||||
Ok(WalletCommand::AirDrop(tokens))
|
Ok(WalletCommand::AirDrop(tokens))
|
||||||
}
|
}
|
||||||
("pay", Some(pay_matches)) => {
|
("pay", Some(pay_matches)) => {
|
||||||
@ -177,11 +173,7 @@ fn parse_args() -> Result<WalletConfig, Box<error::Error>> {
|
|||||||
id.pubkey()
|
id.pubkey()
|
||||||
};
|
};
|
||||||
|
|
||||||
let tokens = if pay_matches.is_present("tokens") {
|
let tokens = pay_matches.value_of("tokens").unwrap().parse()?;
|
||||||
pay_matches.value_of("tokens").unwrap().parse()?
|
|
||||||
} else {
|
|
||||||
10
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(WalletCommand::Pay(tokens, to))
|
Ok(WalletCommand::Pay(tokens, to))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user