From 192e1d890ae614af759c61e98fe28c41a8298498 Mon Sep 17 00:00:00 2001 From: udf Date: Sat, 3 Nov 2018 04:53:32 +0200 Subject: [PATCH] hide empty objects --- stdplugins/info.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdplugins/info.py b/stdplugins/info.py index 17acd6f..02816b5 100644 --- a/stdplugins/info.py +++ b/stdplugins/info.py @@ -44,8 +44,11 @@ def yaml_format(obj, indent=0): for k, v in items: if k == '_' or v is None: continue + formatted = yaml_format(v, indent) + if not formatted.strip(): + continue result.append(' ' * (indent if has_multiple_items else 1)) - result.append(f'{k}: {yaml_format(v, indent)}') + result.append(f'{k}: {formatted}') result.append('\n') result.pop() indent -= 2