Merge branch 'master' of git://github.com/neomede/thefuck into neomede-master

This commit is contained in:
nvbn
2015-04-23 21:45:26 +02:00
2 changed files with 64 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import re
def match(command, settings):
return ('composer' in command.script
and (
'did you mean this?' in command.stderr.lower()
or 'did you mean one of these?' in command.stderr.lower()
)
)
def get_new_command(command, settings):
broken_cmd = re.findall(r"Command \"([^']*)\" is not defined", command.stderr)[0]
new_cmd = re.findall(r'Did you mean this\?[^\n]*\n\s*([^\n]*)', command.stderr)
if not new_cmd:
new_cmd = re.findall(r'Did you mean one of these\?[^\n]*\n\s*([^\n]*)', command.stderr)
return command.script.replace(broken_cmd, new_cmd[0].strip(), 1)