From 111205b06a5c63fc7cfae1d99f7fde956eda002d Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Mar 12 2011 19:55:36 +0000 Subject: Update `prepare' functionality. - Rename functionality from `prepare_getActions' to `prepare_getArguments'. --- diff --git a/Scripts/Bash/Cli/Functions/Prepare/prepare.sh b/Scripts/Bash/Cli/Functions/Prepare/prepare.sh index 00fbec1..6feffa9 100755 --- a/Scripts/Bash/Cli/Functions/Prepare/prepare.sh +++ b/Scripts/Bash/Cli/Functions/Prepare/prepare.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# verify.sh -- This function verifies your workstation for using +# prepare.sh -- This function verifies your workstation for using # centos-art.sh script. # # Copyright (C) 2009-2011 Alain Reguera Delgado @@ -24,9 +24,9 @@ # $Id$ # ---------------------------------------------------------------------- -function verify { +function prepare { # Define command-line interface. - prepare_getActions + prepare_getArguments } diff --git a/Scripts/Bash/Cli/Functions/Prepare/prepare_getActions.sh b/Scripts/Bash/Cli/Functions/Prepare/prepare_getActions.sh deleted file mode 100755 index 60754b7..0000000 --- a/Scripts/Bash/Cli/Functions/Prepare/prepare_getActions.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# -# prepare_getActions.sh -- This function interpretes arguments passed -# to `verify' functionality and calls actions accordingly. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function prepare_getActions { - - # Define short options we want to support. - local ARGSS="" - - # Define long options we want to support. - local ARGSL="packages,links,environment" - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Look for options passed through command-line. - while true; do - case "$1" in - - --packages ) - ACTIONNAM="${FUNCNAM}_doPackages" - break - ;; - - --links ) - ACTIONNAM="${FUNCNAM}_doLinks" - break - ;; - - --environment ) - ACTIONNAM="${FUNCNAM}_doEnvironment" - break - ;; - - * ) - break - esac - done - - # Execute action name. - if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then - eval $ACTIONNAM - else - cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - -} diff --git a/Scripts/Bash/Cli/Functions/Prepare/prepare_getArguments.sh b/Scripts/Bash/Cli/Functions/Prepare/prepare_getArguments.sh new file mode 100755 index 0000000..183e1d6 --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Prepare/prepare_getArguments.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# +# prepare_getArguments.sh -- This function interpretes arguments passed +# to `verify' functionality and calls actions accordingly. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function prepare_getArguments { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="packages,links,environment" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Look for options passed through command-line. + while true; do + case "$1" in + + --packages ) + ACTIONNAM="${FUNCNAM}_doPackages" + break + ;; + + --links ) + ACTIONNAM="${FUNCNAM}_doLinks" + break + ;; + + --environment ) + ACTIONNAM="${FUNCNAM}_doEnvironment" + break + ;; + + * ) + break + esac + done + + # Execute action name. + if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then + eval $ACTIONNAM + else + cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + +}