generated from Patagia/template-nix
30 lines
604 B
Rust
30 lines
604 B
Rust
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(())
|
|
}
|