diff --git a/README.md b/README.md index 9a11526168..4c1dc82254 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,8 @@ Arguments: ... Options: + --config + Path to the `pyproject.toml` file to use for configuration -v, --verbose Enable verbose logging -q, --quiet @@ -132,6 +134,8 @@ Options: Regular expression matching the name of dummy variables --target-version The minimum Python version that should be supported + --stdin-filename + The name of the file when passing it through stdin -h, --help Print help information -V, --version diff --git a/src/cli.rs b/src/cli.rs index 66407842eb..663e35e2e6 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -17,6 +17,9 @@ use crate::RawSettings; pub struct Cli { #[arg(required = true)] pub files: Vec, + /// Path to the `pyproject.toml` file to use for configuration. + #[arg(long)] + pub config: Option, /// Enable verbose logging. #[arg(short, long)] pub verbose: bool, diff --git a/src/main.rs b/src/main.rs index 4d95437165..b7d3857f1c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -216,7 +216,9 @@ fn inner_main() -> Result { Some(path) => debug!("Found project root at: {:?}", path), None => debug!("Unable to identify project root; assuming current directory..."), }; - let pyproject = pyproject::find_pyproject_toml(&project_root); + let pyproject = cli + .config + .or_else(|| pyproject::find_pyproject_toml(&project_root)); match &pyproject { Some(path) => debug!("Found pyproject.toml at: {:?}", path), None => debug!("Unable to find pyproject.toml; using default settings..."),