pxar: bin: ignore version and prelude entries in listing

Do not list the pxar format version and the prelude entries in the
output of pxar list, these are not regular entries. Do include them
however when dumping with the debug environmet variable set.
Since the prelude is arbitrary in size, only show the content size.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2024-05-27 14:07:36 +02:00 committed by Fabian Grünbichler
parent 58bfb6bb49
commit 1bec755b50
2 changed files with 14 additions and 1 deletions

View File

@ -20,6 +20,7 @@ pathpatterns.workspace = true
pxar.workspace = true
proxmox-async.workspace = true
proxmox-human-byte.workspace = true
proxmox-router = { workspace = true, features = ["cli", "server"] }
proxmox-schema = { workspace = true, features = [ "api-macro" ] }
proxmox-sys.workspace = true

View File

@ -18,6 +18,7 @@ use pbs_client::pxar::{
};
use pxar::EntryKind;
use proxmox_human_byte::HumanByte;
use proxmox_router::cli::*;
use proxmox_schema::api;
@ -490,6 +491,14 @@ fn dump_archive(archive: String, payload_input: Option<String>) -> Result<(), Er
if log::log_enabled!(log::Level::Debug) {
match entry.kind() {
EntryKind::Version(version) => {
log::debug!("pxar format version '{version:?}'");
continue;
}
EntryKind::Prelude(prelude) => {
log::debug!("prelude of size {}", HumanByte::from(prelude.data.len()));
continue;
}
EntryKind::File {
payload_offset: Some(offset),
size,
@ -508,7 +517,10 @@ fn dump_archive(archive: String, payload_input: Option<String>) -> Result<(), Er
log::debug!("{}", format_single_line_entry(&entry));
} else {
log::info!("{:?}", entry.path());
match entry.kind() {
EntryKind::Version(_) | EntryKind::Prelude(_) => continue,
_ => log::info!("{:?}", entry.path()),
}
}
}
Ok(())