use std::path::PathBuf;
use clap::{ArgGroup, Parser};
use crate::command::Command;
#[derive(Parser, Clone, PartialEq, Eq, Debug)]
pub struct App {
#[arg(hide = true, value_parser = clap::builder::PossibleValuesParser::new(["modules"]))]
pub dummy: Option<String>,
#[command(subcommand)]
pub command: Command,
}
impl App {
pub fn sanitized_command(self) -> Command {
let mut command = self.command;
command.sanitize();
command
}
}
#[derive(Parser, Clone, PartialEq, Eq, Debug)]
#[group(id = "ProjectOptions")]
#[command(group = ArgGroup::new("target-group"))]
pub struct ProjectOptions {
#[arg(long = "lib", group = "target-group")]
pub lib: bool,
#[arg(long = "bin", group = "target-group")]
pub bin: Option<String>,
#[arg(short = 'p', long = "package")]
pub package: Option<String>,
#[arg(long = "no-default-features")]
pub no_default_features: bool,
#[arg(long = "all-features")]
pub all_features: bool,
#[arg(long = "features")]
pub features: Vec<String>,
#[arg(long = "target")]
pub target: Option<String>,
#[arg(long = "manifest-path", default_value = ".")]
pub manifest_path: PathBuf,
}
#[derive(Parser, Clone, PartialEq, Eq, Debug)]
#[group(id = "GeneralOptions")]
pub struct GeneralOptions {
#[arg(long = "verbose")]
pub verbose: bool,
}