1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-18 20:11:17 +00:00

#899: Support -y/--yeah command line args in Fish Shell (#900)

This commit is contained in:
Pablo Aguiar 2019-04-24 18:17:52 +02:00 committed by Vladimir Iakovlev
parent 55cb3546df
commit 40ab4eb62d
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import pytest import pytest
from thefuck.const import ARGUMENT_PLACEHOLDER
from thefuck.shells import Fish from thefuck.shells import Fish
@ -82,6 +83,7 @@ class TestFish(object):
assert 'TF_SHELL=fish' in shell.app_alias('fuck') assert 'TF_SHELL=fish' in shell.app_alias('fuck')
assert 'TF_ALIAS=fuck PYTHONIOENCODING' in shell.app_alias('fuck') assert 'TF_ALIAS=fuck PYTHONIOENCODING' in shell.app_alias('fuck')
assert 'PYTHONIOENCODING=utf-8 thefuck' in shell.app_alias('fuck') assert 'PYTHONIOENCODING=utf-8 thefuck' in shell.app_alias('fuck')
assert ARGUMENT_PLACEHOLDER in shell.app_alias('fuck')
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

View File

@ -5,6 +5,7 @@ import sys
import six import six
from .. import logs from .. import logs
from ..conf import settings from ..conf import settings
from ..const import ARGUMENT_PLACEHOLDER
from ..utils import DEVNULL, cache from ..utils import DEVNULL, cache
from .generic import Generic from .generic import Generic
@ -56,11 +57,11 @@ class Fish(Generic):
return ('function {0} -d "Correct your previous console command"\n' return ('function {0} -d "Correct your previous console command"\n'
' set -l fucked_up_command $history[1]\n' ' set -l fucked_up_command $history[1]\n'
' env TF_SHELL=fish TF_ALIAS={0} PYTHONIOENCODING=utf-8' ' env TF_SHELL=fish TF_ALIAS={0} PYTHONIOENCODING=utf-8'
' thefuck $fucked_up_command | read -l unfucked_command\n' ' thefuck $fucked_up_command {2} $argv | read -l unfucked_command\n'
' if [ "$unfucked_command" != "" ]\n' ' if [ "$unfucked_command" != "" ]\n'
' eval $unfucked_command\n{1}' ' eval $unfucked_command\n{1}'
' end\n' ' end\n'
'end').format(alias_name, alter_history) 'end').format(alias_name, alter_history, ARGUMENT_PLACEHOLDER)
def get_aliases(self): def get_aliases(self):
overridden = self._get_overridden_aliases() overridden = self._get_overridden_aliases()