Files
orchid/xtask/src/main.rs
Lawrence Bethlenfalvy f38193edcc
All checks were successful
Rust / build (push) Successful in 4m8s
Protocols and operators mostly
2026-01-21 22:22:58 +01:00

51 lines
1.1 KiB
Rust

mod check_api_refs;
mod orcx;
use std::process::ExitCode;
use std::sync::atomic::{AtomicBool, Ordering};
use std::{env, io};
use check_api_refs::check_api_refs;
use clap::{Parser, Subcommand};
use orcx::orcx;
use crate::orcx::orcxdb;
#[derive(Parser)]
pub struct Args {
#[arg(short, long)]
verbose: bool,
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
CheckApiRefs,
Orcx {
#[arg(long)]
release: bool,
#[arg(trailing_var_arg = true, num_args = 1..)]
argv: Vec<String>,
},
Orcxdb {
#[arg(trailing_var_arg = true, num_args = 1..)]
argv: Vec<String>,
},
}
pub static EXIT_OK: AtomicBool = AtomicBool::new(true);
fn main() -> io::Result<ExitCode> {
if let Some(root) = env::var_os("CARGO_WORKSPACE_DIR") {
env::set_current_dir(root)?;
}
let args = Args::parse();
match &args.command {
Commands::CheckApiRefs => check_api_refs(&args)?,
Commands::Orcx { release, argv } => orcx(*release, &args, argv)?,
Commands::Orcxdb { argv } => orcxdb(&args, argv)?,
}
Ok(if EXIT_OK.load(Ordering::Relaxed) { ExitCode::SUCCESS } else { ExitCode::FAILURE })
}