use clap::Parser;
use std::path::PathBuf;
mod style;
use style::get_style;
#[derive(Parser)]
#[command(
version,
about = "Compare wildcard paths to changed files, or detect changed files from GitHub event context with --find.",
styles = get_style()
)]
pub struct Args {
#[arg(short, long, default_value_t = false, conflicts_with_all = ["wildcard", "changes"])]
pub find: bool,
#[arg(short, long, value_name = "FILE", required_unless_present = "find")]
pub wildcard: Option<PathBuf>,
#[arg(short, long, value_name = "JSON", required_unless_present = "find")]
pub changes: Option<String>,
#[arg(short, long)]
pub debug: bool,
}
pub fn parse_args() -> Args {
let mut args = Args::parse();
if let Some(wildcard) = args.wildcard.take() {
let prefixed = PathBuf::from(".github/workflows").join(format!("wildcard-{}", wildcard.display()));
args.wildcard = Some(prefixed);
}
args
}