From 9f2b3b55ef08d908220f0b401aeec375d1c5ea07 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Thu, 9 Feb 2017 17:50:57 +0100 Subject: [feat] simplify mail status in the CLI - Resolves: #8770 --- src/leap/bitmask/cli/mail.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/leap/bitmask/cli') diff --git a/src/leap/bitmask/cli/mail.py b/src/leap/bitmask/cli/mail.py index 73e21965..7fd574b9 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) -- cgit v1.2.3