Skip to content

Commit

Permalink
Implement basic inventory display commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
synkd committed Feb 14, 2024
1 parent c90ee62 commit 9e21f16
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion manifester/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,16 @@ def get_manifest(manifest_category, allocation_name):
def inventory(details):
"""Display the local inventory file's contents."""
logger.info("Displaying local inventory data")
click.echo(helpers.load_inventory_file(Path(settings.inventory_path)))
inv = helpers.load_inventory_file(Path(settings.inventory_path))
if not details:
click.echo("-" * 38)
click.echo(f"| {'Index'} | {'Allocation Name':<26} |")
click.echo("-" * 38)
for num, allocation in enumerate(inv):
click.echo(f"| {num:<5} | {allocation['name']:<26} |")
click.echo("-" * 38)
else:
for num, allocation in enumerate(inv):
click.echo(f"{num}:")
for key, value in allocation.items():
click.echo(f"{'':<8}{key}: {value}")

0 comments on commit 9e21f16

Please sign in to comment.