mbrubeck / compleat

Generate command-line completions using a simple DSL.
http://limpet.net/mbrubeck/2009/10/30/compleat.html
472 stars 18 forks source link

Respect $BASH_COMPLETION_USER_DIR when installing completion file #27

Closed mdippery closed 3 months ago

mdippery commented 3 months ago

There is not really a standard place for user completion files for bash. According to this Stack Exchange answer, the bash-completion package respects an environment variable called $BASH_COMPLETION_USER_DIR, using defaults as follows:

  1. $BASH_COMPLETION_USER_DIR, if it exists
  2. $XDG_DATA_HOME/bash-completion/completions, if $XDG_DATA_HOME exists
  3. ~/.local/share/bash-completion/completions if neither $BASH_COMPLETION_USER_DIR nor $XDG_DATA_HOME is set

Since that is as close to a standard as we can get in bash, we should replicate that standard when installing our own bash completion script.