1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-02-20 20:09:07 +00:00

#356 Ignore thefuck entry points

This commit is contained in:
nvbn 2015-09-06 13:37:48 +03:00
parent 4392872568
commit dd0667ea8f
2 changed files with 11 additions and 4 deletions

View File

@ -53,7 +53,7 @@ def get_aliases(mocker):
@pytest.mark.usefixtures('no_memoize', 'get_aliases')
def test_get_all_callables():
def test_get_all_executables():
all_callables = get_all_executables()
assert 'vim' in all_callables
assert 'fsck' in all_callables

View File

@ -10,6 +10,7 @@ import pickle
import re
from pathlib import Path
import pkg_resources
import six
@ -94,11 +95,17 @@ def get_all_executables():
return fallback
tf_alias = thefuck_alias()
return [exe.name
tf_entry_points = pkg_resources.require('thefuck')[0]\
.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)] + [
alias for alias in get_aliases() if alias != tf_alias]
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
def replace_argument(script, from_, to):