diff options
author | hut <hut@lavabit.com> | 2010-03-21 03:35:00 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-03-21 03:35:00 +0100 |
commit | 6c867217763b0527776bad87493d4b950287caf0 (patch) | |
tree | 314f286c884f904a52ce2fd6414d9733c35713e7 | |
parent | d15755718a8615accfa995186c53515739e38c00 (diff) | |
download | ranger-6c867217763b0527776bad87493d4b950287caf0.tar.gz |
gui.widgets.console: removed warning after typing >cd
-rw-r--r-- | ranger/gui/widgets/console.py | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index f9e4924c..feb54a3d 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -293,26 +293,17 @@ class CommandConsole(ConsoleWithTab): self.close() def _get_cmd(self): - command_class = self._get_cmd_class() - if command_class: - return command_class(self.line, self.mode) - else: - return None - - def _get_cmd_class(self): try: - command_name = self.line.split()[0] - except IndexError: - return None - - try: - return commands.get_command(command_name) + command_class = self._get_cmd_class() except KeyError: self.fm.notify("Invalid command! Press ? for help.", bad=True) + except: return None - except ValueError as e: - self.fm.notify(e) - return None + else: + return command_class(self.line, self.mode) + + def _get_cmd_class(self): + return commands.get_command(self.line.split()[0]) def _get_tab(self): if ' ' in self.line: @@ -340,9 +331,14 @@ class QuickCommandConsole(CommandConsole): """ prompt = '>' def on_line_change(self): - cmd = self._get_cmd() - if cmd and cmd.quick_open(): - self.execute(cmd) + try: + cls = self._get_cmd_class() + except (KeyError, ValueError, IndexError): + pass + else: + cmd = cls(self.line, self.mode) + if cmd and cmd.quick_open(): + self.execute(cmd) class SearchConsole(Console): |