bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-readline] Help to write custom completion function


From: Chet Ramey
Subject: Re: [Bug-readline] Help to write custom completion function
Date: Fri, 04 May 2012 09:01:23 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

On 5/4/12 1:26 AM, velusamy Krishnan wrote:
> Dear All,
>       I am new to the readline library, I just used the example program
> which is used to complete the list of the commands. Now I just complete
> arguments for the commands. The arguments for the commands differ based on
> the given commands. So, I have to get the given command, and after pressing
> the tab I should list the possible argument for that command.
>       I know this is basic, but could not find the document to understand
> that.  Kindly anyone please help me..

Look at how bash does it (bashline.c, pcomplete.c) for the basics.  The
idea is that you use the contents of rl_line_buffer to see what the command
is, and provide completions for the word readline passes to your
application's completion function based on that.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]