Skip to content

Commit

Permalink
nvbn#899: Support -y/--yeah command line args in Fish Shell (nvbn#900)
Browse files Browse the repository at this point in the history
  • Loading branch information
scorphus authored and nvbn committed Apr 24, 2019
1 parent 252d2c5 commit 5002900
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions tests/shells/test_fish.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

import pytest
from thefuck.const import ARGUMENT_PLACEHOLDER
from thefuck.shells import Fish


Expand Down Expand Up @@ -82,6 +83,7 @@ def test_app_alias(self, shell):
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
Expand Down
5 changes: 3 additions & 2 deletions thefuck/shells/fish.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import six
from .. import logs
from ..conf import settings
from ..const import ARGUMENT_PLACEHOLDER
from ..utils import DEVNULL, cache
from .generic import Generic

Expand Down Expand Up @@ -56,11 +57,11 @@ def app_alias(self, alias_name):
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()
Expand Down

0 comments on commit 5002900

Please sign in to comment.