Fix fuck when more than one git command available

This commit is contained in:
nvbn
2015-04-20 21:48:54 +02:00
parent f6f6e2223c
commit 2db0a215b4
3 changed files with 21 additions and 5 deletions
+2 -2
View File
@@ -4,13 +4,13 @@ import re
def match(command, settings):
return ('git' in command.script
and " is not a git command. See 'git --help'." in command.stderr
and 'Did you mean this?' in command.stderr)
and 'Did you mean' in command.stderr)
def get_new_command(command, settings):
broken_cmd = re.findall(r"git: '([^']*)' is not a git command",
command.stderr)[0]
new_cmd = re.findall(r'Did you mean this\?\n\s*([^\n]*)',
new_cmd = re.findall(r'Did you mean[^\n]*\n\s*([^\n]*)',
command.stderr)[0]
return command.script.replace(broken_cmd, new_cmd, 1)