+6
-10
@@ -1,12 +1,14 @@
|
||||
mod build;
|
||||
mod command;
|
||||
mod image;
|
||||
mod meta;
|
||||
mod qemu;
|
||||
mod registry;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
use crate::{image::ImageCmd, qemu::RunCmd};
|
||||
use crate::{build::BuildCmd, image::ImageCmd, qemu::RunCmd};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(about = "Build bootable initrd VMs from container images")]
|
||||
@@ -18,13 +20,7 @@ struct Cli {
|
||||
#[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,
|
||||
},
|
||||
Build(BuildCmd),
|
||||
/// Launch a previously built VM via QEMU.
|
||||
Run(RunCmd),
|
||||
/// List slim images in the registry
|
||||
@@ -35,8 +31,8 @@ enum Commands {
|
||||
fn main() -> Result<()> {
|
||||
let cli = Cli::parse();
|
||||
match cli.command {
|
||||
Commands::Build { image, _size: _ } => {
|
||||
build::build(&image)?;
|
||||
Commands::Build(cmd) => {
|
||||
build::build(cmd)?;
|
||||
}
|
||||
Commands::Run(cmd) => {
|
||||
qemu::run(cmd)?;
|
||||
|
||||
Reference in New Issue
Block a user