1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-02-12 07:59:01 +00:00

Merge pull request #578 from scorphus/fish-builtin-history

#577: Use builtin `history` in Fish function
This commit is contained in:
Vladimir Iakovlev 2016-11-22 12:03:06 +01:00 committed by GitHub
commit e0b5d47fa5
2 changed files with 7 additions and 6 deletions

View File

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

View File

@ -20,8 +20,9 @@ class Fish(Generic):
def app_alias(self, fuck): def app_alias(self, fuck):
if settings.alter_history: if settings.alter_history:
alter_history = (' history --delete $fucked_up_command\n' alter_history = (' builtin history delete --exact'
' history --merge ^ /dev/null\n') ' --case-sensitive -- $fucked_up_command\n'
' builtin history merge ^ /dev/null\n')
else: else:
alter_history = '' alter_history = ''
# It is VERY important to have the variables declared WITHIN the alias # It is VERY important to have the variables declared WITHIN the alias