From 40ab4eb62db57627bff10cf029d29c94704086a2 Mon Sep 17 00:00:00 2001 From: Pablo Aguiar Date: Wed, 24 Apr 2019 18:17:52 +0200 Subject: [PATCH] #899: Support `-y/--yeah` command line args in Fish Shell (#900) --- tests/shells/test_fish.py | 2 ++ thefuck/shells/fish.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/shells/test_fish.py b/tests/shells/test_fish.py index 5ae2c79e..172f6f49 100644 --- a/tests/shells/test_fish.py +++ b/tests/shells/test_fish.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import pytest +from thefuck.const import ARGUMENT_PLACEHOLDER from thefuck.shells import Fish @@ -82,6 +83,7 @@ class TestFish(object): assert 'TF_SHELL=fish' 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 ARGUMENT_PLACEHOLDER in shell.app_alias('fuck') def test_app_alias_alter_history(self, settings, shell): settings.alter_history = True diff --git a/thefuck/shells/fish.py b/thefuck/shells/fish.py index 01706e19..2a89db6f 100644 --- a/thefuck/shells/fish.py +++ b/thefuck/shells/fish.py @@ -5,6 +5,7 @@ import sys import six from .. import logs from ..conf import settings +from ..const import ARGUMENT_PLACEHOLDER from ..utils import DEVNULL, cache from .generic import Generic @@ -56,11 +57,11 @@ class Fish(Generic): return ('function {0} -d "Correct your previous console command"\n' ' set -l fucked_up_command $history[1]\n' ' 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' ' eval $unfucked_command\n{1}' ' end\n' - 'end').format(alias_name, alter_history) + 'end').format(alias_name, alter_history, ARGUMENT_PLACEHOLDER) def get_aliases(self): overridden = self._get_overridden_aliases()