madsmith / bash-completion-lib

Automatically exported from code.google.com/p/bash-completion-lib
GNU General Public License v2.0
0 stars 0 forks source link

Add completion cache #18

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
`bash_completion_lib' can be further enhanced by storing all completions in
a cache file:

   complete -p > cache_file

The cache file could then be a very fast alternative to installing
bash_completion_lib the normal way - as long as the completions do not change.

Original issue reported on code.google.com by fvu...@gmail.com on 29 Jun 2008 at 5:37

GoogleCodeExporter commented 8 years ago

Original comment by fvu...@gmail.com on 29 Jun 2008 at 5:37

GoogleCodeExporter commented 8 years ago
Added cache in r33.  See also README:

`Bash_completion_lib' has a fast algorithm to install completions.  During
startup, all completions in the ./completions directory are converted to
`complete comp_load ...' commands.  By caching the conversion result however,
this fast startup time can even be reduced significantly (0.20 sec -> 0.10 sec
= 50%).

Caching is enabled by setting `COMP_CACHE' to a cache file:

   COMP_CACHE=$HOME/.bash_completion_lib~

`Bash_completion_lib' automatically sets `COMP_CACHE' if it does not already 
exist.
To disable caching, set COMP_CACHE to be empty:

   COMP_CACHE=

Care must be taken to empty the cache file after updates have been made to the
./completions directory.  The cache can be emptied with this bash command ($ =
bash prompt):

   $ > $COMP_CACHE

NOTE: The cache need only be reset, if completions have been added, moved or
      deleted, or when the arguments to `complete' have changed.  Other
      modifications like an improved completion function are automatically
      loaded - remember: it's only the `complete' installments which are
      cached.  Example:
      1.  You moved ./completions/*/cd to another directory.
          The cache must be cleared.
      2.  You improved the _cd completion within ./completions/*/cd.
          You don't have to clear the cache.

Original comment by fvu...@gmail.com on 30 Jun 2008 at 8:53