Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest --from command when executable is available for uvx #8473

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions crates/uv/src/commands/tool/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,15 @@ pub(crate) async fn run(
for (name, _) in entrypoints {
writeln!(printer.stdout(), "- {}", name.cyan())?;
}
let suggested_command = format!(
"{} --from {} <EXECUTABLE_NAME>",
invocation_source, from.name
);
writeln!(
printer.stdout(),
"Consider using `{}` instead.",
suggested_command.green()
)?;
}
return Ok(ExitStatus::Failure);
}
Expand Down
2 changes: 2 additions & 0 deletions crates/uv/tests/it/tool_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ fn tool_run_at_version() {
The following executables are provided by `pytest`:
- py.test
- pytest
Consider using `uv tool run --from pytest <EXECUTABLE_NAME>` instead.
----- stderr -----
Resolved 4 packages in [TIME]
Expand Down Expand Up @@ -202,6 +203,7 @@ fn tool_run_suggest_valid_commands() {
The following executables are provided by `black`:
- black
- blackd
Consider using `uv tool run --from black <EXECUTABLE_NAME>` instead.
----- stderr -----
Resolved 6 packages in [TIME]
Expand Down
Loading