diff --git a/thefuck/shells/fish.py b/thefuck/shells/fish.py index 7f354b8e..e30fd5b4 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) @@ -127,3 +126,7 @@ class Fish(Generic): history.write(entry.encode('utf-8')) else: history.write(entry) + + 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 aa81e2ac..e208efb4 100644 --- a/thefuck/shells/generic.py +++ b/thefuck/shells/generic.py @@ -152,3 +152,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 8c5770f4..bf068e68 100644 --- a/thefuck/types.py +++ b/thefuck/types.py @@ -238,8 +238,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 run(self, old_cmd): """Runs command from rule for passed command.