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

Test get_commands change

This commit is contained in:
gkodosis 2020-07-06 15:09:30 +03:00
parent 9d49d3957b
commit 269ff4e0e7
5 changed files with 6 additions and 14 deletions

View File

@ -19,5 +19,5 @@ def get_new_command(command):
broken = re.findall(r"goenv: no such command '([^']*)'", command.output)[0]
matched = [replace_argument(command.script, broken, common_typo)
for common_typo in COMMON_TYPOS.get(broken, [])]
matched.extend(replace_command(command, broken, get_commands()))
matched.extend(replace_command(command, broken, get_commands(command.script_parts[0])))
return matched

View File

@ -19,5 +19,5 @@ def get_new_command(command):
broken = re.findall(r"nodenv: no such command `([^']*)'", command.output)[0]
matched = [replace_argument(command.script, broken, common_typo)
for common_typo in COMMON_TYPOS.get(broken, [])]
matched.extend(replace_command(command, broken, get_commands()))
matched.extend(replace_command(command, broken, get_commands(command.script_parts[0])))
return matched

View File

@ -19,5 +19,5 @@ def get_new_command(command):
broken = re.findall(r"pyenv: no such command `([^']*)'", command.output)[0]
matched = [replace_argument(command.script, broken, common_typo)
for common_typo in COMMON_TYPOS.get(broken, [])]
matched.extend(replace_command(command, broken, get_commands()))
matched.extend(replace_command(command, broken, get_commands(command.script_parts[0])))
return matched

View File

@ -19,5 +19,5 @@ def get_new_command(command):
broken = re.findall(r"rbenv: no such command `([^']*)'", command.output)[0]
matched = [replace_argument(command.script, broken, common_typo)
for common_typo in COMMON_TYPOS.get(broken, [])]
matched.extend(replace_command(command, broken, get_commands()))
matched.extend(replace_command(command, broken, get_commands(command.script_parts[0])))
return matched

View File

@ -11,14 +11,6 @@ COMMON_TYPOS = {
}
def get_commands():
if which('pyenv'):
env = 'pyenv'
elif which('rbenv'):
env = 'rbenv'
elif which('goenv'):
env = 'goenv'
else:
env = 'nodenv'
proc = Popen([env, 'commands'], stdout=PIPE)
def get_commands(app):
proc = Popen([app, 'commands'], stdout=PIPE)
return [line.decode('utf-8').strip() for line in proc.stdout.readlines()]