From 09bf881b4f457f731c5a49e88822bc731eda2c96 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Fri, 17 Mar 2017 00:34:12 +0100 Subject: [feat] report the real status of the VPN --- src/leap/bitmask/cli/command.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/leap/bitmask/cli/command.py') diff --git a/src/leap/bitmask/cli/command.py b/src/leap/bitmask/cli/command.py index 068f19b5..4bee325d 100644 --- a/src/leap/bitmask/cli/command.py +++ b/src/leap/bitmask/cli/command.py @@ -51,6 +51,29 @@ def default_dict_printer(result): print(Fore.RESET + key.ljust(10) + color + value + Fore.RESET) +def print_status(status, depth=0): + for name, v in [(' status', status)] + status['childrenStatus'].items(): + line = Fore.RESET + name.ljust(12) + 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 k in ('status', 'childrenStatus', 'error'): + continue + if k == 'up': + k = '↑↑↑ ' + elif k == 'down': + k = '↓↓↓ ' + print(Fore.RESET + k.ljust(12) + Fore.CYAN + str(v) + Fore.RESET) + + class Command(object): """A generic command dispatcher. Any command in the class attribute `commands` will be dispached and -- cgit v1.2.3