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

Fix corrected command not being saved into history

This commit is contained in:
David Hart 2019-12-19 13:42:52 +00:00 committed by Pablo Santiago Blum de Aguiar
parent 2ced7a7f33
commit 929d732332
2 changed files with 3 additions and 5 deletions

View File

@ -88,10 +88,8 @@ class TestFish(object):
def test_app_alias_alter_history(self, settings, shell):
settings.alter_history = True
assert 'builtin history delete' in shell.app_alias('FUCK')
assert 'builtin history merge' in shell.app_alias('FUCK')
settings.alter_history = False
assert 'builtin history delete' not in shell.app_alias('FUCK')
assert 'builtin history merge' not in shell.app_alias('FUCK')
def test_get_history(self, history_lines, shell):
history_lines(['- cmd: ls', ' when: 1432613911',

View File

@ -51,8 +51,7 @@ class Fish(Generic):
def app_alias(self, alias_name):
if settings.alter_history:
alter_history = (' builtin history delete --exact'
' --case-sensitive -- $fucked_up_command\n'
' builtin history merge ^ /dev/null\n')
' --case-sensitive -- $fucked_up_command\n')
else:
alter_history = ''
# It is VERY important to have the variables declared WITHIN the alias
@ -61,7 +60,8 @@ 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'
' eval $unfucked_command\n{1}'
' commandline $unfucked_command\n'
' commandline -f execute\n{1}'
' end\n'
'end').format(alias_name, alter_history, ARGUMENT_PLACEHOLDER)