From 3ccb0a6f137fe2d38ecb36a5d20cdcbd31d2a18f Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Apr 26 2011 04:08:57 +0000 Subject: Rename `--answer' option to `--answer-yes' option. Previously it was required to pass a language-specific argument to the option in order to determine whether or not pass the question. Now, this language-specific argument is no longer needed. You only need to pass the option `--answer-yes' for yes/no question to assume a possitive answer. --- diff --git a/Scripts/Functions/Copy/copy_getArguments.sh b/Scripts/Functions/Copy/copy_getArguments.sh index f005045..afef379 100755 --- a/Scripts/Functions/Copy/copy_getArguments.sh +++ b/Scripts/Functions/Copy/copy_getArguments.sh @@ -28,7 +28,7 @@ function copy_getArguments { local ARGSS="" # Define long options we want to support. - local ARGSL="quiet,answer:,dont-commit-changes" + local ARGSL="quiet,answer-yes,dont-commit-changes" # Redefine ARGUMENTS variable using getopt output. cli_doParseArguments @@ -47,9 +47,9 @@ function copy_getArguments { shift 1 ;; - --answer ) - FLAG_ANSWER="$2" - shift 2 + --answer-yes ) + FLAG_ANSWER="true" + shift 1 ;; --dont-commit-changes ) diff --git a/Scripts/Functions/Help/help_getOptions.sh b/Scripts/Functions/Help/help_getOptions.sh index 0c403f5..4e96f15 100755 --- a/Scripts/Functions/Help/help_getOptions.sh +++ b/Scripts/Functions/Help/help_getOptions.sh @@ -28,7 +28,7 @@ function help_getOptions { local ARGSS="" # Define long options we want to support. - local ARGSL="filter:,quiet,answer:,dont-commit-changes,read,search,edit,update,copy,delete,rename" + local ARGSL="filter:,quiet,answer-yes,dont-commit-changes,read,search,edit,update,copy,delete,rename" # Parse arguments using getopt(1) command parser. cli_doParseArguments @@ -52,9 +52,9 @@ function help_getOptions { shift 1 ;; - --answer ) - FLAG_ANSWER="$2" - shift 2 + --answer-yes ) + FLAG_ANSWER="true" + shift 1 ;; --dont-commit-changes ) diff --git a/Scripts/Functions/Locale/locale_getArguments.sh b/Scripts/Functions/Locale/locale_getArguments.sh index 2f8cf3c..aecb218 100644 --- a/Scripts/Functions/Locale/locale_getArguments.sh +++ b/Scripts/Functions/Locale/locale_getArguments.sh @@ -28,7 +28,7 @@ function locale_getArguments { local ARGSS="" # Define long options we want to support. - local ARGSL="filter:,quiet,answer:,dont-commit-changes,update,edit,dont-create-mo" + local ARGSL="filter:,quiet,answer-yes,dont-commit-changes,update,edit,dont-create-mo" # Parse arguments using getopt(1) command parser. cli_doParseArguments @@ -52,9 +52,9 @@ function locale_getArguments { shift 1 ;; - --answer ) - FLAG_ANSWER="$2" - shift 2 + --answer-yes ) + FLAG_ANSWER="true" + shift 1 ;; --dont-commit-changes ) diff --git a/Scripts/Functions/Prepare/prepare_getArguments.sh b/Scripts/Functions/Prepare/prepare_getArguments.sh index 92072ce..26b4fb1 100755 --- a/Scripts/Functions/Prepare/prepare_getArguments.sh +++ b/Scripts/Functions/Prepare/prepare_getArguments.sh @@ -28,7 +28,7 @@ function prepare_getArguments { local ARGSS="" # Define long options we want to support. - local ARGSL="quiet,answer:,packages,links,environment" + local ARGSL="quiet,answer-yes,packages,links,environment" # Parse arguments using getopt(1) command parser. cli_doParseArguments @@ -47,9 +47,9 @@ function prepare_getArguments { shift 1 ;; - --answer ) - FLAG_ANSWER="$2" - shift 2 + --answer-yes ) + FLAG_ANSWER="true" + shift 1 ;; --packages ) diff --git a/Scripts/Functions/Render/render_getArguments.sh b/Scripts/Functions/Render/render_getArguments.sh index b69b90b..9fbc8c9 100644 --- a/Scripts/Functions/Render/render_getArguments.sh +++ b/Scripts/Functions/Render/render_getArguments.sh @@ -28,7 +28,7 @@ function render_getArguments { local ARGSS="" # Define long options we want to support. - local ARGSL="filter:,quiet,answer:,dont-commit-changes,releasever:,basearch:,convert:,rotate:,resize:,group-by:,theme-model:" + local ARGSL="filter:,quiet,answer-yes,dont-commit-changes,releasever:,basearch:,convert:,rotate:,resize:,group-by:,theme-model:" # Redefine ARGUMENTS variable using getopt output. cli_doParseArguments @@ -52,9 +52,9 @@ function render_getArguments { shift 1 ;; - --answer ) - FLAG_ANSWER="$2" - shift 2 + --answer-yes ) + FLAG_ANSWER="true" + shift 1 ;; --dont-commit-changes ) diff --git a/Scripts/Functions/Tuneup/tuneup_getArguments.sh b/Scripts/Functions/Tuneup/tuneup_getArguments.sh index ead5e37..a3b5e26 100755 --- a/Scripts/Functions/Tuneup/tuneup_getArguments.sh +++ b/Scripts/Functions/Tuneup/tuneup_getArguments.sh @@ -28,7 +28,7 @@ function tuneup_getArguments { local ARGSS="" # Define long options we want to support. - local ARGSL="filter:,quiet,answer:,dont-commit-changes" + local ARGSL="filter:,quiet,answer-yes,dont-commit-changes" # Redefine ARGUMENTS variable using getopt output. cli_doParseArguments @@ -52,9 +52,9 @@ function tuneup_getArguments { shift 1 ;; - --answer ) - FLAG_ANSWER="$2" - shift 2 + --answer-yes ) + FLAG_ANSWER="true" + shift 1 ;; --dont-commit-changes ) diff --git a/Scripts/Functions/cli.sh b/Scripts/Functions/cli.sh index 0789d32..86cefc7 100644 --- a/Scripts/Functions/cli.sh +++ b/Scripts/Functions/cli.sh @@ -46,8 +46,9 @@ function cli { local FLAG_QUIET='false' # Initialize default value to answer flag. The answer flag - # (--answer) controls whether centos-art.sh script does or does - # not pass confirmation request points. By default, it doesn't. + # (--answer-yes) controls whether centos-art.sh script does or + # does not pass confirmation request points. By default, it + # doesn't. local FLAG_ANSWER='false' # Initialize default value to don't commit changes flag. The don't diff --git a/Scripts/Functions/cli_printMessage.sh b/Scripts/Functions/cli_printMessage.sh index e3aa91c..eade786 100755 --- a/Scripts/Functions/cli_printMessage.sh +++ b/Scripts/Functions/cli_printMessage.sh @@ -131,9 +131,13 @@ function cli_printMessage { local N="`gettext "no"`" # Define default answer. - local ANSWER=${FLAG_ANSWER} + local ANSWER=${N} - if [[ $ANSWER == 'false' ]];then + if [[ $FLAG_ANSWER == 'true' ]];then + + ANSWER=${Y} + + else # Print the question. cli_printMessage "$MESSAGE [${Y}/${N}]: " 'AsNoTrailingNewLine'