David Paleino <d.paleino <at> gmail.com> writes: > > 4. Helper functions reside in a subdirectory `include'. Helper > > functions can be loaded by calling `comp_include', e.g. > > ./completions/complete-nohostcomplete/ssh does: > > > > comp_include _dequote _known_hosts > > Any reason for this? > Since those are "helper functions", I suppose they might as well go where > comp_include is defined (i.e. I don't think you define comp_include in each > completion file) [0]
Within bash_completion_lib, the function `comp_include' resides in the file `completionrc', which is loaded the first time a completion is invoked - typically when TAB is pressed. To prevent `completionrc' from growing ever larger as completions keep getting added to bash-completion, I decided to move all shared helper functions to an `include' subdirectory. Completions can include shared helper functions with the function-call `comp_include [FILE]...'. This prevents the bash environment from becoming cluttered with unused shared bash-completion helper functions. One might argue that common functions like `_filedir' should always be available without a call to `comp_include', but I think that as development continues (e.g. bash-4), helper functions come and go and including them specific, eases maintenance. Note that at the moment (bash_completion_lib-1.2.8), `completionrc' is still containing helper functions but I'm planning to move them all to the main `include' subdirectory (issue #30). Also, `comp_include' is only looking at $COMP_DIR/include but `comp_include' is going to look at each $COMP_PATH/include directory (issue #40). It looks like the main `include' directory is going to contain these files: _available_interfaces _btdownload _command _comp_dpkg_installed_packages comp_filedir_xspec _configured_interfaces _count_args _dequote _expand _filedir _get_cword _gids _ImageMagick _java _known_hosts _longopt _lvm _mailman_lists _modules _perlmodules _pids _pg_databases _pgids _pg_users _rl_enabled _rpm_installed_packages _services _signals _uids _usergroup Regards, Freddy Vulto _______________________________________________ Bash-completion-devel mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/bash-completion-devel
