zoi/cmd/package/
mod.rs

1use anyhow::Result;
2use clap::{Parser, Subcommand};
3
4pub mod build;
5pub mod install;
6pub mod test;
7
8#[derive(Parser, Debug)]
9pub struct PackageCommand {
10    #[command(subcommand)]
11    command: Commands,
12}
13
14#[derive(Subcommand, Debug)]
15enum Commands {
16    /// Build a package from a pkg.lua file
17    Build(build::BuildCommand),
18    /// Test a package from a pkg.lua file
19    Test(build::BuildCommand),
20    /// Install a package from a local archive
21    Install(install::InstallCommand),
22}
23
24pub fn run(args: PackageCommand) -> Result<()> {
25    match args.command {
26        Commands::Build(cmd) => build::run(cmd),
27        Commands::Test(cmd) => test::run(cmd),
28        Commands::Install(cmd) => install::run(cmd),
29    }
30}