mod build; mod qemu; mod registry; use anyhow::Result; use clap::{Parser, Subcommand}; #[derive(Parser, Debug)] #[command(about = "Build bootable initrd VMs from container images")] struct Cli { #[command(subcommand)] command: Commands, } #[derive(Subcommand, Debug)] enum Commands { /// Build initrd from an image (podman image must exist) Build { /// Image name (e.g. alpine:3.15 or slim:tag) image: String, /// Size hint (unused in v1 initrd) #[arg(short = 's', long, default_value = "512")] _size: String, }, /// Launch the VM via QEMU using registry artifacts Run { /// Image tag / registry subdir name name: String, }, } fn main() -> Result<()> { let cli = Cli::parse(); match cli.command { Commands::Build { image, _size: _ } => { build::build(&image)?; } Commands::Run { name } => { qemu::run(&name)?; } } Ok(()) }