From 56bd5a4b750a52f753ad8fc0ca63ae15b57f8517 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Sat, 10 Aug 2019 23:00:45 +0200 Subject: Stop using guacamole for the ctl command --- pyapdctl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 pyapdctl (limited to 'pyapdctl') diff --git a/pyapdctl b/pyapdctl new file mode 100755 index 0000000..ead5085 --- /dev/null +++ b/pyapdctl @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +import argparse + +from pyapd import ctl_client, config + + +class Client(): + sub_commands = ( + ('ping', ctl_client.Ping()), + ('add_object', ctl_client.AddObject()), + ) + + def main(self): + self.parser = argparse.ArgumentParser() + self.subparsers = self.parser.add_subparsers() + for name, sub in self.sub_commands: + s_parser = self.subparsers.add_parser(name, help=sub.help) + sub.register_arguments(s_parser) + s_parser.set_defaults(func=sub.invoked) + self.args = self.parser.parse_args() + self.args.func(self.args) + +if __name__ == "__main__": + Client().main() -- cgit v1.2.3