Use crate_description and crate_name Clap macros

This commit is contained in:
Michael Vines 2019-03-13 20:54:30 -07:00
parent e58220282a
commit bb420cb995
10 changed files with 29 additions and 20 deletions

View File

@ -1,4 +1,4 @@
use clap::{App, Arg};
use clap::{crate_description, crate_name, crate_version, App, Arg};
use solana::packet::{Packet, SharedPackets, BLOB_SIZE, PACKET_DATA_SIZE};
use solana::result::Result;
use solana::streamer::{receiver, PacketReceiver};
@ -51,7 +51,9 @@ fn sink(exit: Arc<AtomicBool>, rvs: Arc<AtomicUsize>, r: PacketReceiver) -> Join
fn main() -> Result<()> {
let mut num_sockets = 1usize;
let matches = App::new("solana-bench-streamer")
let matches = App::new(crate_name!())
.about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("num-recv-sockets")
.long("num-recv-sockets")

View File

@ -2,7 +2,7 @@ use std::net::SocketAddr;
use std::process::exit;
use std::time::Duration;
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_description, crate_name, crate_version, App, Arg, ArgMatches};
use solana_drone::drone::DRONE_PORT;
use solana_sdk::signature::{read_keypair, Keypair, KeypairUtil};
@ -41,7 +41,7 @@ impl Default for Config {
/// Defines and builds the CLI args for a run of the benchmark
pub fn build_args<'a, 'b>() -> App<'a, 'b> {
App::new("solana-bench-tps")
App::new(crate_name!()).about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("network")

View File

@ -1,4 +1,4 @@
use clap::{crate_version, App, Arg};
use clap::{crate_description, crate_name, crate_version, App, Arg};
use log::*;
use solana_drone::drone::{Drone, DRONE_PORT};
use solana_drone::socketaddr;
@ -15,7 +15,8 @@ use tokio_codec::{BytesCodec, Decoder};
fn main() -> Result<(), Box<error::Error>> {
solana_logger::setup();
solana_metrics::set_panic_hook("drone");
let matches = App::new("drone")
let matches = App::new(crate_name!())
.about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("keypair")

View File

@ -1,4 +1,4 @@
use clap::{crate_version, App, Arg};
use clap::{crate_description, crate_name, crate_version, App, Arg};
use log::*;
use solana::cluster_info::{Node, FULLNODE_PORT_RANGE};
use solana::contact_info::ContactInfo;
@ -14,7 +14,7 @@ fn main() {
solana_logger::setup();
solana_metrics::set_panic_hook("fullnode");
let matches = App::new("solana-fullnode")
let matches = App::new(crate_name!()).about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("blockstream")

View File

@ -1,6 +1,6 @@
//! A command-line executable for generating the chain's genesis block.
use clap::{crate_version, value_t_or_exit, App, Arg};
use clap::{crate_description, crate_name, crate_version, value_t_or_exit, App, Arg};
use solana::blocktree::create_new_ledger;
use solana_sdk::genesis_block::GenesisBlock;
use solana_sdk::signature::{read_keypair, Keypair, KeypairUtil};
@ -14,7 +14,8 @@ use std::error;
pub const BOOTSTRAP_LEADER_LAMPORTS: u64 = 2;
fn main() -> Result<(), Box<dyn error::Error>> {
let matches = App::new("solana-genesis")
let matches = App::new(crate_name!())
.about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("bootstrap_leader_keypair_file")

View File

@ -1,9 +1,10 @@
use clap::{crate_version, App, Arg};
use clap::{crate_description, crate_name, crate_version, App, Arg};
use solana_sdk::signature::gen_keypair_file;
use std::error;
fn main() -> Result<(), Box<dyn error::Error>> {
let matches = App::new("solana-keygen")
let matches = App::new(crate_name!())
.about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("outfile")

View File

@ -1,4 +1,4 @@
use clap::{crate_version, App, Arg, SubCommand};
use clap::{crate_description, crate_name, crate_version, App, Arg, SubCommand};
use solana::blocktree::Blocktree;
use solana::blocktree_processor::process_blocktree;
use solana_sdk::genesis_block::GenesisBlock;
@ -7,7 +7,7 @@ use std::process::exit;
fn main() {
solana_logger::setup();
let matches = App::new("ledger-tool")
let matches = App::new(crate_name!()).about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("ledger")

View File

@ -1,4 +1,4 @@
use clap::{crate_version, App, Arg};
use clap::{crate_description, crate_name, crate_version, App, Arg};
use solana::cluster_info::Node;
use solana::contact_info::ContactInfo;
use solana::replicator::Replicator;
@ -11,7 +11,7 @@ use std::sync::Arc;
fn main() {
solana_logger::setup();
let matches = App::new("replicator")
let matches = App::new(crate_name!()).about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("identity")

View File

@ -1,4 +1,4 @@
use clap::{crate_version, App, Arg};
use clap::{crate_description, crate_name, crate_version, App, Arg};
use solana_vote_signer::rpc::VoteSignerRpcService;
use std::error;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
@ -9,7 +9,8 @@ pub const RPC_PORT: u16 = 8989;
fn main() -> Result<(), Box<error::Error>> {
solana_metrics::set_panic_hook("vote-signer");
let matches = App::new("vote-signer")
let matches = App::new(crate_name!())
.about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("port")

View File

@ -1,4 +1,6 @@
use clap::{crate_version, App, Arg, ArgGroup, ArgMatches, SubCommand};
use clap::{
crate_description, crate_name, crate_version, App, Arg, ArgGroup, ArgMatches, SubCommand,
};
use solana_sdk::signature::{gen_keypair_file, read_keypair, KeypairUtil};
use solana_wallet::wallet::{parse_command, process_command, WalletConfig, WalletError};
use std::error;
@ -88,7 +90,8 @@ fn main() -> Result<(), Box<dyn error::Error>> {
)
};
let matches = App::new("solana-wallet")
let matches = App::new(crate_name!())
.about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("host")