1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-23 11:09:01 +00:00
thefuck/thefuck/rules/sed_unterminated_s.py
2015-07-04 17:10:11 +02:00

18 lines
424 B
Python

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))