Fix colors in `uv tool run` suggestion (#5267)

## Summary

More consistent with other commands.

Before:

![Screenshot 2024-07-21 at 2 22
18 PM](https://github.com/user-attachments/assets/9f6dfc7d-3c54-47a4-9b9f-bdf3794ae06d)

Now: all cyan, and green command, following the style guide.
This commit is contained in:
Charlie Marsh 2024-07-21 19:43:27 -04:00 committed by GitHub
parent 5c3d55afa8
commit a917cdba51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 15 deletions

View File

@ -228,8 +228,8 @@ fn warn_executable_not_provided_by_package(
match packages.as_slice() { match packages.as_slice() {
[] => { [] => {
warn_user!( warn_user!(
"A `{}` executable is not provided by package `{}`.", "An executable named `{}` is not provided by package `{}`.",
executable.green(), executable.cyan(),
from_package.red() from_package.red()
); );
} }
@ -240,11 +240,11 @@ fn warn_executable_not_provided_by_package(
executable executable
); );
warn_user!( warn_user!(
"A `{}` executable is not provided by package `{}` but is available via the dependency `{}`. Consider using `{}` instead.", "An executable named `{}` is not provided by package `{}` but is available via the dependency `{}`. Consider using `{}` instead.",
executable.green(), executable.cyan(),
from_package.red(), from_package.cyan(),
package.name().green(), package.name().cyan(),
suggested_command.cyan() suggested_command.green()
); );
} }
packages => { packages => {
@ -255,11 +255,11 @@ fn warn_executable_not_provided_by_package(
.map(|name| format!("- {}", name.cyan())) .map(|name| format!("- {}", name.cyan()))
.join("\n"); .join("\n");
warn_user!( warn_user!(
"A `{}` executable is not provided by package `{}` but is available via the following dependencies:\n- {}\nConsider using `{}` instead.", "An executable named `{}` is not provided by package `{}` but is available via the following dependencies:\n- {}\nConsider using `{}` instead.",
executable.green(), executable.cyan(),
from_package.red(), from_package.cyan(),
provided_by, provided_by,
suggested_command.cyan(), suggested_command.green(),
); );
} }
} }

View File

@ -162,7 +162,7 @@ fn tool_run_at_version() {
+ packaging==24.0 + packaging==24.0
+ pluggy==1.4.0 + pluggy==1.4.0
+ pytest==8.1.1 + pytest==8.1.1
warning: A `pytest@8.0.0` executable is not provided by package `pytest`. warning: An executable named `pytest@8.0.0` is not provided by package `pytest`.
"###); "###);
} }
@ -227,7 +227,7 @@ fn tool_run_suggest_valid_commands() {
+ packaging==24.0 + packaging==24.0
+ pathspec==0.12.1 + pathspec==0.12.1
+ platformdirs==4.2.0 + platformdirs==4.2.0
warning: A `orange` executable is not provided by package `black`. warning: An executable named `orange` is not provided by package `black`.
"###); "###);
uv_snapshot!(context.filters(), context.tool_run() uv_snapshot!(context.filters(), context.tool_run()
@ -247,7 +247,7 @@ fn tool_run_suggest_valid_commands() {
+ fastapi-cli==0.0.1 + fastapi-cli==0.0.1
+ importlib-metadata==1.7.0 + importlib-metadata==1.7.0
+ zipp==3.18.1 + zipp==3.18.1
warning: A `fastapi-cli` executable is not provided by package `fastapi-cli`. warning: An executable named `fastapi-cli` is not provided by package `fastapi-cli`.
"###); "###);
} }
@ -312,7 +312,7 @@ fn tool_run_warn_executable_not_in_from() {
+ uvicorn==0.29.0 + uvicorn==0.29.0
+ watchfiles==0.21.0 + watchfiles==0.21.0
+ websockets==12.0 + websockets==12.0
warning: A `fastapi` executable is not provided by package `fastapi` but is available via the dependency `fastapi-cli`. Consider using `uv tool run --from fastapi-cli fastapi` instead. warning: An executable named `fastapi` is not provided by package `fastapi` but is available via the dependency `fastapi-cli`. Consider using `uv tool run --from fastapi-cli fastapi` instead.
"###); "###);
} }