#74: #103: #221: Go back in history if alias is misspelled

This commit is contained in:
Vladimir Iakovlev
2017-09-01 10:11:42 +02:00
parent 96843fc6cd
commit 9ba36c9d2a
4 changed files with 30 additions and 9 deletions
+3 -2
View File
@@ -11,14 +11,15 @@ class Bash(Generic):
# It is VERY important to have the variables declared WITHIN the function
return '''
function {name} () {{
TF_PREVIOUS=$(fc -ln -1);
TF_PYTHONIOENCODING=$PYTHONIOENCODING;
export TF_ALIAS={name};
export TF_SHELL_ALIASES=$(alias);
export TF_HISTORY=$(fc -ln -10);
export PYTHONIOENCODING=utf-8;
TF_CMD=$(
thefuck $TF_PREVIOUS {argument_placeholder} $@
thefuck {argument_placeholder} $@
) && eval $TF_CMD;
unset TF_HISTORY;
export PYTHONIOENCODING=$TF_PYTHONIOENCODING;
{alter_history}
}}