aboutsummaryrefslogtreecommitdiff
path: root/pyapdctl
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2019-08-10 23:00:45 +0200
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2019-08-10 23:00:45 +0200
commit56bd5a4b750a52f753ad8fc0ca63ae15b57f8517 (patch)
treeada1c51f907ef48603cf7013c2bb054365c734ea /pyapdctl
parent7c56ff408032dba4c88e57584a483657c1ef7278 (diff)
Stop using guacamole for the ctl commandHEADmaster
Diffstat (limited to 'pyapdctl')
-rwxr-xr-xpyapdctl25
1 files changed, 25 insertions, 0 deletions
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()