From 207b0fd5e93cf0a0bb62342b7353e6460abc9c10 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Mon, 24 Feb 2025 19:58:15 +0100 Subject: [PATCH] [red-knot] Add argfile and windows glob path support --- Cargo.lock | 2 ++ crates/red_knot/Cargo.toml | 2 ++ crates/red_knot/src/main.rs | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 7e109660db2ce..4b5766f4fc7c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2409,6 +2409,7 @@ name = "red_knot" version = "0.0.0" dependencies = [ "anyhow", + "argfile", "chrono", "clap", "colored 3.0.0", @@ -2433,6 +2434,7 @@ dependencies = [ "tracing-flame", "tracing-subscriber", "tracing-tree", + "wild", ] [[package]] diff --git a/crates/red_knot/Cargo.toml b/crates/red_knot/Cargo.toml index fc8fce040a1bb..a03298edf6285 100644 --- a/crates/red_knot/Cargo.toml +++ b/crates/red_knot/Cargo.toml @@ -19,6 +19,7 @@ ruff_db = { workspace = true, features = ["os", "cache"] } ruff_python_ast = { workspace = true } anyhow = { workspace = true } +argfile = { workspace = true } chrono = { workspace = true } clap = { workspace = true, features = ["wrap_help"] } colored = { workspace = true } @@ -31,6 +32,7 @@ tracing = { workspace = true, features = ["release_max_level_debug"] } tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] } tracing-flame = { workspace = true } tracing-tree = { workspace = true } +wild = { workspace = true } [dev-dependencies] ruff_db = { workspace = true, features = ["testing"] } diff --git a/crates/red_knot/src/main.rs b/crates/red_knot/src/main.rs index 29f36b60437c2..e00cbc1850da7 100644 --- a/crates/red_knot/src/main.rs +++ b/crates/red_knot/src/main.rs @@ -47,7 +47,10 @@ pub fn main() -> ExitStatus { } fn run() -> anyhow::Result { - let args = Args::parse_from(std::env::args()); + let args = wild::args_os(); + let args = argfile::expand_args_from(args, argfile::parse_fromfile, argfile::PREFIX) + .context("Failed to read CLI arguments from file")?; + let args = Args::parse_from(args); match args.command { Command::Server => run_server().map(|()| ExitStatus::Success),