[IPython-user] Custom command completers implemented in SVN
John Hunter
jdhunter at ace.bsd.uchicago.edu
Tue Oct 31 13:27:03 CST 2006
>>>>> "Fernando" == Fernando Perez <fperez.net at gmail.com> writes:
Fernando> Because you'd asked for this feature, and I'd stalled
Fernando> you :)
Oh yeah -- the specific feature I was requesting was for completions
on "run" and "cd" to inspect the cwd and complete on *.py files and
dirs respectively. For this to work, the completer registry would be
better off taking a function rather than a static list. Ville --
would it hard to support this in the current implementation
In [15]: def listdirs():
....: return [f for f in os.listdir('.') if os.path.isdir(f)]
....:
In [16]: completer.register('cd', listdirs)
In [17]: import glob
In [18]: def listpy(): return glob.glob('*.py')
....:
In [19]: completer.register('run', listpy)
and so on....
This would be really useful, IMO.
JDH
More information about the IPython-user
mailing list