diff --git a/thefuck/rules/rbenv_no_such_command.py b/thefuck/rules/rbenv_no_such_command.py new file mode 100644 index 00000000..bb2acfe2 --- /dev/null +++ b/thefuck/rules/rbenv_no_such_command.py @@ -0,0 +1,20 @@ +import re +from subprocess import PIPE, Popen +from thefuck.utils import for_app, replace_argument, replace_command +from thefuck.specific.devenv import env_available, COMMON_TYPOS, get_commands + +enabled_by_default = env_available + + +@for_app('rbenv') +def match(command): + return 'rbenv: no such command' in command.output + + +@for_app('rbenv') +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(command))) + return matched \ No newline at end of file