Skip to content

Commit 2e225d7

Browse files
Accept --target-version in the format CLI (#8055)
## Summary This doesn't affect behavior _yet_ (see: #7234), but it will be needed in the future, and it's surprising to users that it doesn't exist. Closes #8051.
1 parent 4786aba commit 2e225d7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/ruff_cli/src/args.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,9 @@ pub struct FormatCommand {
398398
/// The name of the file when passing it through stdin.
399399
#[arg(long, help_heading = "Miscellaneous")]
400400
pub stdin_filename: Option<PathBuf>,
401-
401+
/// The minimum Python version that should be supported.
402+
#[arg(long, value_enum)]
403+
pub target_version: Option<PythonVersion>,
402404
/// Enable preview mode; enables unstable formatting.
403405
/// Use `--no-preview` to disable.
404406
#[arg(long, overrides_with("no_preview"))]
@@ -539,6 +541,7 @@ impl FormatCommand {
539541
exclude: self.exclude,
540542
preview: resolve_bool_arg(self.preview, self.no_preview).map(PreviewMode::from),
541543
force_exclude: resolve_bool_arg(self.force_exclude, self.no_force_exclude),
544+
target_version: self.target_version,
542545
// Unsupported on the formatter CLI, but required on `Overrides`.
543546
..CliOverrides::default()
544547
},

0 commit comments

Comments
 (0)