diff --git a/thefuck/shells/fish.py b/thefuck/shells/fish.py index 7f6a9c32..5b1f086c 100644 --- a/thefuck/shells/fish.py +++ b/thefuck/shells/fish.py @@ -60,8 +60,7 @@ class Fish(Generic): ' env TF_SHELL=fish TF_ALIAS={0} PYTHONIOENCODING=utf-8' ' thefuck $fucked_up_command {2} $argv | read -l unfucked_command\n' ' if [ "$unfucked_command" != "" ]\n' - ' commandline $unfucked_command\n' - ' commandline -f execute\n{1}' + ' eval $unfucked_command\n{1}' ' end\n' 'end').format(alias_name, alter_history, ARGUMENT_PLACEHOLDER) @@ -133,4 +132,8 @@ class Fish(Generic): def edit_command(self, command): """Return the shell editable command""" - return 'commandline -r "' + command + '"' + return ' commandline -r "' + command + '"' + + def commandline_wrap(self, command): + """Return the commandline replace and execute commands""" + return u'commandline "{}";commandline -f execute'.format(command) diff --git a/thefuck/shells/generic.py b/thefuck/shells/generic.py index 94569815..bdd6b766 100644 --- a/thefuck/shells/generic.py +++ b/thefuck/shells/generic.py @@ -160,3 +160,7 @@ class Generic(object): path=path, reload=reload, can_configure_automatically=Path(path).expanduser().exists()) + + def commandline_wrap(self, command): + """Generic implementation of commandline wrapper""" + return command diff --git a/thefuck/types.py b/thefuck/types.py index 92e64d1a..86f543cc 100644 --- a/thefuck/types.py +++ b/thefuck/types.py @@ -234,7 +234,7 @@ class CorrectedCommand(object): """ if self.should_edit: - self.script = shell.edit_command(self.script) + return shell.edit_command(self.script) if settings.repeat: repeat_fuck = '{} --repeat {}--force-command {}'.format( @@ -242,8 +242,8 @@ class CorrectedCommand(object): '--debug ' if settings.debug else '', shell.quote(self.script)) return shell.or_(self.script, repeat_fuck) - else: - return self.script + + return shell.commandline_wrap(self.script) def edit(self): self.should_edit = True