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 c...@case.edu http://cnswww.cns.cwru.edu/~chet/