1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-19 00:58:56 +00:00
thefuck/thefuck/rules/yarn_alias.py
2017-08-31 17:58:56 +02:00

15 lines
368 B
Python

import re
from thefuck.utils import replace_argument, for_app
@for_app('yarn', at_least=1)
def match(command):
return 'Did you mean' in command.output
def get_new_command(command):
broken = command.script_parts[1]
fix = re.findall(r'Did you mean [`"](?:yarn )?([^`"]*)[`"]', command.output)[0]
return replace_argument(command.script, broken, fix)