#!/usr/bin/env bash

__rvm_notes_warning_path_reset()
{
  \typeset -a __files

  __files=()

  for __file in ~/.zlogin ~/.zshrc ~/.bash_profile ~/.bashrc
  do
    if [[ -f "${__file}" ]]
    then __files+=( "${__file}" )
    fi
  done

  if
    [[ ${rvm_ignore_dotfiles_flag:-0} == 0 ]] &&
    (( ${#__files[@]} )) &&
    __rvm_grep -rn '^[^#]*PATH=' "${__files[@]}" |
      __rvm_grep -vE '[[:alnum:]_]PATH=|PATH=.*PATH'
  then
    # account for __rvm_grep not showing file name for just one file checked
    if (( ${#__files[*]} == 1 ))
    then __file="Your '${__files[*]}'"
    else __file="Above files"
    fi

    rvm_warn "
  * WARNING: ${__file} contains <code>PATH=</code> <warn>with no <code>\$PATH<code> <warn>inside, this can break RVM,
    for details check https://github.com/rvm/rvm/issues/1351#issuecomment-10939525
    to avoid this warning prepend <code>\$PATH<code>
"
  fi | \command \cat - >&2
}

__rvm_notes_warning_path_reset
