git.delta.rocks / unique-network / refs/commits / 2bca9fee0736

difftreelog

source

node/src/command.rs2.1 KiBsourcehistory
1// Copyright 2017-2020 Parity Technologies (UK) Ltd.2// This file is part of Substrate.34// Substrate is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Substrate is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Substrate.  If not, see <http://www.gnu.org/licenses/>.1617use crate::chain_spec;18use crate::cli::Cli;19use crate::service;20use sc_cli::SubstrateCli;21use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;2223impl SubstrateCli for Cli {24	fn impl_name() -> &'static str {25		"Substrate Node"26	}2728	fn impl_version() -> &'static str {29		env!("SUBSTRATE_CLI_IMPL_VERSION")30	}3132	fn description() -> &'static str {33		env!("CARGO_PKG_DESCRIPTION")34	}3536	fn author() -> &'static str {37		env!("CARGO_PKG_AUTHORS")38	}3940	fn support_url() -> &'static str {41		"support.anonymous.an"42	}4344	fn copyright_start_year() -> i32 {45		201746	}4748	fn executable_name() -> &'static str {49		env!("CARGO_PKG_NAME")50	}5152	fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {53		Ok(match id {54			"dev" => Box::new(chain_spec::development_config()),55			"" | "local" => Box::new(chain_spec::local_testnet_config()),56			path => Box::new(chain_spec::ChainSpec::from_json_file(57				std::path::PathBuf::from(path),58			)?),59		})60	}61}6263/// Parse and run command line arguments64pub fn run() -> sc_cli::Result<()> {65	let cli = Cli::from_args();6667	match &cli.subcommand {68		Some(subcommand) => {69			let runner = cli.create_runner(subcommand)?;70			runner.run_subcommand(subcommand, |config| Ok(new_full_start!(config).0))71		}72		None => {73			let runner = cli.create_runner(&cli.run)?;74			runner.run_node(75				service::new_light,76				service::new_full,77				node_template_runtime::VERSION78			)79		}80	}81}