use clap::Args;
use clap::Parser;
use clap::Subcommand;
#[derive(Parser, Debug)]
#[clap(args_conflicts_with_subcommands = true)]
pub struct CLI {
#[command(subcommand)]
pub command: Option<Command>,
#[clap(flatten)]
pub diff: ManifestCliArgs,
}
#[derive(Debug, Subcommand)]
pub enum Command {
Clean {
#[arg(short, long, action)]
verbose: bool,
},
Diff(ManifestCliArgs),
Init(ManifestCliArgs),
}
#[derive(Args, Debug)]
pub struct ManifestCliArgs {
#[clap(value_parser)]
#[arg(short, long, env = "DYD_MANIFEST_PATH", default_value = "dyd.toml", value_hint = clap::ValueHint::FilePath)]
pub manifest: std::path::PathBuf,
}
impl Default for CLI {
fn default() -> Self {
Self::new()
}
}
impl CLI {
pub fn new() -> Self {
CLI::parse()
}
}