Files
nym/validator/src/main.rs
T
2020-02-17 16:32:46 +00:00

55 lines
1.1 KiB
Rust

use clap::{App, ArgMatches};
pub mod built_info;
mod commands;
mod config;
mod network;
mod services;
mod validator;
fn main() {
dotenv::dotenv().ok();
pretty_env_logger::init();
println!("{}", banner());
let arg_matches = App::new("Nym Validator")
.version(built_info::PKG_VERSION)
.author("Nymtech")
.about("Implementation of Nym Validator")
.subcommand(commands::init::command_args())
.subcommand(commands::run::command_args())
.get_matches();
execute(arg_matches);
}
fn execute(matches: ArgMatches) {
match matches.subcommand() {
("init", Some(m)) => commands::init::execute(m),
("run", Some(m)) => commands::run::execute(m),
_ => println!("{}", usage()),
}
}
fn usage() -> &'static str {
"usage: --help to see available options.\n\n"
}
fn banner() -> String {
format!(
r#"
_ __ _ _ _ __ ___
| '_ \| | | | '_ \ _ \
| | | | |_| | | | | | |
|_| |_|\__, |_| |_| |_|
|___/
(validator - version {:})
"#,
built_info::PKG_VERSION
)
}