# autocomplete function for pj
_pj_complete() {
  if [ "${COMP_CWORD}" = 1 ]; then
    word="${COMP_WORDS[COMP_CWORD]}"
    dirs=$(find "${HOME}/projects" -maxdepth 1 -type d \
      | sed -e "s|^$HOME/projects||" -e 's/\///g')

    COMPREPLY=($(compgen -W "${dirs}" -- "${word}"))
  else
    COMPREPLY=()
  fi
}
complete -F _pj_complete pj
