mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-19 04:21:14 +00:00
#441: Remove all logic from shells methods wrappers
This commit is contained in:
parent
a2ec5aa3ff
commit
b5dc7aab6d
@ -43,10 +43,7 @@ def app_alias(alias):
|
||||
|
||||
|
||||
def put_to_history(command):
|
||||
try:
|
||||
return _get_shell().put_to_history(command)
|
||||
except IOError:
|
||||
logs.exception("Can't update history", sys.exc_info())
|
||||
return _get_shell().put_to_history(command)
|
||||
|
||||
|
||||
def and_(*commands):
|
||||
@ -54,7 +51,7 @@ def and_(*commands):
|
||||
|
||||
|
||||
def get_aliases():
|
||||
return list(_get_shell().get_aliases().keys())
|
||||
return _get_shell().get_aliases()
|
||||
|
||||
|
||||
def split_command(command):
|
||||
@ -65,9 +62,8 @@ def quote(s):
|
||||
return _get_shell().quote(s)
|
||||
|
||||
|
||||
@memoize
|
||||
def get_history():
|
||||
return list(_get_shell().get_history())
|
||||
return _get_shell().get_history()
|
||||
|
||||
|
||||
def how_to_configure():
|
||||
|
@ -2,7 +2,11 @@ import io
|
||||
import os
|
||||
import shlex
|
||||
import six
|
||||
import sys
|
||||
|
||||
from ..utils import memoize
|
||||
from ..conf import settings
|
||||
from .. import logs
|
||||
|
||||
|
||||
class Generic(object):
|
||||
@ -35,7 +39,13 @@ class Generic(object):
|
||||
def _get_history_line(self, command_script):
|
||||
return ''
|
||||
|
||||
def put_to_history(self, command_script):
|
||||
def put_to_history(self, command):
|
||||
try:
|
||||
return self._put_to_history(command)
|
||||
except IOError:
|
||||
logs.exception("Can't update history", sys.exc_info())
|
||||
|
||||
def _put_to_history(self, command_script):
|
||||
"""Puts command script to shell history."""
|
||||
history_file_name = self._get_history_file_name()
|
||||
if os.path.isfile(history_file_name):
|
||||
@ -46,7 +56,11 @@ class Generic(object):
|
||||
else:
|
||||
history.write(entry)
|
||||
|
||||
@memoize
|
||||
def get_history(self):
|
||||
return list(self._get_history_lines())
|
||||
|
||||
def _get_history_lines(self):
|
||||
"""Returns list of history entries."""
|
||||
history_file_name = self._get_history_file_name()
|
||||
if os.path.isfile(history_file_name):
|
||||
|
Loading…
x
Reference in New Issue
Block a user