1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-02-07 05:31:18 +00:00
thefuck/thefuck/rules/pip_unknown_command.py
2015-07-24 00:39:56 +03:00

17 lines
526 B
Python

import re
from thefuck.utils import replace_argument
def match(command, settings):
return ('pip' in command.script and
'unknown command' in command.stderr and
'maybe you meant' in command.stderr)
def get_new_command(command, settings):
broken_cmd = re.findall(r'ERROR: unknown command \"([a-z]+)\"',
command.stderr)[0]
new_cmd = re.findall(r'maybe you meant \"([a-z]+)\"', command.stderr)[0]
return replace_argument(command.script, broken_cmd, new_cmd)