use anyhow::Error;
use clap::{Parser, Subcommand};
use fehler::throws;
mod command;
use command::ExplorerCommand;
use command::FuzzCommand;
use command::KeyPairCommand;
#[derive(Parser)]
#[clap(version, propagate_version = true)]
struct Cli {
#[clap(subcommand)]
command: Command,
}
#[derive(Subcommand)]
enum Command {
Build {
#[clap(short, long, default_value = "./")]
root: String,
},
KeyPair {
#[clap(subcommand)]
subcmd: KeyPairCommand,
},
Test {
#[clap(short, long, default_value = "./")]
root: String,
},
Fuzz {
#[clap(short, long)]
root: Option<String>,
#[clap(subcommand)]
subcmd: FuzzCommand,
},
Localnet,
Explorer {
#[clap(subcommand)]
subcmd: ExplorerCommand,
},
Init {
#[arg(short, long)]
skip_fuzzer: bool,
},
}
#[throws]
pub async fn start() {
let cli = Cli::parse();
match cli.command {
Command::Build { root } => command::build(root).await?,
Command::KeyPair { subcmd } => command::keypair(subcmd)?,
Command::Test { root } => command::test(root).await?,
Command::Fuzz { root, subcmd } => command::fuzz(root, subcmd).await?,
Command::Localnet => command::localnet().await?,
Command::Explorer { subcmd } => command::explorer(subcmd).await?,
Command::Init { skip_fuzzer } => command::init(skip_fuzzer).await?,
}
}