1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-11-16 06:46:03 +00:00
Files
thefuck/thefuck/rules/cargo_no_command.py
2015-06-06 17:22:14 +02:00

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)