Add various missing cli validators (#5745)

automerge
This commit is contained in:
Michael Vines
2019-08-30 09:27:35 -07:00
committed by Grimes
parent 4786143524
commit 22667d64d1
6 changed files with 42 additions and 4 deletions

View File

@@ -15,7 +15,7 @@ use std::error;
use std::net::SocketAddr;
use std::process::exit;
fn pubkey_validator(pubkey: String) -> Result<(), String> {
fn is_pubkey(pubkey: String) -> Result<(), String> {
match pubkey.parse::<Pubkey>() {
Ok(_) => Ok(()),
Err(err) => Err(format!("{:?}", err)),
@@ -38,6 +38,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.value_name("HOST:PORT")
.takes_value(true)
.default_value(&entrypoint_string)
.validator(solana_netutil::is_host_port)
.global(true)
.help("Rendezvous with the cluster at this entry point"),
)
@@ -81,7 +82,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.long("pubkey")
.value_name("PUBKEY")
.takes_value(true)
.validator(pubkey_validator)
.validator(is_pubkey)
.help("Public key of a specific node to wait for"),
)
.arg(
@@ -101,7 +102,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.index(1)
.required(true)
.value_name("PUBKEY")
.validator(pubkey_validator)
.validator(is_pubkey)
.help("Public key of a specific node to stop"),
),
)