mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-18 12:06:04 +00:00
#783: Don't rely on $SHELL for detecting shell
This commit is contained in:
parent
4780027d63
commit
629056077f
@ -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]()
|
||||
|
@ -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);
|
||||
|
@ -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)";
|
||||
|
Loading…
x
Reference in New Issue
Block a user