Confusion regarding the readline module

S

Siddhant

Hi!
I am having some doubts related to the readline module. I hope someone
could clear them.
1. What exactly does the readline.get_line_buffer() function do? Does
it return whatever is the current input by the user? If yes, then can
I use it to check the current inputs of the user and base the next-
word completion against whatever the user has entered so far? There
wasn't much documentation on it, and a lot of googling couldn't help
much. :(
2. Related to the completer function, what is meant by returning the
"state"th completion for "text"? Is the completer function called
everytime (for all possible values of "state") when I press the Tab
key? When/How is it called?

Basically, I need to define a completer function, that should take
into consideration whatever the user has entered so far, and complete
the next word accordingly. The same way as a "cd /some/file" is
meaningless.
 
D

Diez B. Roggisch

Siddhant said:
Hi!
I am having some doubts related to the readline module. I hope someone
could clear them.
1. What exactly does the readline.get_line_buffer() function do? Does
it return whatever is the current input by the user? If yes, then can
I use it to check the current inputs of the user and base the next-
word completion against whatever the user has entered so far? There
wasn't much documentation on it, and a lot of googling couldn't help
much. :(
2. Related to the completer function, what is meant by returning the
"state"th completion for "text"? Is the completer function called
everytime (for all possible values of "state") when I press the Tab
key? When/How is it called?

Basically, I need to define a completer function, that should take
into consideration whatever the user has entered so far, and complete
the next word accordingly. The same way as a "cd /some/file" is
meaningless.

I don't know anything about readline (beyond it's existence of course) - but
I do know & use the rlcompleter2 module. Go download it and look into it's
source, it should give you an idea how to proceed.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top