Skip to content

Commit

Permalink
Accept --target-version in the format CLI (#8055)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
charliermarsh committed Oct 19, 2023
1 parent 4786aba commit 2e225d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/ruff_cli/src/args.rs
Expand Up @@ -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<PathBuf>,

/// The minimum Python version that should be supported.
#[arg(long, value_enum)]
pub target_version: Option<PythonVersion>,
/// Enable preview mode; enables unstable formatting.
/// Use `--no-preview` to disable.
#[arg(long, overrides_with("no_preview"))]
Expand Down Expand Up @@ -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()
},
Expand Down

0 comments on commit 2e225d7

Please sign in to comment.