mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-18 12:06:04 +00:00
#738: Set SHELL env var for fish and tcsh
This commit is contained in:
parent
f700b23f57
commit
bcb749722b
@ -71,6 +71,7 @@ class TestFish(object):
|
||||
assert 'function fuck' in shell.app_alias('fuck')
|
||||
assert 'function FUCK' in shell.app_alias('FUCK')
|
||||
assert 'thefuck' 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 'PYTHONIOENCODING=utf-8 thefuck' in shell.app_alias('fuck')
|
||||
|
||||
|
@ -44,6 +44,7 @@ class TestTcsh(object):
|
||||
'll': 'ls -alF'}
|
||||
|
||||
def test_app_alias(self, shell):
|
||||
assert 'setenv TF_SHELL tcsh' in shell.app_alias('fuck')
|
||||
assert 'alias fuck' in shell.app_alias('fuck')
|
||||
assert 'alias FUCK' in shell.app_alias('FUCK')
|
||||
assert 'thefuck' in shell.app_alias('fuck')
|
||||
|
@ -35,7 +35,7 @@ class Fish(Generic):
|
||||
# It is VERY important to have the variables declared WITHIN the alias
|
||||
return ('function {0} -d "Correct your previous console command"\n'
|
||||
' set -l fucked_up_command $history[1]\n'
|
||||
' env 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'
|
||||
' if [ "$unfucked_command" != "" ]\n'
|
||||
' eval $unfucked_command\n{1}'
|
||||
|
@ -7,7 +7,7 @@ from .generic import Generic
|
||||
|
||||
class Tcsh(Generic):
|
||||
def app_alias(self, alias_name):
|
||||
return ("alias {0} 'setenv TF_ALIAS {0} && "
|
||||
return ("alias {0} 'setenv TF_SHELL tcsh && setenv TF_ALIAS {0} && "
|
||||
"set fucked_cmd=`history -h 2 | head -n 1` && "
|
||||
"eval `thefuck ${{fucked_cmd}}`'").format(alias_name)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user