Unverified Commit ff7c106e authored by meskio's avatar meskio
Browse files

[feat] print list of keys nicely in the cli

parent eed534dc
......@@ -194,6 +194,19 @@ def do_print_result(stuff):
print Fore.RED + 'ERROR:' + '%s' % obj['error'] + Fore.RESET
def do_print_key_list(stuff):
obj = json.loads(stuff[0])
if obj['error']:
do_print_result(stuff)
return
keys = obj['result']
print Fore.GREEN
for key in keys:
print key["fingerprint"] + " " + key['address']
print Fore.RESET
def do_print_key(stuff):
obj = json.loads(stuff[0])
if obj['error']:
......@@ -334,6 +347,7 @@ def send_command(cli):
if subargs.list:
data += ['list']
cb = do_print_key_list
elif subargs.export:
data += ['export']
......
......@@ -349,9 +349,7 @@ class KeymanagerService(HookableService):
def do_list_keys(self, userid):
km = self._container.get_instance(userid)
d = km.get_all_keys()
d.addCallback(
lambda keys: [
(key.address, key.fingerprint) for key in keys])
d.addCallback(lambda keys: [dict(key) for key in keys])
return d
def do_export(self, userid, address):
......
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