Skip to content

Commit 21b9254

Browse files
authored
Suggest --from command when executable is available for uvx (#8473)
## Summary Closes #8319 ## Test Plan `cargo test` <img width="545" alt="Screenshot 2024-10-22 at 20 17 35" src="https://github.com/user-attachments/assets/286e0168-7f25-4c85-86a3-23c8bb66a5ff">
1 parent 76bcb89 commit 21b9254

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

crates/uv/src/commands/tool/run.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,15 @@ pub(crate) async fn run(
207207
for (name, _) in entrypoints {
208208
writeln!(printer.stdout(), "- {}", name.cyan())?;
209209
}
210+
let suggested_command = format!(
211+
"{} --from {} <EXECUTABLE_NAME>",
212+
invocation_source, from.name
213+
);
214+
writeln!(
215+
printer.stdout(),
216+
"Consider using `{}` instead.",
217+
suggested_command.green()
218+
)?;
210219
}
211220
return Ok(ExitStatus::Failure);
212221
}

crates/uv/tests/it/tool_run.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ fn tool_run_at_version() {
141141
The following executables are provided by `pytest`:
142142
- py.test
143143
- pytest
144+
Consider using `uv tool run --from pytest <EXECUTABLE_NAME>` instead.
144145
145146
----- stderr -----
146147
Resolved 4 packages in [TIME]
@@ -202,6 +203,7 @@ fn tool_run_suggest_valid_commands() {
202203
The following executables are provided by `black`:
203204
- black
204205
- blackd
206+
Consider using `uv tool run --from black <EXECUTABLE_NAME>` instead.
205207
206208
----- stderr -----
207209
Resolved 6 packages in [TIME]

0 commit comments

Comments
 (0)