1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-27 13:09:00 +00:00
thefuck/thefuck/rules/sed_unterminated_s.py
2016-01-29 13:09:40 +03:00

19 lines
419 B
Python

import shlex
from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('sed')
def match(command):
return "unterminated `s' command" in command.stderr
def get_new_command(command):
script = shlex.split(command.script)
for (i, e) in enumerate(script):
if e.startswith(('s/', '-es/')) and e[-1] != '/':
script[i] += '/'
return ' '.join(map(shell.quote, script))