mirror of
https://github.com/nvbn/thefuck.git
synced 2025-11-16 06:46:03 +00:00
15 lines
384 B
Python
15 lines
384 B
Python
import re
|
|
|
|
|
|
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 command.script.replace(broken, fix, 1)
|