示例#1
0
def get_all_callables():
    tf_alias = thefuck_alias()
    return [exe.name
            for path in os.environ.get('PATH', '').split(':')
            for exe in _safe(lambda: list(Path(path).iterdir()), [])
            if not _safe(exe.is_dir, True)] + [
                alias for alias in get_aliases() if alias != tf_alias]
示例#2
0
def _get_all_callables():
    tf_alias = thefuck_alias()
    return [exe.name
            for path in os.environ.get('PATH', '').split(':')
            for exe in _safe(lambda: list(Path(path).iterdir()), [])
            if not _safe(exe.is_dir, True)] + [
                alias for alias in get_aliases() if alias != tf_alias]
示例#3
0
def _history_of_exists_without_current(command):
    history = get_history()
    tf_alias = thefuck_alias()
    executables = get_all_executables()
    return [line for line in _not_corrected(history, tf_alias)
            if not line.startswith(tf_alias) and not line == command.script
            and line.split(' ')[0] in executables]
示例#4
0
def _history_of_exists_without_current(command):
    history = get_history()
    tf_alias = thefuck_alias()
    executables = get_all_executables()
    return [
        line for line in _not_corrected(history, tf_alias)
        if not line.startswith(tf_alias) and not line == command.script
        and line.split(' ')[0] in executables
    ]
示例#5
0
def get_all_executables():
    from thefuck.shells import thefuck_alias, get_aliases

    def _safe(fn, fallback):
        try:
            return fn()
        except OSError:
            return fallback

    tf_alias = thefuck_alias()
    return [exe.name
            for path in os.environ.get('PATH', '').split(':')
            for exe in _safe(lambda: list(Path(path).iterdir()), [])
            if not _safe(exe.is_dir, True)] + [
                alias for alias in get_aliases() if alias != tf_alias]
示例#6
0
def get_all_executables():
    from thefuck.shells import thefuck_alias, get_aliases

    def _safe(fn, fallback):
        try:
            return fn()
        except OSError:
            return fallback

    tf_alias = thefuck_alias()
    tf_entry_points = get_installation_info().get_entry_map()\
                                             .get('console_scripts', {})\
                                             .keys()
    bins = [exe.name
            for path in os.environ.get('PATH', '').split(':')
            for exe in _safe(lambda: list(Path(path).iterdir()), [])
            if not _safe(exe.is_dir, True)
            and exe.name not in tf_entry_points]
    aliases = [alias for alias in get_aliases() if alias != tf_alias]
    return bins + aliases
示例#7
0
def get_all_executables():
    from thefuck.shells import thefuck_alias, get_aliases

    def _safe(fn, fallback):
        try:
            return fn()
        except OSError:
            return fallback

    tf_alias = thefuck_alias()
    tf_entry_points = get_installation_info().get_entry_map()\
                                             .get('console_scripts', {})\
                                             .keys()
    bins = [
        exe.name for path in os.environ.get('PATH', '').split(':')
        for exe in _safe(lambda: list(Path(path).iterdir()), [])
        if not _safe(exe.is_dir, True) and exe.name not in tf_entry_points
    ]
    aliases = [alias for alias in get_aliases() if alias != tf_alias]
    return bins + aliases
示例#8
0
def match(command):
    if 'not found' not in command.stderr:
        return False
    matched_layout = _get_matched_layout(command)
    return matched_layout and \
           _switch_command(command, matched_layout) != thefuck_alias()
示例#9
0
def match(command):
    if 'not found' not in command.stderr:
        return False
    matched_layout = _get_matched_layout(command)
    return matched_layout and \
           _switch_command(command, matched_layout) != thefuck_alias()