[Bash-completion-devel] Namespace

Freddy Vulto fvulto at gmail.com
Sun May 8 22:03:17 UTC 2011

+1 for BASHCOMP_* for the setting variables (maybe we can also support a
'.bashcomprc' file to allow a user to get rid of the globals)?

Side-looking at this git-completion-thread
they're using:

_git_foo:   for completing `git foo'
__git_foo:  for public/private functions

How are we going to rename the completion functions, for example _cd:
_bc_cd?  This would mean ideally we're giving away the _bc_* namespace
to API users (completion writers).  So we'd better leave the _bc_*
namespace for completions only and revert to uppercase or two
underscores for library functions?  What namespace can completion
writers safely use for helper functions?  _bc_foo_*?

Using two underscores for public API functions and three underscores for
private is getting confusing I think, so I like the idea of using
uppercase _BC_ for public.  Maybe we'd better use __BC_ (two underscores
and uppercase) for private library functions as well so that __bc_ is
also free for completion writers (what are the chances of acroread
creating a _bc_filedir or __bc_filedir where they ideally should use


Completion functions: _bc_*
Helper functions for specific completion (foo): _bc_foo_*
Public API functions: _BC_*
Private functions and private non-local variables: __BC_*

Freddy Vulto

More information about the Bash-completion-devel mailing list