summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-02-09 17:50:57 +0100
committerRuben Pollan <meskio@sindominio.net>2017-02-13 12:41:20 +0100
commit9f2b3b55ef08d908220f0b401aeec375d1c5ea07 (patch)
treeb232898c744065ac4a25c6964349d17e4e571078 /src
parent374bb846b15596f99da77a4a7c9a348187774534 (diff)
[feat] simplify mail status in the CLI
- Resolves: #8770
Diffstat (limited to 'src')
-rw-r--r--src/leap/bitmask/cli/mail.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/leap/bitmask/cli/mail.py b/src/leap/bitmask/cli/mail.py
index 73e2196..7fd574b 100644
--- a/src/leap/bitmask/cli/mail.py
+++ b/src/leap/bitmask/cli/mail.py
@@ -56,10 +56,19 @@ SUBCOMMANDS:
return self._send(self._print_status)
def _print_status(self, status, depth=0):
- spaces = depth * " "
+ for name, v in [('mail', status)] + status['childrenStatus'].items():
+ line = Fore.RESET + name.ljust(10)
+ if v['status'] in ('on', 'starting'):
+ line += Fore.GREEN
+ elif v['status'] == 'failure':
+ line += Fore.RED
+ line += v['status']
+ if v['error']:
+ line += Fore.RED + " (" + v['error'] + ")"
+ line += Fore.RESET
+ print(line)
+
for k, v in status.items():
- if type(v) == dict:
- print(spaces + k + ":")
- self._print_status(v, depth + 1)
- else:
- print(spaces + k + ": " + Fore.GREEN + str(v) + Fore.RESET)
+ if k in ('status', 'childrenStatus', 'error'):
+ continue
+ print(Fore.RESET + k.ljust(10) + Fore.CYAN + str(v) + Fore.RESET)