mirror of
https://github.com/nvbn/thefuck.git
synced 2025-04-14 06:40:49 +01:00
#356 Ignore thefuck
entry points
This commit is contained in:
parent
4392872568
commit
dd0667ea8f
@ -53,7 +53,7 @@ def get_aliases(mocker):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures('no_memoize', 'get_aliases')
|
@pytest.mark.usefixtures('no_memoize', 'get_aliases')
|
||||||
def test_get_all_callables():
|
def test_get_all_executables():
|
||||||
all_callables = get_all_executables()
|
all_callables = get_all_executables()
|
||||||
assert 'vim' in all_callables
|
assert 'vim' in all_callables
|
||||||
assert 'fsck' in all_callables
|
assert 'fsck' in all_callables
|
||||||
|
@ -10,6 +10,7 @@ import pickle
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import pkg_resources
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
|
||||||
@ -94,11 +95,17 @@ def get_all_executables():
|
|||||||
return fallback
|
return fallback
|
||||||
|
|
||||||
tf_alias = thefuck_alias()
|
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 path in os.environ.get('PATH', '').split(':')
|
||||||
for exe in _safe(lambda: list(Path(path).iterdir()), [])
|
for exe in _safe(lambda: list(Path(path).iterdir()), [])
|
||||||
if not _safe(exe.is_dir, True)] + [
|
if not _safe(exe.is_dir, True)
|
||||||
alias for alias in get_aliases() if alias != tf_alias]
|
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):
|
def replace_argument(script, from_, to):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user