mirror of
https://git.ghostchain.io/proxmio/ghost-node.git
synced 2025-12-27 03:09:56 +00:00
inital commit, which is clearly not initial
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
40
client/cli/src/commands/key.rs
Executable file
40
client/cli/src/commands/key.rs
Executable file
@@ -0,0 +1,40 @@
|
||||
//! Key related CLI utilities
|
||||
|
||||
use super::{generate::GenerateCmd, inspect_key::InspectKeyCmd};
|
||||
use sc_cli::{
|
||||
GenerateKeyCmdCommon, InsertKeyCmd, InspectNodeKeyCmd, Error,
|
||||
SubstrateCli,
|
||||
};
|
||||
|
||||
/// Key utilities for the cli.
|
||||
#[derive(Debug, clap::Subcommand)]
|
||||
pub enum KeySubcommand {
|
||||
/// Generate a random node key, write it to a file or stdout and write the
|
||||
/// corresponding peer-id to stderr
|
||||
GenerateNodeKey(GenerateKeyCmdCommon),
|
||||
|
||||
/// Generate a Substrate-based random account
|
||||
Generate(GenerateCmd),
|
||||
|
||||
/// Gets a public key and a SS58 address from the provided Secret URI
|
||||
Inspect(InspectKeyCmd),
|
||||
|
||||
/// Load a node key from a file or stdin and print the corresponding peer-id
|
||||
InspectNodeKey(InspectNodeKeyCmd),
|
||||
|
||||
/// Insert a key to the keystore of a node.
|
||||
Insert(InsertKeyCmd),
|
||||
}
|
||||
|
||||
impl KeySubcommand {
|
||||
/// run the key subcommands
|
||||
pub fn run<C: SubstrateCli>(&self, cli: &C) -> Result<(), Error> {
|
||||
match self {
|
||||
KeySubcommand::GenerateNodeKey(cmd) => cmd.run(),
|
||||
KeySubcommand::Generate(cmd) => cmd.run(),
|
||||
KeySubcommand::Inspect(cmd) => cmd.run(),
|
||||
KeySubcommand::Insert(cmd) => cmd.run(cli),
|
||||
KeySubcommand::InspectNodeKey(cmd) => cmd.run(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user