1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 06:38:32 +00:00

#1028: Move commandline instructions into shell

This commit is contained in:
Pablo Santiago Blum de Aguiar 2020-02-11 21:00:12 +01:00
parent 929d732332
commit 3cb2821884
3 changed files with 11 additions and 4 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)
@ -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)

View File

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

View File

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