Let bash handle bash’s history

This commit is contained in:
mcarton
2016-02-22 14:39:30 +01:00
parent c8e9606c7d
commit 4af7dc2748
2 changed files with 11 additions and 13 deletions
+9 -3
View File
@@ -6,9 +6,11 @@ from .generic import Generic
class Bash(Generic):
def app_alias(self, fuck):
return "alias {0}='eval " \
"$(TF_ALIAS={0} PYTHONIOENCODING=utf-8 thefuck $(fc -ln -1));" \
" history -r'".format(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)
def _parse_alias(self, alias):
name, value = alias.replace('alias ', '', 1).split('=', 1)
@@ -32,6 +34,10 @@ 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'