bug-bash
[Top][All Lists]
Advanced

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

Re: Non Incremental Nature of Custom Completion


From: Chet Ramey
Subject: Re: Non Incremental Nature of Custom Completion
Date: Wed, 07 Dec 2011 08:30:29 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0

On 12/6/11 12:04 PM, Bastien Dejean wrote:
> Hi,
> 
> I've made a custom completion function for one of my tools:
> 
>     https://github.com/baskerville/owl
> 
> And I'd like `compgen -f` to behave like the default bash filename
> completion, but it doesn't: for example, if I type `f` and if the only
> file starting with `f` in the current directory is a directory named
> `foo`, then, if I press `<Tab>`, I'll get `foo `, I'd like to get `foo/`
> instead. 

`compgen' only generates possible completions.  It's readline's job to
display them and append the appropriate characters.  You tell readline
how to behave when you install the completion with `complete'.  For
instance, `complete -o filenames ...' will tell readline that the
completion spec generates filenames, so the resulting words should be
quoted, if necessary, checked whether they are directories, and so on.

If you want to change these options on the fly, while a completion
function is executing, you can use `compopt' to set or unset them.

Chet


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



reply via email to

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