diff --git a/knack/output.py b/knack/output.py index 4d9df57..961e060 100644 --- a/knack/output.py +++ b/knack/output.py @@ -165,7 +165,7 @@ def _auto_table_item(self, item): for k in keys: if k in _TableOutput.SKIP_KEYS: continue - if item[k] and not isinstance(item[k], (list, dict, set)): + if item[k] is not None and not isinstance(item[k], (list, dict, set)): new_entry[_TableOutput._capitalize_first_char(k)] = item[k] except AttributeError: # handles odd cases where a string/bool/etc. is returned diff --git a/tests/test_output.py b/tests/test_output.py index 7e13446..4897232 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -83,11 +83,12 @@ def test_out_table(self): obj = OrderedDict() obj['active'] = True obj['val'] = '0b1f6472' + obj['lun'] = 0 output_producer.out(CommandResultItem(obj), formatter=format_table, out_file=self.io) self.assertEqual(normalize_newlines(self.io.getvalue()), normalize_newlines( - """Active Val --------- -------- -True 0b1f6472 + """Active Lun Val +-------- ----- -------- +True 0 0b1f6472 """)) def test_out_table_list_of_lists(self):