[Bash-completion-devel] RFC: Turn on -o filenames in _filedir() if compopt is available

gibboris at gmail.com gibboris at gmail.com
Fri Dec 4 23:43:40 UTC 2009


On Thu, Dec 03, 2009 at 07:22:00PM +0100, Freddy Vulto wrote:
> On 091130 22:15, Crestez Dan Leonard wrote:
> > On Mon, 2009-11-30 at 21:50 +0200, Ville Skyttä wrote:
> > > On Monday 30 November 2009, Crestez Dan Leonard wrote:
> > > > > (No strong opinions whether the test should be
> > > > > "type compopt &>/dev/null" or "${BASH_VERSINFO[0]} -ge 4" but I like
> > > > > the former a bit better.)
> > > > 
> > > > compopt is so very useful it might be worth creating a _compopt wrapper
> > > 
> > > There actually was one (although badly implemented) for a while but it was 
> > > removed because it was not used nor seen necessary.
> > I tried sending two patches and both times I felt the need to use
> > compopt.
> We had a global $compopt, but we wanted to get rid of the pollution
> bash-completion globals are causing in everyone's environment.  That's
> why this is preferred instead:
> 
>    type compopt &>/dev/null && compopt ...
> 
> We could alias this to a function _compopt, but since bash-completion is
> targetted for bash-3, I'd rather turn it the other way around like we do
> for _filedir:
> 
>     _modify_completions_in_some_way() {
>         if [${BASH_VERSINFO[0]} -ge 4]; then
>             compopt ...
>         else 
>             # Bash-3
>             # Manually tweak the completions
>         fi
>     }
> 
> Creating descriptive function wrappers around the few situations where
> compopt would prove useful, now result in hooks we can use for improving
> bash-completion under bash-3.
What are the "manual tweak" bash 3 compatibles you think about ?
The only thing I imagine (saw in upstream mpc completion) is to append ' '
or '/' (and do backslashes hell tricks) to emulate -o filename while using a
global -o nospace (don't know if the 'idea' has been dug before)


More information about the Bash-completion-devel mailing list