Protocols and operators mostly

This commit is contained in:
2026-01-21 22:22:58 +01:00
parent 75b05a2965
commit f38193edcc
33 changed files with 578 additions and 147 deletions

View File

@@ -23,6 +23,8 @@ pub struct Args {
pub enum Commands {
CheckApiRefs,
Orcx {
#[arg(long)]
release: bool,
#[arg(trailing_var_arg = true, num_args = 1..)]
argv: Vec<String>,
},
@@ -41,7 +43,7 @@ fn main() -> io::Result<ExitCode> {
let args = Args::parse();
match &args.command {
Commands::CheckApiRefs => check_api_refs(&args)?,
Commands::Orcx { argv } => orcx(&args, argv)?,
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 })

View File

@@ -4,17 +4,25 @@ use std::sync::atomic::Ordering;
use crate::{Args, EXIT_OK};
pub fn orcx(_args: &Args, argv: &[String]) -> io::Result<()> {
if !Command::new("cargo").args(["build", "-p", "orchid-std", "--quiet"]).status()?.success() {
pub fn orcx(release: bool, _args: &Args, argv: &[String]) -> io::Result<()> {
let mut std_build_cmd = Command::new("cargo");
std_build_cmd.args(["build", "-p", "orchid-std", "--quiet"]);
if release {
std_build_cmd.arg("--release");
}
if !std_build_cmd.status()?.success() {
EXIT_OK.store(false, Ordering::Relaxed);
return Ok(());
}
if !Command::new("cargo")
.args(["run", "-p", "orcx", "--quiet", "--"])
.args(argv)
.status()?
.success()
{
let mut run_cmd = Command::new("cargo");
run_cmd.args(["run", "-p", "orcx", "--quiet"]);
if release {
run_cmd.arg("--release");
}
run_cmd.arg("--");
run_cmd.args(argv);
if !run_cmd.status()?.success() {
EXIT_OK.store(false, Ordering::Relaxed);
}
Ok(())