Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Théo Giovanna
bitmask_client
Commits
ff7c106e
Unverified
Commit
ff7c106e
authored
Jun 28, 2016
by
meskio
⛺
Browse files
[feat] print list of keys nicely in the cli
parent
eed534dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/leap/bitmask/cli/bitmask_cli.py
View file @
ff7c106e
...
...
@@ -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'
]
...
...
src/leap/bitmask/core/mail_services.py
View file @
ff7c106e
...
...
@@ -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
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment