update list style, format bytes

This commit is contained in:
yggverse 2025-07-09 04:28:13 +03:00
parent 48ca526a67
commit 47e6899ccd

View file

@ -93,17 +93,17 @@ impl Rss {
} }
pub fn item_description(size: Option<u64>, list: Option<&Vec<(String, u64)>>) -> Option<String> { pub fn item_description(size: Option<u64>, list: Option<&Vec<(String, u64)>>) -> Option<String> {
use crate::format::Format;
if size.is_none() && list.is_none() { if size.is_none() && list.is_none() {
return None; return None;
} }
let mut b = Vec::with_capacity(list.map(|l| l.len()).unwrap_or_default() + 1); let mut b = Vec::with_capacity(list.map(|l| l.len()).unwrap_or_default() + 1);
if let Some(s) = size { if let Some(s) = size {
use crate::format::Format;
b.push(s.bytes()) b.push(s.bytes())
} }
if let Some(l) = list { if let Some(l) = list {
for (path, size) in l { for (path, size) in l {
b.push(format!("* {path}: {size}")) b.push(format!("{path} ({})", size.bytes()))
} }
} }
Some(b.join("\n")) Some(b.join("\n"))