messed up list format
This commit is contained in:
@@ -4,7 +4,7 @@ import click
|
|||||||
from packetserver.client import Client
|
from packetserver.client import Client
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
def format_list_dicts(dicts: list[dict], output_format: str = "table"):
|
def format_list_dicts(dicts: list[dict], output_format: str = "table") -> str:
|
||||||
if output_format == "table":
|
if output_format == "table":
|
||||||
return tabulate(dicts, headers="keys")
|
return tabulate(dicts, headers="keys")
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ def format_list_dicts(dicts: list[dict], output_format: str = "table"):
|
|||||||
for key in i:
|
for key in i:
|
||||||
t.append([str(key), str(i[key])])
|
t.append([str(key), str(i[key])])
|
||||||
output = output + tabulate(t) + "-------------\n"
|
output = output + tabulate(t) + "-------------\n"
|
||||||
|
return output
|
||||||
else:
|
else:
|
||||||
raise ValueError("Unsupported format type.")
|
raise ValueError("Unsupported format type.")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user