mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 01:28:56 +00:00
using os.pathsep, and fix lint issue
This commit is contained in:
parent
4de683094c
commit
0d2014caa7
@ -109,22 +109,19 @@ def get_all_executables():
|
|||||||
|
|
||||||
tf_alias = get_alias()
|
tf_alias = get_alias()
|
||||||
tf_entry_points = ['thefuck', 'fuck']
|
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
|
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()), [])
|
for exe in _safe(lambda: list(Path(path).iterdir()), [])
|
||||||
if not _safe(exe.is_dir, True)
|
if not _safe(exe.is_dir, True)
|
||||||
and exe.name not in tf_entry_points]
|
and exe.name not in tf_entry_points]
|
||||||
aliases = [alias.decode('utf8') if six.PY2 else alias
|
aliases = [alias.decode('utf8') if six.PY2 else alias
|
||||||
for alias in shell.get_aliases() if alias != tf_alias]
|
for alias in shell.get_aliases() if alias != tf_alias]
|
||||||
|
|
||||||
|
win32 = sys.platform.startswith('win')
|
||||||
if win32:
|
if win32:
|
||||||
bins += [exe[:-4] for exe in bins if exe.endswith(".exe")]
|
bins += [exe[:-4] for exe in bins if exe.endswith(".exe")]
|
||||||
|
|
||||||
return bins + aliases
|
return bins + aliases
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user