################################################################################
#    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
################################################################################

#
# allow names of valid options to be passed in by the calling script
# If no such options are passed in then use default option names.
#
if test "$thor_options" == ""; then
    thor_options="i:u:p:qh?"
else
    thor_options="i:u:p:qh?"$thor_options
fi

while getopts $thor_options opt; 
do
    case "$opt" in
    i) cluster=$OPTARG;;
    u) thoruser=$OPTARG;;
    p) thorpasswd=$OPTARG;;
    q) quietmode=true;;
    \? | h) echo valid options are:
        echo "-i <instance>"
        echo "-u <thor-user>"
        echo "-p <password>"
        exit 1;;
    *) thor_option_arg[$opt]=$OPTARG;; # any valid option other than c, u or p
    esac
done

#echo ${thor_option_arg[n]}

while test "$cluster" = ""
do
   read -p "Please enter cluster name: " cluster
done

shift $(($OPTIND - 1))

