Skip to content

Commit

Permalink
Inline
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Oct 20, 2024
1 parent dc70521 commit 3b41ab0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions crates/uv/src/commands/pip/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ pub(crate) fn pip_list(
.collect_vec();

// We force output to stdout specifically for `pip list` command (#8379)
let mut forced_stdout = Stdout::Enabled;
match format {
ListFormat::Json => {
let rows = results.iter().copied().map(Entry::from).collect_vec();
let output = serde_json::to_string(&rows)?;
writeln!(forced_stdout, "{output}")?;
writeln!(Stdout::Enabled, "{output}")?;
}
ListFormat::Columns if results.is_empty() => {}
ListFormat::Columns => {
Expand Down Expand Up @@ -99,13 +98,18 @@ pub(crate) fn pip_list(
}

for elems in MultiZip(columns.iter().map(Column::fmt).collect_vec()) {
writeln!(forced_stdout, "{}", elems.join(" ").trim_end())?;
writeln!(Stdout::Enabled, "{}", elems.join(" ").trim_end())?;
}
}
ListFormat::Freeze if results.is_empty() => {}
ListFormat::Freeze => {
for dist in &results {
writeln!(forced_stdout, "{}=={}", dist.name().bold(), dist.version())?;
writeln!(
Stdout::Enabled,
"{}=={}",
dist.name().bold(),
dist.version()
)?;
}
}
}
Expand Down

0 comments on commit 3b41ab0

Please sign in to comment.