github.com/rochacon/deis@v1.0.2-0.20150903015341-6839b592a1ff/tests/bin/accept/commands/upgrade/options.sh (about)

     1  # Generated by stubbs:add-option. Do not edit, if using stubbs.
     2  # Created: Wed Aug  5 14:11:16 MDT 2015
     3  #
     4  #/ usage: accept:upgrade  --provider <vagrant>  --from <> [ --to <master>] [ --skip-cleanup <false>]  --upgrade-style <graceful> 
     5  
     6  # _rerun_options_parse_ - Parse the command arguments and set option variables.
     7  #
     8  #     rerun_options_parse "$@"
     9  #
    10  # Arguments:
    11  #
    12  # * the command options and their arguments
    13  #
    14  # Notes:
    15  # 
    16  # * Sets shell variables for any parsed options.
    17  # * The "-?" help argument prints command usage and will exit 2.
    18  # * Return 0 for successful option parse.
    19  #
    20  rerun_options_parse() {
    21  
    22      while [ "$#" -gt 0 ]; do
    23          OPT="$1"
    24          case "$OPT" in
    25              --provider) rerun_option_check $# $1; PROVIDER=$2 ; shift ;;
    26              --from) rerun_option_check $# $1; FROM=$2 ; shift ;;
    27              --to) rerun_option_check $# $1; TO=$2 ; shift ;;
    28              --skip-cleanup) rerun_option_check $# $1; SKIP_CLEANUP=$2 ; shift ;;
    29              --upgrade-style) rerun_option_check $# $1; UPGRADE_STYLE=$2 ; shift ;;
    30              # help option
    31              -|--*?)
    32                  rerun_option_usage
    33                  exit 2
    34                  ;;
    35              # end of options, just arguments left
    36              *)
    37                break
    38          esac
    39          shift
    40      done
    41  
    42      # Set defaultable options.
    43      [ -z "$PROVIDER" ] && PROVIDER="$(rerun_property_get $RERUN_MODULE_DIR/options/provider DEFAULT)"
    44      [ -z "$TO" ] && TO="$(rerun_property_get $RERUN_MODULE_DIR/options/to DEFAULT)"
    45      [ -z "$SKIP_CLEANUP" ] && SKIP_CLEANUP="$(rerun_property_get $RERUN_MODULE_DIR/options/skip-cleanup DEFAULT)"
    46      [ -z "$UPGRADE_STYLE" ] && UPGRADE_STYLE="$(rerun_property_get $RERUN_MODULE_DIR/options/upgrade-style DEFAULT)"
    47      # Check required options are set
    48      [ -z "$PROVIDER" ] && { echo >&2 "missing required option: --provider" ; return 2 ; }
    49      [ -z "$FROM" ] && { echo >&2 "missing required option: --from" ; return 2 ; }
    50      [ -z "$UPGRADE_STYLE" ] && { echo >&2 "missing required option: --upgrade-style" ; return 2 ; }
    51      # If option variables are declared exportable, export them.
    52  
    53      #
    54      return 0
    55  }
    56  
    57  
    58  # If not already set, initialize the options variables to null.
    59  : ${PROVIDER:=}
    60  : ${FROM:=}
    61  : ${TO:=}
    62  : ${SKIP_CLEANUP:=}
    63  : ${UPGRADE_STYLE:=}
    64  
    65