From 022e41327ac947c9941eea0de96aa650ff62f221 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Sun, 8 Sep 2024 15:28:27 -0700 Subject: [PATCH] Improve error message for uv init already init-ed (#7198) Someone in https://discord.com/channels/1039017663004942429/1207998321562619954/1282411049106145400 found this confusing Could maybe improve further, e.g. what the user should do next might depend if there are [project] or [tool.uv] sections --------- Co-authored-by: Charlie Marsh --- crates/uv/src/commands/project/init.rs | 2 +- crates/uv/tests/init.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/uv/src/commands/project/init.rs b/crates/uv/src/commands/project/init.rs index 9e51959f5..c5d29ca68 100644 --- a/crates/uv/src/commands/project/init.rs +++ b/crates/uv/src/commands/project/init.rs @@ -50,7 +50,7 @@ pub(crate) async fn init( if path.join("pyproject.toml").exists() { let path = std::path::absolute(&path).unwrap_or_else(|_| path.simplified().to_path_buf()); anyhow::bail!( - "Project is already initialized in `{}`", + "Project is already initialized in `{}` (`pyproject.toml` file exists)", path.display().cyan() ); } diff --git a/crates/uv/tests/init.rs b/crates/uv/tests/init.rs index 0b60365c5..60ed9faa4 100644 --- a/crates/uv/tests/init.rs +++ b/crates/uv/tests/init.rs @@ -1025,7 +1025,7 @@ fn init_normalized_names() -> Result<()> { ----- stdout ----- ----- stderr ----- - error: Project is already initialized in `[TEMP_DIR]/foo-bar` + error: Project is already initialized in `[TEMP_DIR]/foo-bar` (`pyproject.toml` file exists) "###); let child = context.temp_dir.child("foo-bar");