Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use yaml.
  • Loading branch information
tomusdrw committed Nov 10, 2017
commit 5b299d40e8bf484f3f988cf758cc8a214325adbc
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[package]
name = "polkadot-cli"
version = "0.1.0"
authors = ["Tomasz Drwięga <[email protected]>"]
authors = ["Parity Team <[email protected]>"]
description = "Polkadot node implementation in Rust."

[dependencies]
clap = "2.27"
clap = { version = "2.27", features = ["yaml"] }
env_logger = "0.4"
log = "0.3"
15 changes: 15 additions & 0 deletions cli/src/cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: polkadot
version: "1.0.0"
author: "Parity Team <[email protected]>"
about: Polkadot Node Rust Implementation
args:
- log:
short: l
value_name: LOG_PATTERN
help: Sets a custom logging
takes_value: true
subcommands:
- collator:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

polkadot --light --collating-for PARACHAIN_ID, and then collation process hooks into RPC

about: Run collator node
- validator:
about: Run validator node
25 changes: 11 additions & 14 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
extern crate log;

use clap::{Arg, App, SubCommand};
#[macro_use]
extern crate clap;
#[macro_use]
extern crate log;

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();
}


Expand Down