mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Move config types into a separate crate because their macros expand into a lot of new code.
21 lines
564 B
Rust
21 lines
564 B
Rust
use anyhow::Result;
|
|
use clap::Parser;
|
|
use std::path::PathBuf;
|
|
|
|
/// Generate the JSON Schema for `config.toml` and write it to `config.schema.json`.
|
|
#[derive(Parser)]
|
|
#[command(name = "codex-write-config-schema")]
|
|
struct Args {
|
|
#[arg(short, long, value_name = "PATH")]
|
|
out: Option<PathBuf>,
|
|
}
|
|
|
|
fn main() -> Result<()> {
|
|
let args = Args::parse();
|
|
let out_path = args
|
|
.out
|
|
.unwrap_or_else(|| PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("config.schema.json"));
|
|
codex_config::schema::write_config_schema(&out_path)?;
|
|
Ok(())
|
|
}
|