Files
thefuck/thefuck/rules/cargo_no_command.py
T
2015-07-24 00:39:56 +03:00

16 lines
434 B
Python

import re
from thefuck.utils import replace_argument
def match(command, settings):
return ('cargo' in command.script
and 'No such subcommand' in command.stderr
and 'Did you mean' in command.stderr)
def get_new_command(command, settings):
broken = command.script.split()[1]
fix = re.findall(r'Did you mean `([^`]*)`', command.stderr)[0]
return replace_argument(command.script, broken, fix)