From cba804ec57c8fd9c4c33a490374cc6b3af6ea049 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 18 Oct 2023 16:43:20 -0400 Subject: [PATCH] Accept --target-version in the format CLI --- crates/ruff_cli/src/args.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/ruff_cli/src/args.rs b/crates/ruff_cli/src/args.rs index 8a1006a6e6484..f4b7182a2e6f5 100644 --- a/crates/ruff_cli/src/args.rs +++ b/crates/ruff_cli/src/args.rs @@ -398,7 +398,9 @@ pub struct FormatCommand { /// The name of the file when passing it through stdin. #[arg(long, help_heading = "Miscellaneous")] pub stdin_filename: Option, - + /// The minimum Python version that should be supported. + #[arg(long, value_enum)] + pub target_version: Option, /// Enable preview mode; enables unstable formatting. /// Use `--no-preview` to disable. #[arg(long, overrides_with("no_preview"))] @@ -539,6 +541,7 @@ impl FormatCommand { exclude: self.exclude, preview: resolve_bool_arg(self.preview, self.no_preview).map(PreviewMode::from), force_exclude: resolve_bool_arg(self.force_exclude, self.no_force_exclude), + target_version: self.target_version, // Unsupported on the formatter CLI, but required on `Overrides`. ..CliOverrides::default() },