core-cli: add position output for querying nodes

This commit is contained in:
Blake Harnden 2021-06-03 21:37:56 -07:00
parent 7fcedf527f
commit 425a2ee141

View file

@ -210,8 +210,13 @@ def query_session(core: CoreGrpcClient, args: Namespace) -> None:
def query_node(core: CoreGrpcClient, args: Namespace) -> None:
session = core.get_session(args.id)
node, ifaces, _ = core.get_node(args.id, args.node)
print("ID | Name | Type")
print(f"{node.id:<4} | {node.name:<7} | {node.type.name}")
print("ID | Name | Type | XY")
xy_pos = f"{int(node.position.x)},{int(node.position.y)}"
print(f"{node.id:<4} | {node.name[:7]:<7} | {node.type.name[:7]:<7} | {xy_pos}")
if node.geo:
print("Geo")
print(f"{node.geo.lon:.7f},{node.geo.lat:.7f},{node.geo.alt:f}")
if ifaces:
print("Interfaces")
print("Connected To | ", end="")
print_iface_header()