patagia-control/xtask/src/main.rs

31 lines
604 B
Rust
Raw Normal View History

2024-12-11 21:12:24 +01:00
use anyhow::Result;
use clap::Parser;
use patagia_controller::api;
#[derive(Debug, Parser)]
#[command(name = "cargo xtask", about = "Extra tasks for Patagia Controller")]
enum Xtask {
/// Generate OpenAPI spec
OpenApi,
}
fn gen_openapi() -> Result<()> {
let api = api::api()?;
let openapi = api.openapi("Patagia Controller", semver::Version::new(1, 0, 0));
openapi.write(&mut std::io::stdout().lock())?;
Ok(())
}
fn main() -> Result<()> {
let xtask = Xtask::parse();
match xtask {
Xtask::OpenApi => {
gen_openapi()?;
}
}
Ok(())
}