Extract duplicate clap helpers into clap-utils (#6812)

This commit is contained in:
Ryo Onodera
2019-11-12 09:42:08 +09:00
committed by GitHub
parent 95d6586dd7
commit d84f367317
21 changed files with 89 additions and 95 deletions

View File

@@ -10,6 +10,7 @@ homepage = "https://solana.com/"
[dependencies]
clap = "2.33.0"
solana-clap-utils = { path = "../clap-utils", version = "0.21.0" }
solana-core = { path = "../core", version = "0.21.0" }
solana-client = { path = "../client", version = "0.21.0" }
solana-logger = { path = "../logger", version = "0.21.0" }

View File

@@ -4,6 +4,7 @@ use clap::{
crate_description, crate_name, crate_version, value_t_or_exit, App, AppSettings, Arg,
SubCommand,
};
use solana_clap_utils::input_validators::is_pubkey;
use solana_client::rpc_client::RpcClient;
use solana_core::{contact_info::ContactInfo, gossip_service::discover};
use solana_sdk::pubkey::Pubkey;
@@ -11,13 +12,6 @@ use std::error;
use std::net::SocketAddr;
use std::process::exit;
fn is_pubkey(pubkey: String) -> Result<(), String> {
match pubkey.parse::<Pubkey>() {
Ok(_) => Ok(()),
Err(err) => Err(format!("{:?}", err)),
}
}
fn main() -> Result<(), Box<dyn error::Error>> {
solana_logger::setup_with_filter("solana=info");