Exemplo n.º 1
0
def get_all_executables():
    from thefuck.shells import shell

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

    tf_alias = get_alias()
    tf_entry_points = get_installation_info().get_entry_map()\
                                             .get('console_scripts', {})\
                                             .keys()

    bins = [
        exe.name.decode('utf8') if six.PY2 else 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.decode('utf8') if six.PY2 else alias
        for alias in shell.get_aliases() if alias != tf_alias
    ]

    return bins + aliases
Exemplo n.º 2
0
def get_all_executables():
    from thefuck.shells import shell

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

    tf_alias = get_alias()
    tf_entry_points = ['thefuck', 'f**k']

    bins = [
        exe.name.decode('utf8') if six.PY2 else exe.name
        for path in os.environ.get('PATH', '').split(os.pathsep)
        if include_path_in_search(path)
        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.decode('utf8') if six.PY2 else alias
        for alias in shell.get_aliases() if alias != tf_alias
    ]

    return bins + aliases
Exemplo n.º 3
0
def get_all_executables():
    from thefuck.shells import shell

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

    tf_alias = get_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 shell.get_aliases() if alias != tf_alias]
    return bins + aliases
Exemplo n.º 4
0
def get_all_executables():
    from thefuck.shells import shell

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

    tf_alias = get_alias()
    tf_entry_points = ['thefuck', 'f**k']

    bins = [exe.name.decode('utf8') if six.PY2 else 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.decode('utf8') if six.PY2 else alias
               for alias in shell.get_aliases() if alias != tf_alias]

    return bins + aliases