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/vpn.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/leap/bitmask/cli/vpn.py b/src/leap/bitmask/cli/vpn.py
index 44556ac2..5a9cce9e 100644
--- a/src/leap/bitmask/cli/vpn.py
+++ b/src/leap/bitmask/cli/vpn.py
@@ -20,6 +20,8 @@ Bitmask Command Line interface: vpn module
import argparse
import sys
+from colorama import Fore
+
from leap.bitmask.cli import command
@@ -97,7 +99,7 @@ SUBCOMMANDS:
def list(self, raw_args):
self.data += ['list']
- return self._send(command.default_dict_printer)
+ return self._send(location_printer)
def get_cert(self, raw_args):
parser = argparse.ArgumentParser(
@@ -115,3 +117,18 @@ SUBCOMMANDS:
self.data += ['get_cert', uid]
return self._send(command.default_dict_printer)
+
+
+def location_printer(result):
+ def pprint(key, value):
+ print(Fore.RESET + key.ljust(20) + Fore.GREEN +
+ value + Fore.RESET)
+
+ for provider, locations in result.items():
+ for loc in locations.values():
+ location_str = ("[%(country_code)s] %(name)s "
+ "(UTC%(timezone)s %(hemisphere)s)" % loc)
+ pprint(provider, location_str)
+
+ if not locations.values():
+ pprint(provider, "---")