Skip to content

Commit

Permalink
Add context message before listing available tools when no arguments …
Browse files Browse the repository at this point in the history
…are provided

Adds a helpful context message when `uvx` is run without arguments
to clarify that it is displaying the installed tools.

This addresses confusion, such as the one highlighted in issue astral-sh#7348,
by making the output more user-friendly and informative.

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
  • Loading branch information
kakkoyun committed Sep 26, 2024
1 parent c8357b7 commit 5223ece
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/uv/src/commands/tool/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pub(crate) async fn list(
String::new()
};

writeln!(printer.stdout(), "Installed tools:\n")?;
if show_paths {
writeln!(
printer.stdout(),
Expand Down
12 changes: 12 additions & 0 deletions crates/uv/tests/tool_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ fn tool_list() {
success: true
exit_code: 0
----- stdout -----
Installed tools:
black v24.2.0
- black
- blackd
Expand Down Expand Up @@ -59,6 +61,8 @@ fn tool_list_paths() {
success: true
exit_code: 0
----- stdout -----
Installed tools:
black v24.2.0 ([TEMP_DIR]/tools/black)
- black ([TEMP_DIR]/bin/black)
- blackd ([TEMP_DIR]/bin/blackd)
Expand Down Expand Up @@ -155,6 +159,8 @@ fn tool_list_bad_environment() -> Result<()> {
success: true
exit_code: 0
----- stdout -----
Installed tools:
ruff v0.3.4
- ruff
Expand Down Expand Up @@ -218,6 +224,8 @@ fn tool_list_deprecated() -> Result<()> {
success: true
exit_code: 0
----- stdout -----
Installed tools:
black v24.2.0
- black
- blackd
Expand Down Expand Up @@ -274,6 +282,8 @@ fn tool_list_show_version_specifiers() {
success: true
exit_code: 0
----- stdout -----
Installed tools:
black v24.2.0 [required: <24.3.0]
- black
- blackd
Expand All @@ -288,6 +298,8 @@ fn tool_list_show_version_specifiers() {
success: true
exit_code: 0
----- stdout -----
Installed tools:
black v24.2.0 [required: <24.3.0] ([TEMP_DIR]/tools/black)
- black ([TEMP_DIR]/bin/black)
- blackd ([TEMP_DIR]/bin/blackd)
Expand Down
2 changes: 2 additions & 0 deletions crates/uv/tests/tool_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,8 @@ fn tool_run_list_installed() {
success: true
exit_code: 0
----- stdout -----
Installed tools:
black v24.2.0
- black
- blackd
Expand Down

0 comments on commit 5223ece

Please sign in to comment.