More fixups

This commit is contained in:
Florian Bruhin 2014-01-17 11:55:16 +01:00
parent df48208524
commit 4e9527fb4c

View File

@ -12,11 +12,8 @@ def register_all():
for (name, cls) in inspect.getmembers(qutebrowser.commands.commands, for (name, cls) in inspect.getmembers(qutebrowser.commands.commands,
is_cmd): is_cmd):
if cls.bind: if cls.bind:
if cls.name is None: obj = cls()
name = cls.__name__.lower() cmd_dict[obj.name] = obj
else:
name = cls.name
cmd_dict[name] = cls()
class CommandParser(QObject): class CommandParser(QObject):
error = pyqtSignal(str) error = pyqtSignal(str)
@ -44,6 +41,11 @@ class Command(QObject):
signal = None signal = None
bind = True bind = True
def __init__(self):
super().__init__()
if self.name is None:
self.name = self.__class__.__name__.lower()
def check(self, argv): def check(self, argv):
if ((isinstance(self.nargs, int) and len(argv) != self.nargs) or if ((isinstance(self.nargs, int) and len(argv) != self.nargs) or
(self.nargs == '?' and len(argv) > 1) or (self.nargs == '?' and len(argv) > 1) or