[Bash-completion-devel] Making _filedir's fallback to everything optional
ville.skytta at iki.fi
Mon Sep 5 19:41:00 UTC 2011
On 09/05/2011 01:10 PM, Raphaël Droz wrote:
> About "off by default":
> Should the behavior be activated on a per-completion basis (each command
> can choose whether or not a catch-all fallback should happen if no
> matching file is found) ?
> (A pdf viewer probably won't choose to fallback on "any" file, but
> mplayer and some others may benefit from this)
> (but it may easily become a heavy code portion)
Quite frankly, I would personally rather get rid of the fallback
altogether and instead try to provide a mechanism with which users could
override extensions _filedir looks at - I suppose this is kind of what
the fallback is there to implement (in a confusing way) in the first place.
For example, we could provide a configurable associative array where
keys are command names and values are _filedir globs; if there's an
entry in it for the command being completed, use the glob (which could
be empty if one wants to complete all files) instead of the one passed
to _filedir. One problem with this is that depending on options given
to a command, it might take entirely different files than with other
options or with no options...
More information about the Bash-completion-devel