From 4c6dc182b27c75c9d7d9d365a57c8a6afa0073c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Thu, 17 Jun 2021 16:52:36 +0200 Subject: [PATCH] CLI: Add missing feature checking and check if someone passes a file (#3283) --- polkadot/cli/src/command.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/polkadot/cli/src/command.rs b/polkadot/cli/src/command.rs index 3a245580de..3bcdd53e79 100644 --- a/polkadot/cli/src/command.rs +++ b/polkadot/cli/src/command.rs @@ -82,7 +82,7 @@ impl SubstrateCli for Cli { #[cfg(feature = "kusama-native")] "kusama-staging" => Box::new(service::chain_spec::kusama_staging_testnet_config()?), #[cfg(not(feature = "kusama-native"))] - name if name.starts_with("kusama-") => + name if name.starts_with("kusama-") && !name.ends_with(".json") => Err(format!("`{}` only supported with `kusama-native` feature enabled.", name))?, "polkadot" => Box::new(service::chain_spec::polkadot_config()?), "polkadot-dev" | "dev" => Box::new(service::chain_spec::polkadot_development_config()?), @@ -95,7 +95,8 @@ impl SubstrateCli for Cli { "rococo-local" => Box::new(service::chain_spec::rococo_local_testnet_config()?), #[cfg(feature = "rococo-native")] "rococo-staging" => Box::new(service::chain_spec::rococo_staging_testnet_config()?), - name if name.starts_with("rococo-") => + #[cfg(not(feature = "rococo-native"))] + name if name.starts_with("rococo-") && !name.ends_with(".json") => Err(format!("`{}` only supported with `rococo-native` feature enabled.", name))?, "westend" => Box::new(service::chain_spec::westend_config()?), #[cfg(feature = "westend-native")] @@ -105,7 +106,7 @@ impl SubstrateCli for Cli { #[cfg(feature = "westend-native")] "westend-staging" => Box::new(service::chain_spec::westend_staging_testnet_config()?), #[cfg(not(feature = "westend-native"))] - name if name.starts_with("westend-") => + name if name.starts_with("westend-") && !name.ends_with(".json") => Err(format!("`{}` only supported with `westend-native` feature enabled.", name))?, "wococo" => Box::new(service::chain_spec::wococo_config()?), #[cfg(feature = "rococo-native")]