mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 02:51:08 +00:00
Use yaml.
This commit is contained in:
@@ -9,7 +9,7 @@ trim_trailing_whitespace=true
|
||||
max_line_length=120
|
||||
insert_final_newline=true
|
||||
|
||||
[.travis.yml]
|
||||
[*.yml]
|
||||
indent_style=space
|
||||
indent_size=2
|
||||
tab_width=8
|
||||
|
||||
Generated
+7
@@ -48,6 +48,7 @@ dependencies = [
|
||||
"textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -198,6 +199,11 @@ name = "winapi-build"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "yaml-rust"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699"
|
||||
"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"
|
||||
@@ -225,3 +231,4 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
"checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992"
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[package]
|
||||
name = "polkadot-cli"
|
||||
version = "0.1.0"
|
||||
authors = ["Tomasz Drwięga <tomusdrw@gmail.com>"]
|
||||
authors = ["Parity Team <admin@parity.io>"]
|
||||
description = "Polkadot node implementation in Rust."
|
||||
|
||||
[dependencies]
|
||||
clap = "2.27"
|
||||
clap = { version = "2.27", features = ["yaml"] }
|
||||
env_logger = "0.4"
|
||||
log = "0.3"
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
name: polkadot
|
||||
version: "1.0.0"
|
||||
author: "Parity Team <admin@polkadot.io>"
|
||||
about: Polkadot Node Rust Implementation
|
||||
args:
|
||||
- log:
|
||||
short: l
|
||||
value_name: LOG_PATTERN
|
||||
help: Sets a custom logging
|
||||
takes_value: true
|
||||
subcommands:
|
||||
- collator:
|
||||
about: Run collator node
|
||||
- validator:
|
||||
about: Run validator node
|
||||
+11
-14
@@ -14,35 +14,32 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern crate clap;
|
||||
extern crate env_logger;
|
||||
|
||||
#[macro_use]
|
||||
extern crate clap;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
use clap::{Arg, App, SubCommand};
|
||||
|
||||
pub fn main() {
|
||||
let matches = App::new("Polkadot")
|
||||
.arg(Arg::with_name("log")
|
||||
.short("l")
|
||||
.value_name("LOG")
|
||||
.help("Sets logging.")
|
||||
.takes_value(true))
|
||||
.subcommand(SubCommand::with_name("collator"))
|
||||
.subcommand(SubCommand::with_name("validator"))
|
||||
.get_matches();
|
||||
let yaml = load_yaml!("./cli.yml");
|
||||
let matches = clap::App::from_yaml(yaml).get_matches();
|
||||
|
||||
let log_pattern = matches.value_of("log").unwrap_or("");
|
||||
init_logger(log_pattern);
|
||||
|
||||
if let Some(_) = matches.subcommand_matches("collator") {
|
||||
println!("Running collator.");
|
||||
info!("Starting collator.");
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(_) = matches.subcommand_matches("validator") {
|
||||
println!("Running collator.");
|
||||
info!("Starting validator.");
|
||||
return;
|
||||
}
|
||||
|
||||
println!("No command given.\n");
|
||||
let _ = clap::App::from_yaml(yaml).print_long_help();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user