Merge pull request #278 from mcarton/sed

Add a sed_unterminated_s rule
This commit is contained in:
Vladimir Iakovlev
2015-07-07 16:30:42 +03:00
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))