refactor(rust): align workspace with style rules

This commit is contained in:
2026-09-17 09:57:11 -04:00
parent cf9a671fb8
commit b4b77faaa9
15 changed files with 124 additions and 28 deletions

View File

@@ -0,0 +1,38 @@
use std::path::PathBuf;
use clap::Parser;
#[derive(Debug, Parser)]
struct Args {
#[arg(long, default_value = "output")]
output_dir: PathBuf,
#[arg(long)]
force: bool,
#[arg(default_value = "all", value_parser = parse_stage)]
target_stage: ariadne::pipeline::Stage,
}
impl From<Args> for ariadne::Config {
fn from(args: Args) -> Self {
ariadne::Config {
output_dir: monorepo::workspace::resolve_workspace_path(args.output_dir),
force: args.force,
target_stage: args.target_stage,
}
}
}
fn parse_stage(value: &str) -> Result<ariadne::pipeline::Stage, String> {
ariadne::pipeline::Stage::ALL
.iter()
.copied()
.find(|stage| stage.name() == value)
.ok_or_else(|| format!("unknown stage: {value}"))
}
fn main() -> ariadne::Result<()> {
let config: ariadne::Config = Args::parse().into();
ariadne::run(&config)
}