mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 04:19:18 +00:00
Add cargo dev generate-all --check
and catch outdated docs in cargo test
(#3320)
This commit is contained in:
parent
30c71dc59a
commit
22e6778e17
8 changed files with 159 additions and 40 deletions
|
@ -4,22 +4,32 @@ use anyhow::Result;
|
|||
|
||||
use crate::{generate_cli_help, generate_docs, generate_json_schema};
|
||||
|
||||
pub const REGENERATE_ALL_COMMAND: &str = "cargo dev generate-all";
|
||||
|
||||
#[derive(clap::Args)]
|
||||
pub struct Args {
|
||||
/// Write the generated artifacts to stdout (rather than to the filesystem).
|
||||
#[arg(long)]
|
||||
dry_run: bool,
|
||||
/// Don't write to the file, check if the file is up-to-date and error if not
|
||||
#[arg(long)]
|
||||
check: bool,
|
||||
}
|
||||
|
||||
pub fn main(args: &Args) -> Result<()> {
|
||||
generate_docs::main(&generate_docs::Args {
|
||||
dry_run: args.dry_run,
|
||||
})?;
|
||||
// Not checked in
|
||||
if !args.check {
|
||||
generate_docs::main(&generate_docs::Args {
|
||||
dry_run: args.dry_run,
|
||||
})?;
|
||||
}
|
||||
generate_json_schema::main(&generate_json_schema::Args {
|
||||
dry_run: args.dry_run,
|
||||
check: args.check,
|
||||
})?;
|
||||
generate_cli_help::main(&generate_cli_help::Args {
|
||||
dry_run: args.dry_run,
|
||||
check: args.check,
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue