Unverified Commit 1d77610f authored by Jakob Görgen's avatar Jakob Görgen
Browse files

cli/simbricks/cli/utils: function to print namespace table

parent d2314e04
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
import asyncio import asyncio
import functools import functools
from rich.table import Table
from rich.console import Console
def async_cli(): def async_cli():
""" """
...@@ -33,4 +35,15 @@ def async_cli(): ...@@ -33,4 +35,15 @@ def async_cli():
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
return asyncio.run(f(*args, **kwargs)) return asyncio.run(f(*args, **kwargs))
return wrapper return wrapper
return decorator_async_cli return decorator_async_cli
\ No newline at end of file
def print_namespace_table(namespaces) -> None:
table = Table()
table.add_column("Id")
table.add_column("name")
table.add_column("parent")
for ns in namespaces:
table.add_row(str(ns["id"]), str(ns["name"]), str(ns["parent_id"]))
console = Console()
console.print(table)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment