mirror of https://github.com/nucypher/nucypher.git
Basic card list tabulation
parent
e99674a3fd
commit
138850bd05
|
@ -603,7 +603,7 @@ def contacts(general_config, list_contacts, create, card_id, delete, import_file
|
|||
card_id, ext = filename.split('.')
|
||||
card = Card.load(checksum=card_id)
|
||||
cards.append(card)
|
||||
paint_cards(emitter=emitter, cards=cards)
|
||||
paint_cards(emitter=emitter, cards=cards, as_table=True)
|
||||
return
|
||||
|
||||
elif create:
|
||||
|
|
|
@ -34,9 +34,8 @@ def paint_single_card(emitter, card: Card, qrcode: bool = False) -> None:
|
|||
|
||||
def paint_cards(emitter, cards: List[Card], as_table: bool = True) -> None:
|
||||
if as_table:
|
||||
headers = [field for field in Card._specification]
|
||||
rows = [card.to_dict() for card in cards]
|
||||
emitter.echo(tabulate(rows, headers=headers, showindex='always'))
|
||||
rows = [card.to_json(as_string=False) for card in cards]
|
||||
emitter.echo(tabulate(rows, headers='keys', showindex='always'))
|
||||
else:
|
||||
for card in cards:
|
||||
paint_single_card(emitter=emitter, card=card)
|
||||
|
|
Loading…
Reference in New Issue