Add a generate-all step and auto-generate settings.md (#5080)

## Summary

Ensures that `generate-all` generates both the JSON Schema and the
`settings.md` API reference.
This commit is contained in:
Charlie Marsh 2024-07-15 15:58:53 -04:00 committed by GitHub
parent 6275b54d51
commit 41cd4bee58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 287 additions and 25 deletions

View file

@ -0,0 +1,30 @@
//! Run all code and documentation generation steps.
use anyhow::Result;
use crate::{generate_json_schema, generate_options_reference};
#[derive(clap::Args)]
pub(crate) struct Args {
#[arg(long, default_value_t, value_enum)]
mode: Mode,
}
#[derive(Copy, Clone, PartialEq, Eq, clap::ValueEnum, Default)]
pub(crate) enum Mode {
/// Update the content in the `configuration.md`.
#[default]
Write,
/// Don't write to the file, check if the file is up-to-date and error if not.
Check,
/// Write the generated help to stdout.
DryRun,
}
pub(crate) fn main(args: &Args) -> Result<()> {
generate_json_schema::main(&generate_json_schema::Args { mode: args.mode })?;
generate_options_reference::main(&generate_options_reference::Args { mode: args.mode })?;
Ok(())
}