1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-05 18:31:10 +01:00

#783: Don't rely on $SHELL for detecting shell

This commit is contained in:
Vladimir Iakovlev 2017-11-27 21:08:46 +01:00
parent 4780027d63
commit 629056077f
3 changed files with 3 additions and 3 deletions

View File

@ -20,9 +20,7 @@ shells = {'bash': Bash,
def _get_shell_from_env():
path = os.environ.get('SHELL', '')
base_name = os.path.basename(path)
name = os.path.splitext(base_name)[0]
name = os.environ.get('TF_SHELL')
if name in shells:
return shells[name]()

View File

@ -13,6 +13,7 @@ class Bash(Generic):
return '''
function {name} () {{
TF_PYTHONIOENCODING=$PYTHONIOENCODING;
export TF_SHELL=bash;
export TF_ALIAS={name};
export TF_SHELL_ALIASES=$(alias);
export TF_HISTORY=$(fc -ln -10);

View File

@ -14,6 +14,7 @@ class Zsh(Generic):
return '''
{name} () {{
TF_PYTHONIOENCODING=$PYTHONIOENCODING;
export TF_SHELL=zsh;
export TF_ALIAS={name};
export TF_SHELL_ALIASES=$(alias);
export TF_HISTORY="$(fc -ln -10)";