if [[ ! -o interactive ]]; then
    return
fi

compctl -K _erlenv erlenv

_erlenv() {
  local word words completions
  read -cA words
  word="${words[2]}"

  if [ "${#words}" -eq 2 ]; then
    completions="$(erlenv commands)"
  else
    completions="$(erlenv completions "${word}")"
  fi

  reply=("${(ps:\n:)completions}")
}

if [[ ! -o interactive ]]; then
return
fi

compctl -K _erlenv erlenv

_erlenv() {
  local words completions
  read -cA words

  if [ "${#words}" -eq 2 ]; then
completions="$(erlenv commands)"
  else
completions="$(erlenv completions ${words[2,-2]})"
  fi

reply=("${(ps:\n:)completions}")
}
Fix multiple argument completion with zsh
Fix multiple argument completion with zsh
