From 5223ece85a21f7449d110f1ac814ce479e2707c2 Mon Sep 17 00:00:00 2001 From: Kemal Akkoyun Date: Mon, 23 Sep 2024 16:14:52 +0200 Subject: [PATCH] Add context message before listing available tools when no arguments 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 #7348, by making the output more user-friendly and informative. Signed-off-by: Kemal Akkoyun --- crates/uv/src/commands/tool/list.rs | 1 + crates/uv/tests/tool_list.rs | 12 ++++++++++++ crates/uv/tests/tool_run.rs | 2 ++ 3 files changed, 15 insertions(+) diff --git a/crates/uv/src/commands/tool/list.rs b/crates/uv/src/commands/tool/list.rs index 8e5e0192836d..efe57f9e10dd 100644 --- a/crates/uv/src/commands/tool/list.rs +++ b/crates/uv/src/commands/tool/list.rs @@ -69,6 +69,7 @@ pub(crate) async fn list( String::new() }; + writeln!(printer.stdout(), "Installed tools:\n")?; if show_paths { writeln!( printer.stdout(), diff --git a/crates/uv/tests/tool_list.rs b/crates/uv/tests/tool_list.rs index 3f0c26d90e6e..645e30052ff9 100644 --- a/crates/uv/tests/tool_list.rs +++ b/crates/uv/tests/tool_list.rs @@ -30,6 +30,8 @@ fn tool_list() { success: true exit_code: 0 ----- stdout ----- + Installed tools: + black v24.2.0 - black - blackd @@ -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) @@ -155,6 +159,8 @@ fn tool_list_bad_environment() -> Result<()> { success: true exit_code: 0 ----- stdout ----- + Installed tools: + ruff v0.3.4 - ruff @@ -218,6 +224,8 @@ fn tool_list_deprecated() -> Result<()> { success: true exit_code: 0 ----- stdout ----- + Installed tools: + black v24.2.0 - black - blackd @@ -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 @@ -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) diff --git a/crates/uv/tests/tool_run.rs b/crates/uv/tests/tool_run.rs index d92e5e5beec2..2c98d45d21bf 100644 --- a/crates/uv/tests/tool_run.rs +++ b/crates/uv/tests/tool_run.rs @@ -774,6 +774,8 @@ fn tool_run_list_installed() { success: true exit_code: 0 ----- stdout ----- + Installed tools: + black v24.2.0 - black - blackd