Skip to content
Snippets Groups Projects
Commit fd72bf6e authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

Adapt for new version of kamaki command().

parents bd505644 04b23e44
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
from kamaki.cli.commands import _command_init from kamaki.cli.commands import _command_init
from kamaki.cli import command from kamaki.cli import command
from kamaki.cli.command_tree import CommandTree
from kamaki.cli.errors import CLIError from kamaki.cli.errors import CLIError
class cli_generator(object): class cli_generator(object):
...@@ -10,15 +11,18 @@ class cli_generator(object): ...@@ -10,15 +11,18 @@ class cli_generator(object):
appname = None appname = None
plugin = None plugin = None
add_context = False add_context = False
ctree = None
description = None
def __init__(self): def __init__(self):
self.api_spec = self.plugin.api_spec self.api_spec = self.plugin.api_spec
self.appname = self.plugin.appname self.appname = self.plugin.appname
self.ctree = CommandTree(self.appname, self.description)
def generate_all(self): def generate_all(self):
for f in self.api_spec.call_names(): for f in self.api_spec.call_names():
c = self.mkClass(f) c = self.mkClass(f)
command()(c) command(self.ctree)(c)
def mkClass(self, method): def mkClass(self, method):
class C(_command_init): class C(_command_init):
......
...@@ -7,4 +7,5 @@ class quotaholder_cli(cli_generator): ...@@ -7,4 +7,5 @@ class quotaholder_cli(cli_generator):
def __init__(self): def __init__(self):
self.plugin = quotaholder_plugin self.plugin = quotaholder_plugin
self.add_context = True self.add_context = True
self.description = 'Quotaholder description'
super(self.__class__, self).__init__() super(self.__class__, self).__init__()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment