mod color;
mod commands;
mod pgp;
mod search;
mod spinner;
mod srcinfo;
mod ui;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "archon", version, about, long_about = None)]
struct Cli {
#[command(subcommand)]
command: Command,
}
#[derive(Subcommand)]
enum Command {
Install {
#[arg(required = true)]
packages: Vec<String>,
#[arg(long)]
dry_run: bool,
#[arg(long)]
yes: bool,
#[arg(long)]
report: bool,
},
Plan {
#[arg(required = true)]
packages: Vec<String>,
},
Remove {
#[arg(required = true)]
packages: Vec<String>,
#[arg(long)]
dry_run: bool,
#[arg(long)]
yes: bool,
},
Build {
dir: String,
#[arg(long)]
report: bool,
},
Search {
term: String,
#[arg(long)]
all: bool,
},
}
fn main() -> anyhow::Result<()> {
env_logger::init();
let cli = Cli::parse();
match cli.command {
Command::Install {
packages,
dry_run,
yes,
report,
} => commands::install::run(&packages, dry_run, yes, report),
Command::Plan { packages } => commands::install::run(&packages, true, false, false),
Command::Remove { packages, dry_run, yes } => commands::remove::run(&packages, dry_run, yes),
Command::Build { dir, report } => {
commands::build::run(&commands::build::parse_dir(&dir), report)
}
Command::Search { term, all } => commands::search::run(&term, all),
}
}