zint_cli/
lib.rs

1use anyhow::Result;
2use clap::{Parser, Subcommand};
3
4pub mod cmd;
5
6#[derive(Parser)]
7#[command(name = "cargo-zint")]
8pub struct Cli {
9    #[command(subcommand)]
10    pub command: ZintCommand,
11}
12
13#[derive(Subcommand)]
14pub enum ZintCommand {
15    /// Zink testing commands
16    Zint {
17        #[command(subcommand)]
18        subcommand: Commands,
19    },
20}
21
22#[derive(Subcommand)]
23pub enum Commands {
24    /// Create a new ztests crate in the Foundry project
25    New,
26    /// Run the tests in the ztests crate
27    Run,
28}
29
30pub fn run() -> Result<()> {
31    let cli = Cli::parse();
32
33    match cli.command {
34        ZintCommand::Zint { subcommand } => match subcommand {
35            Commands::New => cmd::create_ztests_crate()?,
36            Commands::Run => cmd::run_ztests()?,
37        },
38    }
39
40    Ok(())
41}