git.delta.rocks / unique-network / refs/commits / 97765fef60a1

difftreelog

source

node/src/command.rs2.0 KiBsourcehistory
1// This file is part of Substrate.23// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.4// SPDX-License-Identifier: Apache-2.056// Licensed under the Apache License, Version 2.0 (the "License");7// you may not use this file except in compliance with the License.8// You may obtain a copy of the License at9//10// 	http://www.apache.org/licenses/LICENSE-2.011//12// Unless required by applicable law or agreed to in writing, software13// distributed under the License is distributed on an "AS IS" BASIS,14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15// See the License for the specific language governing permissions and16// limitations under the License.1718use crate::chain_spec;19use crate::cli::Cli;20use crate::service;21use sc_cli::SubstrateCli;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				nft_runtime::VERSION78			)79		}80	}81}