[Bash-completion-devel] hostname completion issues

Freddy Vulto fvulto at gmail.com
Sat Jul 25 10:10:33 UTC 2009


On Fri, Jul 3, 2009 at 11:15 PM, Guillaume
Rousse<Guillaume.Rousse at inria.fr> wrote:
> However, using this prefix for distinguishing helper function setting or
> adding to COMPREPLY is fine. In this regard, we shoud rename the following
> ones:
> - _filedir -> _add_filedirs
> - _pci_ids -> _add_pc_ids
> etc...

I have another idea, maybe we can take it even one step further: Why
don't we let the helper functions output to stdout instead of adding
to COMPREPLY directly?  A suitable prefix for this function range
would then be `_compgen':

- _compgen_known_hosts
- _compgen_filedir
- _compgen_pc_ids
- ...

Rationale:

It makes helper functions less coupled, thus better.

Outputting to stdout is in analogy with bash's `compgen'.

Outputting to stdout is in analogy with normal bash function
behaviour: input via function parameters, output via stdout.

The `_compgen' prefix would also serve as a start for letting
bash-completion functions reside in some kind of `comp' namespace in
order to make it less likely for bash-completion functions to clash
with user functions 'out there'.

What do you think?

Freddy Vulto
http://fvue.nl



More information about the Bash-completion-devel mailing list