This commit is contained in:
Kovid Goyal 2009-05-02 23:11:24 -07:00
parent 6b474cbc44
commit ecdb460426

View file

@ -12,7 +12,7 @@
completion.
'''
import sys, os, shlex, glob
import sys, os, shlex, glob, re
from functools import partial
from calibre import prints
@ -53,8 +53,9 @@ def do_opt(opt):
for x in do_opt(o): yield x
def send(ans):
pat = re.compile('([^0-9a-zA-Z_.])')
for x in sorted(set(ans)):
x = x.replace(' ', '\\ ')
x = pat.sub(lambda m : '\\'+m.group(1), x)
if x.endswith('\\ '):
x = x[:-2]+' '
prints(x)