mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-31 10:11:14 +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():
|
def _get_shell_from_env():
|
||||||
path = os.environ.get('SHELL', '')
|
name = os.environ.get('TF_SHELL')
|
||||||
base_name = os.path.basename(path)
|
|
||||||
name = os.path.splitext(base_name)[0]
|
|
||||||
|
|
||||||
if name in shells:
|
if name in shells:
|
||||||
return shells[name]()
|
return shells[name]()
|
||||||
|
@ -13,6 +13,7 @@ class Bash(Generic):
|
|||||||
return '''
|
return '''
|
||||||
function {name} () {{
|
function {name} () {{
|
||||||
TF_PYTHONIOENCODING=$PYTHONIOENCODING;
|
TF_PYTHONIOENCODING=$PYTHONIOENCODING;
|
||||||
|
export TF_SHELL=bash;
|
||||||
export TF_ALIAS={name};
|
export TF_ALIAS={name};
|
||||||
export TF_SHELL_ALIASES=$(alias);
|
export TF_SHELL_ALIASES=$(alias);
|
||||||
export TF_HISTORY=$(fc -ln -10);
|
export TF_HISTORY=$(fc -ln -10);
|
||||||
|
@ -14,6 +14,7 @@ class Zsh(Generic):
|
|||||||
return '''
|
return '''
|
||||||
{name} () {{
|
{name} () {{
|
||||||
TF_PYTHONIOENCODING=$PYTHONIOENCODING;
|
TF_PYTHONIOENCODING=$PYTHONIOENCODING;
|
||||||
|
export TF_SHELL=zsh;
|
||||||
export TF_ALIAS={name};
|
export TF_ALIAS={name};
|
||||||
export TF_SHELL_ALIASES=$(alias);
|
export TF_SHELL_ALIASES=$(alias);
|
||||||
export TF_HISTORY="$(fc -ln -10)";
|
export TF_HISTORY="$(fc -ln -10)";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user