aboutsummaryrefslogtreecommitdiff
path: root/pyapdctl
diff options
context:
space:
mode:
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()