Skip to content

Commit

Permalink
Sort also by name
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkuu committed Oct 14, 2017
1 parent 831f01e commit 09d138a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ fn actual_main() -> Result<(), i32> {
{
let mut out = TabWriter::new(stdout());
writeln!(out, "Package\tInstalled\tLatest\tNeeds update").unwrap();
for package in packages.iter().sorted_by(|lhs, rhs| (!lhs.needs_update()).cmp(&!rhs.needs_update())) {
for package in packages.iter()
.sorted_by(|lhs, rhs| (!lhs.needs_update(), &lhs.name).cmp(&(!rhs.needs_update(), &rhs.name)))
{
write!(out, "{}\t", package.name).unwrap();
if let Some(ref v) = package.version {
write!(out, "v{}", v).unwrap();
Expand Down Expand Up @@ -162,7 +164,9 @@ fn actual_main() -> Result<(), i32> {
{
let mut out = TabWriter::new(stdout());
writeln!(out, "Package\tInstalled\tLatest\tNeeds update").unwrap();
for package in packages.iter().sorted_by(|lhs, rhs| (!lhs.needs_update()).cmp(&!rhs.needs_update())) {
for package in packages.iter()
.sorted_by(|lhs, rhs| (!lhs.needs_update(), &lhs.name).cmp(&(!rhs.needs_update(), &rhs.name)))
{
writeln!(out,
"{}\t{}\t{}\t{}",
package.name,
Expand Down

0 comments on commit 09d138a

Please sign in to comment.