Add --line-length command line argument (#759)

This commit is contained in:
Charlie Marsh 2022-11-15 12:23:38 -05:00 committed by GitHub
parent ff0e5f5cb4
commit 0d3fac1bf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View file

@ -237,6 +237,8 @@ Options:
Regular expression matching the name of dummy variables Regular expression matching the name of dummy variables
--target-version <TARGET_VERSION> --target-version <TARGET_VERSION>
The minimum Python version that should be supported The minimum Python version that should be supported
--line-length <LINE_LENGTH>
Set the line-length for length-associated checks and automatic formatting
--stdin-filename <STDIN_FILENAME> --stdin-filename <STDIN_FILENAME>
The name of the file when passing it through stdin The name of the file when passing it through stdin
-h, --help -h, --help

View file

@ -87,6 +87,10 @@ pub struct Cli {
/// The minimum Python version that should be supported. /// The minimum Python version that should be supported.
#[arg(long)] #[arg(long)]
pub target_version: Option<PythonVersion>, pub target_version: Option<PythonVersion>,
/// Set the line-length for length-associated checks and automatic
/// formatting.
#[arg(long)]
pub line_length: Option<usize>,
/// Round-trip auto-formatting. /// Round-trip auto-formatting.
// TODO(charlie): This should be a sub-command. // TODO(charlie): This should be a sub-command.
#[arg(long, hide = true)] #[arg(long, hide = true)]

View file

@ -292,6 +292,9 @@ fn inner_main() -> Result<ExitCode> {
if !cli.extend_ignore.is_empty() { if !cli.extend_ignore.is_empty() {
configuration.extend_ignore = cli.extend_ignore; configuration.extend_ignore = cli.extend_ignore;
} }
if let Some(line_length) = cli.line_length {
configuration.line_length = line_length;
}
if let Some(target_version) = cli.target_version { if let Some(target_version) = cli.target_version {
configuration.target_version = target_version; configuration.target_version = target_version;
} }