#---
## @Synopsis libdepends
#---

function query_spell_dependencies() {
  message "${QUERY_COLOR}Please enter the dependencies(non optional) \
of the spell if any:${DEFAULT_COLOR}"
  read "SPELL_DEPENDENCIES"
  SPELL_DEPENDENCIES=$(tr ',' ' ' <<< "$SPELL_DEPENDENCIES")
}

function query_spell_optional_dependencies() {
  message "${QUERY_COLOR}Please enter the optional dependencies of the \
spell if any:${DEFAULT_COLOR}"
  read -a "SPELL_OPTIONAL_DEPENDENCIES"
}

function add_dependencies() {
if [[ "${SPELL_DEPENDENCIES}" != "" ]]
then
  touch DEPENDS
  chmod +x DEPENDS
  DEPENDSISON="DEPENDS, "
  for i in ${SPELL_DEPENDENCIES}
  do
     echo "depends ${i}" >> DEPENDS
  done
fi
}

function add_optional_dependencies() {
if [[ "${SPELL_OPTIONAL_DEPENDENCIES[0]}" != "" ]]
then
  touch DEPENDS
  chmod +x DEPENDS
  DEPENDSISON="DEPENDS, "
  SPELL_OPTIONAL_DEPENDENCIES_ENABLED[0]=""
  SPELL_OPTIONAL_DEPENDENCIES_DISABLED[0]=""
  SPELL_OPTIONAL_DEPENDENCIES_DESCRIPTION[0]=""
  NM=${#SPELL_OPTIONAL_DEPENDENCIES[*]}
  for  ((MN=0; MN < $NM; MN++))
  do
    message "${QUERY_COLOR}${SPELL_OPTIONAL_DEPENDENCIES[$MN]} needs a ./configure enable option${DEFAULT_COLOR}"
    read SPELL_OPTIONAL_DEPENDENCIES_ENABLED[$MN]
    message "${QUERY_COLOR}${SPELL_OPTIONAL_DEPENDENCIES[$MN]} needs a ./configure disable option${DEFAULT_COLOR}"
    read SPELL_OPTIONAL_DEPENDENCIES_DISABLED[$MN]
    message "${QUERY_COLOR}${SPELL_OPTIONAL_DEPENDENCIES[$MN]} needs a description${DEFAULT_COLOR}"
    read SPELL_OPTIONAL_DEPENDENCIES_DESCRIPTION[$MN]
  done
  for  ((MN=0; MN < $NM; MN++))
  do

echo "optional_depends \"${SPELL_OPTIONAL_DEPENDENCIES[$MN]}\" \"${SPELL_OPTIONAL_DEPENDENCIES_ENABLED[$MN]}\" \"${SPELL_OPTIONAL_DEPENDENCIES_DISABLED[$MN]}\" \"${SPELL_OPTIONAL_DEPENDENCIES_DESCRIPTION[$MN]}\"" >> DEPENDS

  done
# "optional_depends ${j} \"enabled-option\" \"disabled-option\" \"description\""
fi
}
#---
##
## This software is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This software is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this software; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
##
#---

