🧹 chore: refactor pip_list function to trim end of joined elements (#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: https://github.com/astral-sh/uv/issues/2296


<!-- How was it tested? -->
This commit is contained in:
Zhan Rongrui 2024-03-08 16:53:29 +08:00 committed by GitHub
parent 8a807094e9
commit ef806dcb6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View File

@ -111,7 +111,7 @@ pub(crate) fn pip_list(
} }
for elems in MultiZip(columns.iter().map(Column::fmt).collect_vec()) { 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 => { ListFormat::Json => {

View File

@ -84,7 +84,7 @@ fn list_single_no_editable() -> Result<()> {
----- stdout ----- ----- stdout -----
Package Version Package Version
---------- ------- ---------- -------
markupsafe 2.1.3 markupsafe 2.1.3
----- stderr ----- ----- stderr -----
"### "###
@ -181,9 +181,9 @@ fn list_editable() -> Result<()> {
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- 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 poetry-editable 0.1.0 [WORKSPACE_DIR]/scripts/editable-installs/poetry_editable
----- stderr ----- ----- stderr -----
@ -275,7 +275,7 @@ fn list_editable_only() -> Result<()> {
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
Package Version Editable project location Package Version Editable project location
--------------- ------- --------------------------------------------------------- --------------- ------- ---------------------------------------------------------
poetry-editable 0.1.0 [WORKSPACE_DIR]/scripts/editable-installs/poetry_editable poetry-editable 0.1.0 [WORKSPACE_DIR]/scripts/editable-installs/poetry_editable
@ -296,7 +296,7 @@ fn list_editable_only() -> Result<()> {
----- stdout ----- ----- stdout -----
Package Version Package Version
------- ------- ------- -------
numpy 1.26.2 numpy 1.26.2
----- stderr ----- ----- stderr -----
"### "###
@ -405,7 +405,7 @@ fn list_exclude() -> Result<()> {
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
Package Version Editable project location Package Version Editable project location
--------------- ------- --------------------------------------------------------- --------------- ------- ---------------------------------------------------------
poetry-editable 0.1.0 [WORKSPACE_DIR]/scripts/editable-installs/poetry_editable poetry-editable 0.1.0 [WORKSPACE_DIR]/scripts/editable-installs/poetry_editable
@ -427,7 +427,7 @@ fn list_exclude() -> Result<()> {
----- stdout ----- ----- stdout -----
Package Version Package Version
------- ------- ------- -------
numpy 1.26.2 numpy 1.26.2
----- stderr ----- ----- stderr -----
"### "###