1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
mod decode;
mod encode;
mod hash;

pub use decode::GenesisDecodeCommand;
pub use encode::GenesisEncodeCommand;
pub use hash::GenesisHashCommand;
use std::process::Command;
pub struct GenesisCommand {
    command: Command,
}

impl GenesisCommand {
    pub fn new(command: Command) -> Self {
        Self { command }
    }

    pub fn encode(mut self) -> GenesisEncodeCommand {
        self.command.arg("encode");
        GenesisEncodeCommand::new(self.command)
    }

    pub fn decode(mut self) -> GenesisDecodeCommand {
        self.command.arg("decode");
        GenesisDecodeCommand::new(self.command)
    }

    pub fn hash(mut self) -> GenesisHashCommand {
        self.command.arg("hash");
        GenesisHashCommand::new(self.command)
    }

    pub fn init(mut self) -> Command {
        self.command.arg("init");
        self.command
    }
}