equal
deleted
inserted
replaced
14 # details. |
14 # details. |
15 # |
15 # |
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """some utilities for cubicweb command line tools""" |
18 """some utilities for cubicweb command line tools""" |
19 from __future__ import print_function |
|
20 |
|
21 |
19 |
22 # XXX move most of this in logilab.common (shellutils ?) |
20 # XXX move most of this in logilab.common (shellutils ?) |
23 |
21 |
24 import io |
22 import io |
25 import os |
23 import os |
36 try: |
34 try: |
37 from os import symlink |
35 from os import symlink |
38 except ImportError: |
36 except ImportError: |
39 def symlink(*args): |
37 def symlink(*args): |
40 raise NotImplementedError |
38 raise NotImplementedError |
41 |
|
42 from six import add_metaclass |
|
43 |
39 |
44 from logilab.common.clcommands import Command as BaseCommand |
40 from logilab.common.clcommands import Command as BaseCommand |
45 from logilab.common.shellutils import ASK |
41 from logilab.common.shellutils import ASK |
46 |
42 |
47 from cubicweb import warning # pylint: disable=E0611 |
43 from cubicweb import warning # pylint: disable=E0611 |
237 if getattr(cls, 'cfgname', None) and getattr(cls, 'cmdname', None): |
233 if getattr(cls, 'cfgname', None) and getattr(cls, 'cmdname', None): |
238 _HDLRS.setdefault(cls.cmdname, []).append(cls) |
234 _HDLRS.setdefault(cls.cmdname, []).append(cls) |
239 return cls |
235 return cls |
240 |
236 |
241 |
237 |
242 @add_metaclass(metacmdhandler) |
238 class CommandHandler(object, metaclass=metacmdhandler): |
243 class CommandHandler(object): |
|
244 """configuration specific helper for cubicweb-ctl commands""" |
239 """configuration specific helper for cubicweb-ctl commands""" |
245 |
240 |
246 def __init__(self, config): |
241 def __init__(self, config): |
247 self.config = config |
242 self.config = config |
248 |
243 |