chore: small cleanup

This commit is contained in:
William Luke 2022-05-02 08:45:32 +03:00
parent a3a3f55234
commit 6ac1dc88d2
3 changed files with 16 additions and 12 deletions

View File

@ -198,10 +198,10 @@ class CmdCtrl:
def notify(self, v):
if logg.root.level <= logging.INFO:
print(v)
print("\033[96m" + v + "\033[0m")
def ouch(self, v):
print(v)
print("\033[91m" + v + "\033[0m")
def write(self, v):
print(v)

View File

@ -109,26 +109,30 @@ def execute(ctrl):
encrypter=ctrl.encrypter,
)
ctrl.notify("resolving metadata for address {}".format(user_address_normal))
r = None
ctrl.write(
f"""
Phone: {ctrl.get("_IDENTIFIER")}
Network address: {add_0x(user_address)}
Chain: {ctrl.chain().common_name()}"""
)
ctrl.notify("resolving metadata for address {}".format(user_address_normal))
try:
r = user_address_store.by_address(
user_address_normal, update=ctrl.get("_FORCE")
)
except MetadataNotFoundError as e:
ctrl.ouch("could not resolve metadata for user: {}".format(e))
ctrl.write(
f"""Phone: {ctrl.get("_IDENTIFIER")}
Network address: {add_0x(user_address)}
Chain: {ctrl.chain().common_name()}
if r:
ctrl.write(
f"""
Name: { str(r)}
Registered: {datetime.datetime.fromtimestamp(r.date_registered).ctime()}
Gender: {r.gender}
Location: {r.location["area_name"]}
Products: {",".join(r.products)}
Tags: {",".join(r.tags)}"""
)
)
except MetadataNotFoundError as e:
ctrl.ouch(f"MetadataNotFoundError: Could not resolve metadata for user {e}\n")
tx_lines = []
seen_tokens = {}

View File

@ -1,6 +1,6 @@
[metadata]
name = clicada
version = 0.1.2
version = 0.1.3
description = CLI CRM tool for the cic-stack custodial wallet system
author = Louis Holbrook
author_email = dev@holbrook.no