Blame Scripts/Functions/Prepare/prepare_getArguments.sh

3b853a
#!/bin/bash
3b853a
#
111205
# prepare_getArguments.sh -- This function interpretes arguments passed
8e457b
# to `prepare' functionality and calls actions accordingly.
3b853a
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
3b853a
# 
7cd8e9
# This program is free software; you can redistribute it and/or
7cd8e9
# modify it under the terms of the GNU General Public License as
7cd8e9
# published by the Free Software Foundation; either version 2 of the
7cd8e9
# License, or (at your option) any later version.
3b853a
# 
3b853a
# This program is distributed in the hope that it will be useful, but
3b853a
# WITHOUT ANY WARRANTY; without even the implied warranty of
3b853a
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3b853a
# General Public License for more details.
3b853a
#
3b853a
# You should have received a copy of the GNU General Public License
3b853a
# along with this program; if not, write to the Free Software
3b853a
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
3b853a
# USA.
3b853a
# 
3b853a
# ----------------------------------------------------------------------
3b853a
# $Id$
3b853a
# ----------------------------------------------------------------------
3b853a
111205
function prepare_getArguments {
3b853a
705eab
    # Define short options we want to support.
705eab
    local ARGSS=""
3b853a
705eab
    # Define long options we want to support.
65dd41
    local ARGSL="quiet,answer:,packages,links,environment"
3b853a
705eab
    # Parse arguments using getopt(1) command parser.
705eab
    cli_doParseArguments
3b853a
705eab
    # Reset positional parameters using output from (getopt) argument
705eab
    # parser.
705eab
    eval set -- "$ARGUMENTS"
08abde
705eab
    # Look for options passed through command-line.
705eab
    while true; do
705eab
        case "$1" in
705eab
65dd41
            --quiet )
65dd41
                FLAG_QUIET="true"
65dd41
                FLAG_DONT_COMMIT_CHANGES="true"
65dd41
                shift 1
65dd41
                ;;
65dd41
65dd41
            --answer )
65dd41
                FLAG_ANSWER="$2"
65dd41
                shift 2
65dd41
                ;;
65dd41
705eab
            --packages )
8e457b
                FLAG_PACKAGES="true"
8e457b
                shift 1
705eab
                ;;
705eab
705eab
            --links )
8e457b
                FLAG_LINKS="true"
8e457b
                shift 1
705eab
                ;;
705eab
705eab
            --environment )
8e457b
                FLAG_ENVIRONMENT="true"
8e457b
                shift 1
705eab
                ;;
705eab
705eab
            * )
705eab
                break
705eab
        esac
705eab
    done
705eab
3b853a
}