mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 04:45:01 +00:00
refactor: Rename CLI arg structs from Cli to Args
Technically the command-line interface (CLI) encompasses both input and output, so naming the input structs 'Args' is more accurate than 'Cli'.
This commit is contained in:
parent
b346f74915
commit
d9ead4e6df
15 changed files with 86 additions and 95 deletions
|
@ -1,7 +1,6 @@
|
|||
//! Generate a Markdown-compatible listing of configuration options.
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Args;
|
||||
use itertools::Itertools;
|
||||
use ruff::settings::options::Options;
|
||||
use ruff::settings::options_base::{ConfigurationOptions, OptionEntry, OptionField};
|
||||
|
@ -11,8 +10,8 @@ use crate::utils::replace_readme_section;
|
|||
const BEGIN_PRAGMA: &str = "<!-- Begin auto-generated options sections. -->";
|
||||
const END_PRAGMA: &str = "<!-- End auto-generated options sections. -->";
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct Cli {
|
||||
#[derive(clap::Args)]
|
||||
pub struct Args {
|
||||
/// Write the generated table to stdout (rather than to `README.md`).
|
||||
#[arg(long)]
|
||||
pub(crate) dry_run: bool,
|
||||
|
@ -39,7 +38,7 @@ fn emit_field(output: &mut String, field: &OptionField, group_name: Option<&str>
|
|||
output.push('\n');
|
||||
}
|
||||
|
||||
pub fn main(cli: &Cli) -> Result<()> {
|
||||
pub fn main(args: &Args) -> Result<()> {
|
||||
let mut output = String::new();
|
||||
|
||||
// Generate all the top-level fields.
|
||||
|
@ -89,7 +88,7 @@ pub fn main(cli: &Cli) -> Result<()> {
|
|||
}
|
||||
}
|
||||
|
||||
if cli.dry_run {
|
||||
if args.dry_run {
|
||||
print!("{output}");
|
||||
} else {
|
||||
replace_readme_section(&output, BEGIN_PRAGMA, END_PRAGMA)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue