customizing the readline module

Huaiyu Zhu huaiyu at gauss.almadan.ibm.com
Wed Aug 21 21:42:39 CEST 2002


holger krekel <pyth at devel.trillke.net> wrote:
[snip]

Thanks for the help.  As I understand, in the end I need to write the
completer to return either a partial completion or a list of choices, and
take care to pass the result back to readline in such a way as to defeat its
builtin behavior.  Looks like too much effort for the intended usage.

>
>> Is there a way to tweak the protocol for readline to allow the semantics of
>> passing back [aaa] as the accepted words and [bbb1, bbb2] as possible
>> completions?  That would allow the command line to remain 'aaa ' while the
>> completions be 'bbb1 bbb2'.
>
>newer readline libs might help but python will not integrate that soon
>enough, i guess.  The above approach works for me and is fairly backward
>compatible.  

I would think that even with existing readline lib, the python module could
be redesigned to handle this, if it was aimed at providing a high level
interface to the low level facility, instead of exposing the low level
facility directly.  When I have time I'll try to write a wrapper of readline
to do this.

In the mean time I'm back to typing various command line options.

Huaiyu



More information about the Python-list mailing list