mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25:00 +00:00
Add entrypoints to tool list (#4661)
<!-- Thank you for contributing to uv! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> Closes #4654 ## Summary The purpose of this is to show the entrypoints of each tool when running `uv tool list` as below: ``` $ uv tool list black black blackd ``` I used the proposed formatting as it was written in #4653 by @blueraft. I had to use spaces instead of tabs in order to make the test successful. Indeed in the test we are using a raw string and I did not manage to make the test pass when escaping the tab in the list.rs file so I used spaces everywhere. I had a deeper look into #4653 as well but it is more difficult as we need to get the version of the tool in the Tool object, I will continue on this next one later. Please tell me if anything else is needed I tried to follow the contribution guidelines but I might have forgotten something. Have a great day! ## Test Plan `cargo clippy` then by using the local version of uv as described in the Readme.md. ``` my-computer :~/mypath/uv$ cargo run -- tool list Compiling uv-cli v0.0.1 (/mypath/uv/crates/uv-cli) Compiling uv v0.2.18 (/mypath/uv/crates/uv) Finished `dev` profile [unoptimized + debuginfo] target(s) in 18.69s Running `target/debug/uv tool list` warning: `uv tool list` is experimental and may change without warning. black black blackd isort isort isort-identify-imports ``` and `cargo test tool_list` --------- Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
parent
f43a8bbd6f
commit
174414c5da
2 changed files with 13 additions and 6 deletions
|
@ -25,9 +25,14 @@ pub(crate) async fn list(preview: PreviewMode, printer: Printer) -> Result<ExitS
|
|||
return Ok(ExitStatus::Success);
|
||||
}
|
||||
|
||||
// TODO(zanieb): Track and display additional metadata, like entry points
|
||||
for (name, _tool) in tools {
|
||||
for (name, tool) in tools {
|
||||
// Output tool name
|
||||
writeln!(printer.stdout(), "{name}")?;
|
||||
|
||||
// Output tool entrypoints
|
||||
for entrypoint in tool.entrypoints() {
|
||||
writeln!(printer.stdout(), " {}", &entrypoint.name)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(ExitStatus::Success)
|
||||
|
|
|
@ -8,7 +8,7 @@ mod common;
|
|||
|
||||
#[test]
|
||||
fn tool_list() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
|
@ -28,7 +28,9 @@ fn tool_list() {
|
|||
exit_code: 0
|
||||
----- stdout -----
|
||||
black
|
||||
|
||||
black
|
||||
blackd
|
||||
|
||||
----- stderr -----
|
||||
warning: `uv tool list` is experimental and may change without warning.
|
||||
"###);
|
||||
|
@ -36,7 +38,7 @@ fn tool_list() {
|
|||
|
||||
#[test]
|
||||
fn tool_list_empty() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
|
@ -55,7 +57,7 @@ fn tool_list_empty() {
|
|||
|
||||
#[test]
|
||||
fn tool_list_missing_receipt() {
|
||||
let context = TestContext::new("3.12");
|
||||
let context = TestContext::new("3.12").with_filtered_exe_suffix();
|
||||
let tool_dir = context.temp_dir.child("tools");
|
||||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue