⚠️ #442: Change history only on shell side

This commit is contained in:
nvbn
2016-02-22 18:31:28 +03:00
parent f20d4dbf85
commit 9b260eb239
8 changed files with 20 additions and 71 deletions
+10 -9
View File
@@ -1,16 +1,21 @@
from subprocess import Popen, PIPE
import os
from ..conf import settings
from ..utils import DEVNULL, memoize, cache
from .generic import Generic
class Bash(Generic):
def app_alias(self, fuck):
return "TF_ALIAS={0}" \
" alias {0}='PYTHONIOENCODING=utf-8" \
" TF_CMD=$(thefuck $(fc -ln -1)) && " \
" eval $TF_CMD &&" \
" history -s $TF_CMD'".format(fuck)
alias = "TF_ALIAS={0}" \
" alias {0}='PYTHONIOENCODING=utf-8" \
" TF_CMD=$(thefuck $(fc -ln -1)) && " \
" eval $TF_CMD".format(fuck)
if settings.alter_history:
return alias + " && history -s $TF_CMD'"
else:
return alias + "'"
def _parse_alias(self, alias):
name, value = alias.replace('alias ', '', 1).split('=', 1)
@@ -34,10 +39,6 @@ class Bash(Generic):
def _get_history_line(self, command_script):
return u'{}\n'.format(command_script)
def put_to_history(self, command_script):
# handled by the alias
pass
def how_to_configure(self):
if os.path.join(os.path.expanduser('~'), '.bashrc'):
config = '~/.bashrc'