summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/cli
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask/cli')
-rw-r--r--src/leap/bitmask/cli/command.py22
-rw-r--r--src/leap/bitmask/cli/vpn.py5
2 files changed, 23 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):
diff --git a/src/leap/bitmask/cli/vpn.py b/src/leap/bitmask/cli/vpn.py
index 219cac17..44556ac2 100644
--- a/src/leap/bitmask/cli/vpn.py
+++ b/src/leap/bitmask/cli/vpn.py
@@ -37,6 +37,7 @@ SUBCOMMANDS:
stop Stop VPN
status Display status about the VPN
check Check whether VPN service is properly configured
+ list List the configured gateways
get_cert Get VPN Certificate from provider
install Install helpers (needs root)
uninstall Uninstall helpers (needs root)
@@ -94,6 +95,10 @@ SUBCOMMANDS:
return self._send(command.default_dict_printer)
+ def list(self, raw_args):
+ self.data += ['list']
+ return self._send(command.default_dict_printer)
+
def get_cert(self, raw_args):
parser = argparse.ArgumentParser(
description='Bitmask VPN cert fetcher',