summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/cli
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-12-12 01:43:51 +0100
committerKali Kaneko (leap communications) <kali@leap.se>2016-12-29 03:09:54 +0100
commit9fe4ea478d22d7dfb2638eee8a8b2246f90af002 (patch)
tree9ba23eb577834c50448a6b853118e41d2277b5b3 /src/leap/bitmask/cli
parent6d76a4cb2a534e8da4832def7c03ea4b830a97e2 (diff)
[refactor] reorganize API
so that whitelisting doesn't have to peek into the data. added more documentation and some tests stubs too.
Diffstat (limited to 'src/leap/bitmask/cli')
-rwxr-xr-xsrc/leap/bitmask/cli/bitmask_cli.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/leap/bitmask/cli/bitmask_cli.py b/src/leap/bitmask/cli/bitmask_cli.py
index 893b7d1..dfd1fbc 100755
--- a/src/leap/bitmask/cli/bitmask_cli.py
+++ b/src/leap/bitmask/cli/bitmask_cli.py
@@ -60,7 +60,6 @@ GENERAL COMMANDS:
'''
epilog = ("Use 'bitmaskctl <command> help' to learn more "
"about each command.")
- commands = ['stop', 'stats']
def user(self, raw_args):
user = User()
@@ -99,7 +98,7 @@ GENERAL COMMANDS:
return defer.succeed(None)
def version(self, raw_args):
- self.data = ['version']
+ self.data = ['core', 'version']
return self._send(printer=self._print_version)
def _print_version(self, version):
@@ -107,7 +106,7 @@ GENERAL COMMANDS:
print(Fore.GREEN + 'bitmask_core: ' + Fore.RESET + corever)
def status(self, raw_args):
- self.data = ['status']
+ self.data = ['core', 'status']
return self._send(printer=self._print_status)
def _print_status(self, status):
@@ -119,11 +118,19 @@ GENERAL COMMANDS:
print(key.ljust(10) + ': ' + color +
value + Fore.RESET)
+ def stop(self, raw_args):
+ self.data = ['core', 'stop']
+ return self._send(printer=command.default_dict_printer)
+
+ def stats(self, raw_args):
+ self.data = ['core', 'stats']
+ return self._send(printer=command.default_dict_printer)
+
@defer.inlineCallbacks
def execute():
cli = BitmaskCLI()
- cli.data = ['version']
+ cli.data = ['core', 'version']
args = ['--verbose'] if '--verbose' in sys.argv else None
yield cli._send(
timeout=0.1, printer=_null_printer,
@@ -152,5 +159,6 @@ def main():
signal.signal(signal.SIGINT, signal_handler)
reactor.run()
+
if __name__ == "__main__":
main()