diff --git a/qutebrowser/commands.py b/qutebrowser/commands.py index 8dad2cf50..1aec5cad0 100644 --- a/qutebrowser/commands.py +++ b/qutebrowser/commands.py @@ -50,7 +50,13 @@ class Command(QObject): def run(self, argv=None): if not self.signal: raise NotImplementedError - self.signal.emit() + # some sane defaults + if self.nargs == 0: + self.signal.emit() + elif self.nargs == 1: + self.signal.emit(argv[0]) + else: + raise NotImplementedError class EmptyCmd(Command): nargs = 0 @@ -63,18 +69,12 @@ class OpenCmd(Command): key = 'o' signal = pyqtSignal(str) - def run(self, argv): - self.signal.emit(argv[0]) - class TabOpenCmd(Command): nargs = 1 name = 'tabopen' key = 'Shift+o' signal = pyqtSignal(str) - def run(self, argv): - self.signal.emit(argv[0]) - class TabCloseCmd(Command): nargs = 0 name = 'tabclose'