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 <crmarsh416@gmail.com>
This commit is contained in:
Shantanu 2024-09-08 15:28:27 -07:00 committed by GitHub
parent bf33a7cf13
commit 022e41327a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -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()
);
}

View File

@ -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");