mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-03 23:25:14 +00:00
Accept --target-version
in the format CLI (#8055)
## Summary This doesn't affect behavior _yet_ (see: https://github.com/astral-sh/ruff/issues/7234), but it will be needed in the future, and it's surprising to users that it doesn't exist. Closes https://github.com/astral-sh/ruff/issues/8051.
This commit is contained in:
parent
4786abac7a
commit
2e225d7538
1 changed files with 4 additions and 1 deletions
|
@ -398,7 +398,9 @@ pub struct FormatCommand {
|
||||||
/// The name of the file when passing it through stdin.
|
/// The name of the file when passing it through stdin.
|
||||||
#[arg(long, help_heading = "Miscellaneous")]
|
#[arg(long, help_heading = "Miscellaneous")]
|
||||||
pub stdin_filename: Option<PathBuf>,
|
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.
|
/// Enable preview mode; enables unstable formatting.
|
||||||
/// Use `--no-preview` to disable.
|
/// Use `--no-preview` to disable.
|
||||||
#[arg(long, overrides_with("no_preview"))]
|
#[arg(long, overrides_with("no_preview"))]
|
||||||
|
@ -539,6 +541,7 @@ impl FormatCommand {
|
||||||
exclude: self.exclude,
|
exclude: self.exclude,
|
||||||
preview: resolve_bool_arg(self.preview, self.no_preview).map(PreviewMode::from),
|
preview: resolve_bool_arg(self.preview, self.no_preview).map(PreviewMode::from),
|
||||||
force_exclude: resolve_bool_arg(self.force_exclude, self.no_force_exclude),
|
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`.
|
// Unsupported on the formatter CLI, but required on `Overrides`.
|
||||||
..CliOverrides::default()
|
..CliOverrides::default()
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue