mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-11 21:06:19 +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,15 +1,14 @@
|
|||
//! Generate CLI help.
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Args;
|
||||
|
||||
use crate::utils::replace_readme_section;
|
||||
|
||||
const HELP_BEGIN_PRAGMA: &str = "<!-- Begin auto-generated cli help. -->";
|
||||
const HELP_END_PRAGMA: &str = "<!-- End auto-generated cli help. -->";
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct Cli {
|
||||
#[derive(clap::Args)]
|
||||
pub struct Args {
|
||||
/// Write the generated help to stdout (rather than to `README.md`).
|
||||
#[arg(long)]
|
||||
pub(crate) dry_run: bool,
|
||||
|
@ -19,10 +18,10 @@ fn trim_lines(s: &str) -> String {
|
|||
s.lines().map(str::trim_end).collect::<Vec<_>>().join("\n")
|
||||
}
|
||||
|
||||
pub fn main(cli: &Cli) -> Result<()> {
|
||||
pub fn main(args: &Args) -> Result<()> {
|
||||
let output = trim_lines(ruff_cli::help().trim());
|
||||
|
||||
if cli.dry_run {
|
||||
if args.dry_run {
|
||||
print!("{output}");
|
||||
} else {
|
||||
replace_readme_section(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue