Remove explicit command name
This commit is contained in:
parent
61c90f293c
commit
04140d9777
@ -8,35 +8,29 @@ class Empty(Command):
|
||||
|
||||
class Open(Command):
|
||||
nargs = 1
|
||||
name = 'open'
|
||||
key = 'o'
|
||||
signal = pyqtSignal(str)
|
||||
|
||||
class TabOpen(Command):
|
||||
nargs = 1
|
||||
name = 'tabopen'
|
||||
key = 'Shift+o'
|
||||
signal = pyqtSignal(str)
|
||||
|
||||
class TabClose(Command):
|
||||
nargs = 0
|
||||
name = 'tabclose'
|
||||
key = 'd'
|
||||
signal = pyqtSignal()
|
||||
|
||||
class TabNext(Command):
|
||||
nargs = 0
|
||||
name = 'tabnext'
|
||||
key = 'Shift+j'
|
||||
signal = pyqtSignal()
|
||||
|
||||
class TabPrev(Command):
|
||||
nargs = 0
|
||||
name = 'tabprev'
|
||||
key = 'Shift+k'
|
||||
signal = pyqtSignal()
|
||||
|
||||
class Quit(Command):
|
||||
nargs = 0
|
||||
name = 'quit'
|
||||
signal = pyqtSignal()
|
||||
|
@ -10,7 +10,12 @@ def register_all():
|
||||
obj.__module__ == 'qutebrowser.commands.commands')
|
||||
|
||||
for (name, cls) in inspect.getmembers(commands, is_cmd):
|
||||
cls.bind()
|
||||
if cls.bind:
|
||||
if cls.name is None:
|
||||
name = cls.__name__.tolower()
|
||||
else:
|
||||
name = cls.name
|
||||
cmd_dict[name] = cls()
|
||||
|
||||
class CommandParser(QObject):
|
||||
error = pyqtSignal(str)
|
||||
@ -36,11 +41,7 @@ class Command(QObject):
|
||||
name = None
|
||||
key = None
|
||||
signal = None
|
||||
|
||||
@classmethod
|
||||
def bind(cls):
|
||||
if cls.name is not None:
|
||||
cmd_dict[cls.name] = cls()
|
||||
bind = True
|
||||
|
||||
def check(self, argv):
|
||||
if ((isinstance(self.nargs, int) and len(argv) != self.nargs) or
|
||||
|
Loading…
Reference in New Issue
Block a user