Add a sed_unterminated_s rule

This commit is contained in:
mcarton
2015-07-04 16:45:30 +02:00
parent cb33c912e5
commit f3cdfbdbdb
4 changed files with 53 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
import shlex
from thefuck.utils import quote
def match(command, settings):
return ('sed' in command.script
and "unterminated `s' command" in command.stderr)
def get_new_command(command, settings):
script = shlex.split(command.script)
for (i, e) in enumerate(script):
if e.startswith(('s/', '-es/')) and e[-1] != '/':
script[i] += '/'
return ' '.join(map(quote, script))