1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 06:38:32 +00:00

using os.pathsep, and fix lint issue

This commit is contained in:
BurdenBear 2018-01-27 13:55:43 +08:00
parent 4de683094c
commit 0d2014caa7

View File

@ -109,22 +109,19 @@ def get_all_executables():
tf_alias = get_alias()
tf_entry_points = ['thefuck', 'fuck']
win32 = sys.platform.startswith('win')
paths = os.environ.get('PATH', '')
paths = paths.split(';') if win32 else paths.split(':')
bins = [exe.name.decode('utf8') if six.PY2 else exe.name
for path in paths
for path in os.environ.get('PATH', '').split(os.pathsep)
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]
win32 = sys.platform.startswith('win')
if win32:
bins += [exe[:-4] for exe in bins if exe.endswith(".exe")]
return bins + aliases