Skip to content

Commit

Permalink
Fix colors in uv tool run suggestion (#5267)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
charliermarsh authored Jul 21, 2024
1 parent 5c3d55a commit a917cdb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions crates/uv/src/commands/tool/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}
Expand All @@ -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 => {
Expand All @@ -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(),
);
}
}
Expand Down
8 changes: 4 additions & 4 deletions crates/uv/tests/tool_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ fn tool_run_at_version() {
+ packaging==24.0
+ pluggy==1.4.0
+ pytest==8.1.1
warning: A `[email protected]` executable is not provided by package `pytest`.
warning: An executable named `[email protected]` is not provided by package `pytest`.
"###);
}

Expand Down Expand Up @@ -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()
Expand All @@ -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`.
"###);
}

Expand Down Expand Up @@ -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.
"###);
}

Expand Down

0 comments on commit a917cdb

Please sign in to comment.