Show More
@@ -184,7 +184,7 b" ip.set_hook('complete_command', runlistpy, str_key = '%run')" | |||
|
184 | 184 | |
|
185 | 185 | def cd_completer(self, event): |
|
186 | 186 | relpath = event.symbol |
|
187 |
# |
|
|
187 | #print event # dbg | |
|
188 | 188 | if '-b' in event.line: |
|
189 | 189 | # return only bookmark completions |
|
190 | 190 | bkms = self.db.get('bookmarks',{}) |
@@ -198,20 +198,20 b' def cd_completer(self, event):' | |||
|
198 | 198 | return ents |
|
199 | 199 | return [] |
|
200 | 200 | |
|
201 | if sys.platform != 'win32': | |
|
202 | protect = lambda n: n | |
|
203 | else: | |
|
204 | def protect(n): | |
|
205 | return n.replace('\\' ,'/').replace(' ', '\\ ') | |
|
206 | ||
|
207 | 201 | if relpath.startswith('~'): |
|
208 | 202 | relpath = os.path.expanduser(relpath).replace('\\','/') |
|
209 | found = [protect(f)+'/' for f in glob.glob(relpath+'*') if os.path.isdir(f)] | |
|
210 | # print "f",found # dbg | |
|
203 | found = [] | |
|
204 | for d in [f + '/' for f in glob.glob(relpath+'*') if os.path.isdir(f)]: | |
|
205 | if ' ' in d: | |
|
206 | # we don't want to deal with any of that, complex code | |
|
207 | # for this is elsewhere | |
|
208 | raise IPython.ipapi.TryNext | |
|
209 | found.append( d ) | |
|
210 | ||
|
211 | 211 | if not found: |
|
212 | 212 | if os.path.isdir(relpath): |
|
213 | 213 | return [relpath] |
|
214 |
|
|
|
214 | raise IPython.ipapi.TryNext | |
|
215 | 215 | return found |
|
216 | 216 | |
|
217 | 217 | ip.set_hook('complete_command', cd_completer, str_key = '%cd') |
General Comments 0
You need to be logged in to leave comments.
Login now