summaryrefslogtreecommitdiff
path: root/archivist/utils.py
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2017-10-03 22:02:16 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2017-10-03 22:06:16 +0200
commit90a209e69f455b49c4a642fb2b3288f915fed1dc (patch)
tree704e46827a82d60faf413b1ef992c82619b3bfa6 /archivist/utils.py
parentd012b1b3160e651b32d7e822ca998a2860828081 (diff)
downloadarchivist-90a209e69f455b49c4a642fb2b3288f915fed1dc.tar.gz
archivist-90a209e69f455b49c4a642fb2b3288f915fed1dc.tar.bz2
archivist-90a209e69f455b49c4a642fb2b3288f915fed1dc.zip
Basic server implementation
Diffstat (limited to '')
-rw-r--r--archivist/utils.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/archivist/utils.py b/archivist/utils.py
new file mode 100644
index 0000000..391a8fb
--- /dev/null
+++ b/archivist/utils.py
@@ -0,0 +1,25 @@
+from click import MultiCommand
+
+class ProxyCommand(MultiCommand):
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.__proxy = None
+
+ def _get_proxy(self):
+ raise NotImplementedError("_get_proxy")
+
+ def __load(self):
+ if self.__proxy is None:
+ self.__proxy = self._get_proxy()
+
+ def list_commands(self,ctx):
+ self.__load()
+ return self.__proxy.list_commands(ctx)
+
+ def get_command(self,ctx,name):
+ self.__load()
+ return self.__proxy.get_command(ctx,name)
+
+ def make_context(self, *args, **kwargs):
+ self.__load()
+ return self.__proxy.make_context(*args, **kwargs)