Blame Scripts/CentOS-Art/Functions/cli_parseArguments.sh

b7b189
#!/bin/bash
b7b189
#
793c4c
# cli_parseArguments.sh -- This function redefines arguments
f4da7e
# (ARGUMENTS) global variable using getopt(1) output.
b7b189
#
2fe9b7
# Copyright (C) 2009, 2010, 2011 The CentOS Project
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# WITHOUT ANY WARRANTY; without even the implied warranty of
b7b189
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
b7b189
# General Public License for more details.
b7b189
#
b7b189
# You should have received a copy of the GNU General Public License
b7b189
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
b7b189
# ----------------------------------------------------------------------
9aebad
# $Id$
b7b189
# ----------------------------------------------------------------------
b7b189
793c4c
function cli_parseArguments {
b7b189
b7b189
    # Reset positional parameters using optional arguments.
b7b189
    eval set -- "$ARGUMENTS"
b7b189
b7b189
    # Parse optional arguments using getopt.
9ca34e
    ARGUMENTS=$(getopt -o "$ARGSS" -l "$ARGSL" -n "$CLI_PROGRAM (${FUNCNAME[1]})" -- "$@")
b7b189
b7b189
    # Be sure getout parsed arguments successfully.
b7b189
    if [[ $? != 0 ]]; then 
903cf1
        cli_printMessage "${CLI_FUNCDIRNAM}" --as-toknowmore-line
b7b189
    fi
b7b189
b7b189
}