Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
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
Next Next commit
Expose a method that allows converting RunCmd to Configuration
  • Loading branch information
cecton committed Jan 16, 2020
commit b55516927fb191b31ea0d5f882abd0e55ff54072
20 changes: 20 additions & 0 deletions client/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,26 @@ impl<'a, CC, RP> ParseAndPrepare<'a, CC, RP> where CC: GetSharedParams {
}
}

impl<'a, CC, RP> ParseAndPrepare<'a, CC, RP> {
/// Convert ParseAndPrepare to Configuration
pub fn into_configuration<C, G, E, S>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should existing node/cli and node-template/cli be using that function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(answered on #4643 (comment) )

self,
spec_factory: S,
) -> error::Result<Configuration<C, G, E>>
where
C: Default,
G: RuntimeGenesis,
E: ChainSpecExtension,
S: FnOnce(&str) -> Result<Option<ChainSpec<G, E>>, String>,
{
match self {
ParseAndPrepare::Run(c) =>
create_run_node_config(c.params.left, spec_factory, c.impl_name, c.version),
_ => todo!(),
}
}
}

/// Command ready to run the main client.
pub struct ParseAndPrepareRun<'a, RP> {
params: MergeParameters<RunCmd, RP>,
Expand Down