Add a support for pip unknown commands

This commit is contained in:
Namwoo Kim
2015-04-23 15:25:12 +09:00
parent 0272e8a801
commit af2bfe7c58
2 changed files with 39 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
import re
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 command.script.replace(broken_cmd, new_cmd, 1)