diff --git a/proxmox/src/api/cli/text_table.rs b/proxmox/src/api/cli/text_table.rs index 51ed2c6b..60498961 100644 --- a/proxmox/src/api/cli/text_table.rs +++ b/proxmox/src/api/cli/text_table.rs @@ -597,7 +597,7 @@ fn format_object( let mut all_right_aligned = true; for name in properties_to_print.iter() { - let (_optional, prop_schema) = match schema.lookup(name) { + let (optional, prop_schema) = match schema.lookup(name) { Some(tup) => tup, None => bail!("property {} does not exist in schema.", name), }; @@ -615,6 +615,12 @@ fn format_object( if !right_align { all_right_aligned = false; } + if optional { + if let Some(object) = data.as_object() { + if object.get(name).is_none() { continue; } + } + } + let header_width = header.chars().count(); if header_width > max_name_width { max_name_width = header_width; }