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:
parent
9d49d3957b
commit
269ff4e0e7
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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()]
|
||||
|
Loading…
x
Reference in New Issue
Block a user