Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 59 additions & 78 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ libscmp = "0.2.0"
alpm = { version = "2.2.3", default-features = false, features = [], optional = true }
anyhow = { version = "1.0.79", default-features = false, features = ["std", "backtrace"] }
chrono = { version = "0.4.31", default-features = false, features = ["std", "clock"] }
cli-table = "0.5.0"
colored = "2.0.2"
directories = "5.0.1"
env_logger = "0.10.1"
Expand All @@ -39,13 +40,13 @@ lazy_static = "1.4.0"
libc = { version = "0.2.151", default-features = false }
libflate = "2.0.0"
log = { version = "0.4.20", default-features = false }
prettytable-rs = "0.10.0"
raur = { version = "7.0.0", default-features = false, features = ["blocking", "rustls-tls"] }
regex = { version = "1.9.6", default-features = false, features = ["perf"] }
rm_rf = "0.6.2"
ruzstd = "0.4.0"
srcinfo = "1.1.0"
structopt = "0.3.26"
supports-hyperlinks = "2.1.0"
tar = { version = "0.4.40", default-features = false }
termize = "0.1.1"
uname = "0.1.1"
Expand Down
30 changes: 17 additions & 13 deletions src/action_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ use crate::aur_rpc_utils;
use crate::pacman;
use crate::rua_paths::RuaPaths;
use crate::terminal_util;
use crate::terminal_util::try_hyperlink_package_name;
use anyhow::Result;
use cli_table::format::Border;
use cli_table::format::Separator;
use cli_table::Table;
use colored::*;
use itertools::Itertools;
use lazy_static::lazy_static;
use log::debug;
use log::warn;
use prettytable::format::*;
use prettytable::*;
use regex::Regex;
use std::cmp::Ordering;
use std::collections::HashSet;
Expand Down Expand Up @@ -145,24 +147,26 @@ fn calculate_upgrade(
}

fn print_outdated(outdated: &[(String, String, String)], nonexistent: &[(String, String)]) {
let mut table = Table::new();
table.set_titles(row![
let mut table = vec![vec![
"Package".underline(),
"Current".underline(),
"Latest".underline()
]);
"Latest".underline(),
]];

for (pkg, local, remote) in outdated {
table.add_row(row![pkg.yellow(), local, remote.green(),]);
table.push(vec![pkg.yellow(), local.to_owned().into(), remote.green()]);
}
for (pkg, local) in nonexistent {
table.add_row(row![
pkg.yellow(),
local,
table.push(vec![
try_hyperlink_package_name(pkg.to_owned(), pkg).yellow(),
local.to_owned().into(),
"not found in neither pacman nor AUR, ignoring".dimmed(),
]);
}
let fmt: TableFormat = FormatBuilder::new().padding(0, 1).build();
table.set_format(fmt);
table.printstd();

let table = table
.table()
.border(Border::builder().build())
.separator(Separator::builder().build());
cli_table::print_stdout(table).unwrap();
}
Loading