summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/cli/command.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-08-11 03:21:35 +0200
committerKali Kaneko <kali@leap.se>2017-08-11 14:21:58 -0400
commit4a7e29b6eae34f34016c9b409bd887c74b949ca4 (patch)
treea343c5de481f888c45c527401e13672ade0ab041 /src/leap/bitmask/cli/command.py
parentd64f3c22c132c5de0d759d1e76ff7ced054bfcaa (diff)
[feature] add vpn list command
Diffstat (limited to 'src/leap/bitmask/cli/command.py')
-rw-r--r--src/leap/bitmask/cli/command.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/leap/bitmask/cli/command.py b/src/leap/bitmask/cli/command.py
index cc3514b0..1daadc5e 100644
--- a/src/leap/bitmask/cli/command.py
+++ b/src/leap/bitmask/cli/command.py
@@ -39,10 +39,9 @@ def _print_result(result):
def default_dict_printer(result):
- if not result:
- return
- for key, value in result.items():
- if value is not str:
+
+ def pprint(value):
+ if not isinstance(value, str):
value = str(value)
if value in ('OFF', 'OFFLINE', 'ABORTED', 'False'):
color = Fore.RED
@@ -50,6 +49,21 @@ def default_dict_printer(result):
color = Fore.GREEN
print(Fore.RESET + key.ljust(10) + color + value + Fore.RESET)
+ if not result:
+ return
+
+ for key, value in result.items():
+ if isinstance(value, list):
+ if isinstance(value[0], list):
+ value = map(lambda l: ' '.join(l), value)
+ for item in value:
+ pprint('\t' + item)
+ else:
+ value = ' '.join(value)
+ pprint(value)
+ else:
+ pprint(value)
+
def print_status(status, depth=0):