1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 06:38:32 +00:00
This commit is contained in:
Pablo Santiago Blum de Aguiar 2020-02-11 14:47:06 +01:00
parent d0edea1baa
commit 91ec02c0a3
3 changed files with 13 additions and 6 deletions

View File

@ -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)

View File

@ -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

View File

@ -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