count nodes instead of files

This commit is contained in:
Alexander Weiss 2022-02-22 20:34:29 +01:00
parent 68e99447d8
commit 9a95654b6f
2 changed files with 9 additions and 9 deletions

View File

@ -18,19 +18,19 @@ pub(super) fn execute(be: &impl DecryptReadBackend, _opts: Opts) -> Result<()> {
.map(|sn| {
let paths = sn.paths.into_iter().map(|p| p + "\n").collect::<String>();
let time = sn.time.format("%Y-%m-%d %H:%M:%S");
let nodes = sn
.node_count
.map(|c| c.to_string())
.unwrap_or("?".to_string());
let size = sn
.size
.map(|b| ByteSize(b).to_string_as(true))
.unwrap_or("?".to_string());
let files = sn
.file_count
.map(|c| c.to_string())
.unwrap_or("?".to_string());
row![sn.id, time, sn.hostname, "", paths, r->files, r->size]
row![sn.id, time, sn.hostname, "", paths, r->nodes, r->size]
})
.collect();
table.set_titles(
row![b->"ID", b->"Time", b->"Host", b->"Tags", b->"Paths", br->"Files", br->"Size"],
row![b->"ID", b->"Time", b->"Host", b->"Tags", b->"Paths", br->"Nodes", br->"Size"],
);
table.set_format(*format::consts::FORMAT_NO_BORDER_LINE_SEPARATOR);
table.printstd();

View File

@ -20,7 +20,7 @@ pub struct SnapshotFile {
pub gid: u32,
#[serde(default)]
pub tags: TagList,
pub file_count: Option<u64>,
pub node_count: Option<u64>,
pub size: Option<u64>,
#[serde(skip)]
@ -36,7 +36,7 @@ impl SnapshotFile {
uid: u32,
gid: u32,
tags: TagList,
file_count: Option<u64>,
node_count: Option<u64>,
size: Option<u64>,
) -> Self {
Self {
@ -48,7 +48,7 @@ impl SnapshotFile {
uid,
gid,
tags,
file_count,
node_count,
size,
id: Id::default(),
}