use clap::{Parser, Subcommand};
use profile::ProfileCommand;
use rootfs::RootFSCommand;
use user::UserCommand;
pub mod profile;
pub mod rootfs;
#[cfg(test)]
mod tests;
pub mod user;
#[derive(Debug, Parser, Clone)]
#[command(author, version, about)]
pub struct CommandLineArgs {
#[command(subcommand)]
pub action: Action,
#[arg(
short = 'f',
long = "manifest",
default_value = "dadk-manifest.toml",
global = true
)]
pub manifest_path: String,
#[arg(short = 'w', long = "workdir", default_value = ".", global = true)]
pub workdir: String,
}
#[derive(Debug, Subcommand, Clone, PartialEq, Eq)]
pub enum Action {
Kernel,
#[command(subcommand, name = "rootfs")]
Rootfs(RootFSCommand),
#[command(subcommand, name = "user")]
User(UserCommand),
#[command(subcommand, name = "profile")]
Profile(ProfileCommand),
}
impl Action {
pub fn needs_manifest(&self) -> bool {
if matches!(self, Action::Profile(_)) {
return false;
}
return true;
}
}