Skip to content

Commit

Permalink
🧹 chore: refactor pip_list function to trim end of joined elements (#…
Browse files Browse the repository at this point in the history
…2298)

<!--
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?
-->

## Summary
refactor pip_list function to trim end of joined elements

fixed: #2296


<!-- How was it tested? -->
  • Loading branch information
zrr1999 authored Mar 8, 2024
1 parent 8a80709 commit ef806dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/uv/src/commands/pip_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub(crate) fn pip_list(
}

for elems in MultiZip(columns.iter().map(Column::fmt).collect_vec()) {
writeln!(printer.stdout(), "{}", elems.join(" "))?;
writeln!(printer.stdout(), "{}", elems.join(" ").trim_end())?;
}
}
ListFormat::Json => {
Expand Down
14 changes: 7 additions & 7 deletions crates/uv/tests/pip_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn list_single_no_editable() -> Result<()> {
----- stdout -----
Package Version
---------- -------
markupsafe 2.1.3
markupsafe 2.1.3
----- stderr -----
"###
Expand Down Expand Up @@ -181,9 +181,9 @@ fn list_editable() -> Result<()> {
success: true
exit_code: 0
----- stdout -----
Package Version Editable project location
Package Version Editable project location
--------------- ------- ---------------------------------------------------------
numpy 1.26.2
numpy 1.26.2
poetry-editable 0.1.0 [WORKSPACE_DIR]/scripts/editable-installs/poetry_editable
----- stderr -----
Expand Down Expand Up @@ -275,7 +275,7 @@ fn list_editable_only() -> Result<()> {
success: true
exit_code: 0
----- stdout -----
Package Version Editable project location
Package Version Editable project location
--------------- ------- ---------------------------------------------------------
poetry-editable 0.1.0 [WORKSPACE_DIR]/scripts/editable-installs/poetry_editable
Expand All @@ -296,7 +296,7 @@ fn list_editable_only() -> Result<()> {
----- stdout -----
Package Version
------- -------
numpy 1.26.2
numpy 1.26.2
----- stderr -----
"###
Expand Down Expand Up @@ -405,7 +405,7 @@ fn list_exclude() -> Result<()> {
success: true
exit_code: 0
----- stdout -----
Package Version Editable project location
Package Version Editable project location
--------------- ------- ---------------------------------------------------------
poetry-editable 0.1.0 [WORKSPACE_DIR]/scripts/editable-installs/poetry_editable
Expand All @@ -427,7 +427,7 @@ fn list_exclude() -> Result<()> {
----- stdout -----
Package Version
------- -------
numpy 1.26.2
numpy 1.26.2
----- stderr -----
"###
Expand Down

0 comments on commit ef806dc

Please sign in to comment.