openerp apps add Help
bzr revid: al@openerp.com-20121127010941-izoo14ms0ryf1f13
This commit is contained in:
parent
e36c474bde
commit
780ff72e6b
|
@ -10,8 +10,10 @@ commands = {}
|
|||
class CommandType(type):
|
||||
def __init__(cls, name, bases, attrs):
|
||||
super(CommandType, cls).__init__(name, bases, attrs)
|
||||
name = cls.__name__.lower()
|
||||
commands[name] = cls
|
||||
name = getattr(cls, name, cls.__name__.lower())
|
||||
cls.name = name
|
||||
if name != 'command':
|
||||
commands[name] = cls
|
||||
|
||||
class Command(object):
|
||||
"""Subclass this class to define new openerp subcommands """
|
||||
|
@ -20,6 +22,12 @@ class Command(object):
|
|||
def run(self, args):
|
||||
pass
|
||||
|
||||
class Help(Command):
|
||||
def run(self, args):
|
||||
print "Available commands:\n"
|
||||
for k, v in commands.items():
|
||||
print " %s" % k
|
||||
|
||||
import server
|
||||
|
||||
def main():
|
||||
|
|
Loading…
Reference in New Issue