mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:10 +00:00
Avoid printing docs on cargo dev generate-all (#3890)
This commit is contained in:
parent
e0bccfd2d9
commit
ac87137c1c
1 changed files with 5 additions and 10 deletions
|
@ -14,11 +14,11 @@ pub struct Args {
|
|||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, clap::ValueEnum, Default)]
|
||||
pub enum Mode {
|
||||
/// Update the content in the `configuration.md`
|
||||
/// 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
|
||||
/// 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 (rather than to `docs/configuration.md`).
|
||||
|
@ -26,21 +26,16 @@ pub enum Mode {
|
|||
}
|
||||
|
||||
impl Mode {
|
||||
const fn is_check(self) -> bool {
|
||||
matches!(self, Mode::Check)
|
||||
}
|
||||
|
||||
pub(crate) const fn is_dry_run(self) -> bool {
|
||||
matches!(self, Mode::DryRun)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main(args: &Args) -> Result<()> {
|
||||
// Not checked in
|
||||
if !args.mode.is_check() {
|
||||
generate_docs::main(&generate_docs::Args { dry_run: true })?;
|
||||
}
|
||||
generate_json_schema::main(&generate_json_schema::Args { mode: args.mode })?;
|
||||
generate_cli_help::main(&generate_cli_help::Args { mode: args.mode })?;
|
||||
generate_docs::main(&generate_docs::Args {
|
||||
dry_run: args.mode.is_dry_run(),
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue