Clap value parser for [`BaseChainSpec`]s. The value parser matches either a known chain, the path to a json file, or a json formatted string in-memory. The json needs to be a Genesis struct.
(s: &str)
| 24 | /// The value parser matches either a known chain, the path |
| 25 | /// to a json file, or a json formatted string in-memory. The json needs to be a Genesis struct. |
| 26 | pub fn chain_value_parser(s: &str) -> eyre::Result<Arc<BaseChainSpec>, eyre::Error> { |
| 27 | if let Some(base_chain_spec) = BaseChainSpec::parse_chain(s) { |
| 28 | Ok(base_chain_spec) |
| 29 | } else { |
| 30 | Ok(Arc::new(BaseChainSpec::try_from_genesis(parse_genesis(s)?)?)) |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | #[cfg(test)] |
| 35 | mod tests { |