use clap::Parser; use std::path::PathBuf; /// Enter chroot environments with Linux namespaces #[derive(Parser, Debug, Clone)] #[command(author, version, about, long_about = None, override_usage = "ecr [OPTIONS] -- [COMMAND]...")] pub struct Args { /// Distribution name (e.g., ubuntu, debian, arch, alpine, fedora) #[arg(value_name = "DISTRO[:VERSION]")] pub distro: String, /// Target architecture #[arg(short, long, value_name = "ARCH")] pub arch: Option, /// Directory to overlay-mount (can be specified multiple times, default: current directory) #[arg(long, value_name = "PATH")] pub bind: Vec, /// Directory to bind-mount read-write at /mnt/ (overrides regular bind, can be specified multiple times) #[arg(long, value_name = "PATH")] pub bind_rw: Vec, /// Download fresh tarball, ignore cache #[arg(long)] pub no_cache: bool, /// Skip mounting any directory #[arg(long)] pub no_bind: bool, /// Print diagnostic messages (URLs, manifest info, extraction steps, etc.) #[arg(short = 'v', long)] pub verbose: bool, /// Boot with QEMU system emulation (optionally specify kernel path, or omit to download default) /// /// Examples: /// --kernel Download and use the default Alpine linux-virt kernel /// --kernel ./vmlinuz Use a specific kernel file #[arg(long, value_name = "KERNEL_PATH", num_args = 0..=1)] pub kernel: Option>, /// Memory size for QEMU VM (only used with --kernel, e.g., 512M, 2G) #[arg(short = 'm', long, default_value = "2G", value_name = "SIZE")] pub memory: String, /// Command to run inside the chroot (default: interactive shell) #[arg( trailing_var_arg = true, allow_hyphen_values = true, value_name = "COMMAND" )] pub command: Vec, }