# Generated by stubbs:add-option. Do not edit, if using stubbs.
# Created: Wed Aug  5 14:11:16 MDT 2015
#
#/ usage: accept:upgrade [ --to <master>] [ --cleanup ]  --upgrade-style <graceful> 

# _rerun_options_parse_ - Parse the command arguments and set option variables.
#
#     rerun_options_parse "$@"
#
# Arguments:
#
# * the command options and their arguments
#
# Notes:
# 
# * Sets shell variables for any parsed options.
# * The "-?" help argument prints command usage and will exit 2.
# * Return 0 for successful option parse.
#
rerun_options_parse() {

    while [ "$#" -gt 0 ]; do
        OPT="$1"
        case "$OPT" in
            --to) rerun_option_check $# $1; TO=$2 ; shift ;;
            --cleanup) CLEANUP=true; [[ ${2:-} == true ]] && shift ;;
            --upgrade-style) rerun_option_check $# $1; UPGRADE_STYLE=$2 ; shift ;;
            # help option
            -|--*?)
                rerun_option_usage
                exit 2
                ;;
            # end of options, just arguments left
            *)
              break
        esac
        shift
    done

    # Set defaultable options.
    [ -z "$TO" ] && TO="$(rerun_property_get $RERUN_MODULE_DIR/options/to DEFAULT)"
    [ -z "$UPGRADE_STYLE" ] && UPGRADE_STYLE="$(rerun_property_get $RERUN_MODULE_DIR/options/upgrade-style DEFAULT)"
    # Check required options are set
    [ -z "$UPGRADE_STYLE" ] && { echo >&2 "missing required option: --upgrade-style" ; return 2 ; }
    # If option variables are declared exportable, export them.

    #
    return 0
}


# If not already set, initialize the options variables to null.
: ${TO:=}
: ${UPGRADE_STYLE:=}


