# Copyright 2009 Mike Kelly
# Distributed under the terms of the GNU General Public License, v2 or later
# Based upon 'bash_completion.sh' from bash-completion

# Integrate nicely with bashcomp.eclectic:

# Per-user configuration
[[ -z "${BASH_COMPLETION_DIR}" ]] &&
    BASH_COMPLETION_DIR=~/.bash_completion.d
# Global configuration
[[ -z "${BASH_COMPLETION_COMPAT_DIR}" ]] &&
    BASH_COMPLETION_COMPAT_DIR=/etc/bash_completion.d

# Check for interactive bash and that we haven't already been sourced.
[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION" ] && return

# Check for recent enough version of bash.
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
if [ $bmajor -eq 2 -a $bminor '>' 04 ] || [ $bmajor -gt 2 ]; then
  if [ -r /etc/bash_completion ]; then
    # Source completion code.
    . /etc/bash_completion
  fi
fi
unset bash bminor bmajor
