mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-16 14:01:09 +00:00
chore: sync workspace changes
This commit is contained in:
parent
30d3aca1ee
commit
f92ecd9b9a
38 changed files with 4829 additions and 1219 deletions
40
engine/packages/openapi-gen/src/main.rs
Normal file
40
engine/packages/openapi-gen/src/main.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
let mut out: Option<PathBuf> = None;
|
||||
let mut stdout = false;
|
||||
let mut args = env::args().skip(1).peekable();
|
||||
while let Some(arg) = args.next() {
|
||||
if arg == "--stdout" {
|
||||
stdout = true;
|
||||
continue;
|
||||
}
|
||||
if arg == "--out" {
|
||||
if let Some(value) = args.next() {
|
||||
out = Some(PathBuf::from(value));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if let Some(value) = arg.strip_prefix("--out=") {
|
||||
out = Some(PathBuf::from(value));
|
||||
continue;
|
||||
}
|
||||
if out.is_none() {
|
||||
out = Some(PathBuf::from(arg));
|
||||
}
|
||||
}
|
||||
|
||||
let schema = sandbox_daemon_openapi_gen::OPENAPI_JSON;
|
||||
if stdout {
|
||||
println!("{schema}");
|
||||
return;
|
||||
}
|
||||
|
||||
let out = out.unwrap_or_else(|| PathBuf::from("openapi.json"));
|
||||
if let Err(err) = fs::write(&out, schema) {
|
||||
eprintln!("failed to write {}: {err}", out.display());
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue