Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use reinstall report formatting for uv python install --reinstall #8456

Closed
zanieb opened this issue Oct 22, 2024 · 0 comments · Fixed by #8487
Closed

Use reinstall report formatting for uv python install --reinstall #8456

zanieb opened this issue Oct 22, 2024 · 0 comments · Fixed by #8487
Labels
cli Related to the command line interface good first issue Good for newcomers help wanted Contribution especially encouraged

Comments

@zanieb
Copy link
Member

zanieb commented Oct 22, 2024

e.g. at

for event in uninstalled
.into_iter()
.map(|key| ChangeEvent {
key,
kind: ChangeEventKind::Removed,
})
.chain(installed.into_iter().map(|key| ChangeEvent {
key,
kind: ChangeEventKind::Added,
}))
.sorted_unstable_by(|a, b| a.key.cmp(&b.key).then_with(|| a.kind.cmp(&b.kind)))
{
match event.kind {
ChangeEventKind::Added => {
writeln!(printer.stderr(), " {} {}", "+".green(), event.key.bold())?;
}
ChangeEventKind::Removed => {
writeln!(printer.stderr(), " {} {}", "-".red(), event.key.bold())?;
}
}
}

we should be doing something more like we do at

fn on_complete(&self, changelog: &Changelog, printer: Printer) -> fmt::Result {
for event in changelog
.uninstalled
.iter()
.map(|distribution| ChangeEvent {
dist: distribution,
kind: ChangeEventKind::Removed,
})
.chain(changelog.installed.iter().map(|distribution| ChangeEvent {
dist: distribution,
kind: ChangeEventKind::Added,
}))
.chain(
changelog
.reinstalled
.iter()
.map(|distribution| ChangeEvent {
dist: distribution,
kind: ChangeEventKind::Reinstalled,
}),
)
.sorted_unstable_by(|a, b| {
a.dist
.name()
.cmp(b.dist.name())
.then_with(|| a.kind.cmp(&b.kind))
.then_with(|| a.dist.installed_version().cmp(&b.dist.installed_version()))
})
{
match event.kind {
ChangeEventKind::Added => {
writeln!(
printer.stderr(),
" {} {}{}",
"+".green(),
event.dist.name().bold(),
event.dist.installed_version().dimmed()
)?;
}
ChangeEventKind::Removed => {
writeln!(
printer.stderr(),
" {} {}{}",
"-".red(),
event.dist.name().bold(),
event.dist.installed_version().dimmed()
)?;
}
ChangeEventKind::Reinstalled => {
writeln!(
printer.stderr(),
" {} {}{}",
"~".yellow(),
event.dist.name().bold(),
event.dist.installed_version().dimmed()
)?;
}
}

@zanieb zanieb added help wanted Contribution especially encouraged cli Related to the command line interface labels Oct 22, 2024
@charliermarsh charliermarsh added the good first issue Good for newcomers label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command line interface good first issue Good for newcomers help wanted Contribution especially encouraged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants