use std::path::PathBuf;
use clap::Parser;
use clap_derive::{Args, Subcommand};
#[derive(Debug, Subcommand)]
pub enum SubCommand {
Build(BuildCommand),
Run(RunCommand),
Init(InitCommand),
Install(InstallCommand),
Clean(CleanCommand),
}
#[derive(Debug, Args)]
pub struct BuildCommand {
#[arg(long, required = false)]
pub force: bool,
#[arg(long, default_value = "true")]
pub emit_compile_commands: bool,
#[clap(default_value = ".")]
pub path: String,
#[arg(long, required = false)]
pub silent: bool,
}
#[derive(Debug, Args)]
pub struct RunCommand {
#[arg(long, required = false)]
pub force: bool,
#[clap(default_value = ".")]
pub path: String,
}
#[derive(Debug, Args)]
pub struct InitCommand {
pub name: String,
#[arg(long, required = false)]
pub cpp: bool,
#[arg(long, required = false)]
pub lib: bool,
}
#[derive(Debug, Args)]
pub struct CleanCommand {
#[clap(default_value = ".")]
pub path: String,
}
#[derive(Debug, Args)]
pub struct InstallCommand {
#[clap(default_value = ".")]
pub path: String,
#[arg(long, required = false)]
pub force: bool,
#[arg(long, required = false)]
pub silent: bool,
}
#[derive(Debug, Parser)]
#[clap(author, version, about)]
#[command(name = "bricks")]
#[command(bin_name = "bricks")]
#[command(styles = CLAP_STYLING)]
pub struct Args {
#[clap(subcommand)]
pub sub: SubCommand,
#[arg(
short,
long,
value_name = "CONFIG PATH",
required = false,
default_value = "./brick.toml"
)]
pub config: PathBuf,
}
pub const CLAP_STYLING: clap::builder::styling::Styles = clap::builder::styling::Styles::styled()
.header(
anstyle::Style::new()
.bold()
.fg_color(Some(anstyle::Color::Ansi(anstyle::AnsiColor::Magenta))),
)
.usage(
anstyle::Style::new()
.bold()
.fg_color(Some(anstyle::Color::Ansi(anstyle::AnsiColor::Magenta))),
)
.literal(
anstyle::Style::new()
.bold()
.fg_color(Some(anstyle::Color::Ansi(anstyle::AnsiColor::Blue))),
);