From a917cdba51be79329b6c0d7df37cce72b1e89d2b Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sun, 21 Jul 2024 19:43:27 -0400 Subject: [PATCH] Fix colors in `uv tool run` suggestion (#5267) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 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. --- crates/uv/src/commands/tool/run.rs | 22 +++++++++++----------- crates/uv/tests/tool_run.rs | 8 ++++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/crates/uv/src/commands/tool/run.rs b/crates/uv/src/commands/tool/run.rs index 8c95b84fa5ce..4e010cb3439c 100644 --- a/crates/uv/src/commands/tool/run.rs +++ b/crates/uv/src/commands/tool/run.rs @@ -228,8 +228,8 @@ fn warn_executable_not_provided_by_package( match packages.as_slice() { [] => { warn_user!( - "A `{}` executable is not provided by package `{}`.", - executable.green(), + "An executable named `{}` is not provided by package `{}`.", + executable.cyan(), from_package.red() ); } @@ -240,11 +240,11 @@ fn warn_executable_not_provided_by_package( executable ); warn_user!( - "A `{}` executable is not provided by package `{}` but is available via the dependency `{}`. Consider using `{}` instead.", - executable.green(), - from_package.red(), - package.name().green(), - suggested_command.cyan() + "An executable named `{}` is not provided by package `{}` but is available via the dependency `{}`. Consider using `{}` instead.", + executable.cyan(), + from_package.cyan(), + package.name().cyan(), + suggested_command.green() ); } packages => { @@ -255,11 +255,11 @@ fn warn_executable_not_provided_by_package( .map(|name| format!("- {}", name.cyan())) .join("\n"); warn_user!( - "A `{}` executable is not provided by package `{}` but is available via the following dependencies:\n- {}\nConsider using `{}` instead.", - executable.green(), - from_package.red(), + "An executable named `{}` is not provided by package `{}` but is available via the following dependencies:\n- {}\nConsider using `{}` instead.", + executable.cyan(), + from_package.cyan(), provided_by, - suggested_command.cyan(), + suggested_command.green(), ); } } diff --git a/crates/uv/tests/tool_run.rs b/crates/uv/tests/tool_run.rs index 20221e48c1bf..5cee5f8ae9c7 100644 --- a/crates/uv/tests/tool_run.rs +++ b/crates/uv/tests/tool_run.rs @@ -162,7 +162,7 @@ fn tool_run_at_version() { + packaging==24.0 + pluggy==1.4.0 + 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 + pathspec==0.12.1 + 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() @@ -247,7 +247,7 @@ fn tool_run_suggest_valid_commands() { + fastapi-cli==0.0.1 + importlib-metadata==1.7.0 + 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 + watchfiles==0.21.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. "###); }