trdelnik_sandbox_cli/
lib.rs1use anyhow::Error;
2use clap::{Parser, Subcommand};
3use fehler::throws;
4
5mod command;
7use command::ExplorerCommand;
9use command::KeyPairCommand;
10
11#[derive(Parser)]
12#[clap(version, propagate_version = true)]
13struct Cli {
14 #[clap(subcommand)]
15 command: Command,
16}
17
18#[derive(Subcommand)]
19enum Command {
20 Build {
22 #[clap(short, long, default_value = "./")]
24 root: String,
25 },
26 KeyPair {
28 #[clap(subcommand)]
29 subcmd: KeyPairCommand,
30 },
31 Test {
33 #[clap(short, long, default_value = "./")]
35 root: String,
36 },
37 Localnet,
39 Explorer {
41 #[clap(subcommand)]
42 subcmd: ExplorerCommand,
43 },
44 Init,
46}
47
48#[throws]
49pub async fn start() {
50 let cli = Cli::parse();
51
52 match cli.command {
53 Command::Build { root } => command::build(root).await?,
54 Command::KeyPair { subcmd } => command::keypair(subcmd)?,
55 Command::Test { root } => command::test(root).await?,
56 Command::Localnet => command::localnet().await?,
57 Command::Explorer { subcmd } => command::explorer(subcmd).await?,
58 Command::Init => command::init().await?,
59 }
60}