diff --git a/thefuck/rules/goenv_no_such_command.py b/thefuck/rules/goenv_no_such_command.py index 7e72cf74..0a02ff08 100644 --- a/thefuck/rules/goenv_no_such_command.py +++ b/thefuck/rules/goenv_no_such_command.py @@ -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 diff --git a/thefuck/rules/nodenv_no_such_command.py b/thefuck/rules/nodenv_no_such_command.py index e60ad57e..299736e7 100644 --- a/thefuck/rules/nodenv_no_such_command.py +++ b/thefuck/rules/nodenv_no_such_command.py @@ -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 diff --git a/thefuck/rules/pyenv_no_such_command.py b/thefuck/rules/pyenv_no_such_command.py index 96c53f25..440e267b 100644 --- a/thefuck/rules/pyenv_no_such_command.py +++ b/thefuck/rules/pyenv_no_such_command.py @@ -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 diff --git a/thefuck/rules/rbenv_no_such_command.py b/thefuck/rules/rbenv_no_such_command.py index ac82fdb4..55e449e3 100644 --- a/thefuck/rules/rbenv_no_such_command.py +++ b/thefuck/rules/rbenv_no_such_command.py @@ -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 diff --git a/thefuck/specific/devenv.py b/thefuck/specific/devenv.py index 94b2bd73..48cc1112 100644 --- a/thefuck/specific/devenv.py +++ b/thefuck/specific/devenv.py @@ -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()]