diff --git a/Scripts/Bash/Functions/Help/help_createEntry.sh b/Scripts/Bash/Functions/Help/help_createEntry.sh index 974184c..4aa8567 100755 --- a/Scripts/Bash/Functions/Help/help_createEntry.sh +++ b/Scripts/Bash/Functions/Help/help_createEntry.sh @@ -1,7 +1,7 @@ #!/bin/bash # # help_createEntry.sh -- This function creates a new documentation -# entry based on option value (OPTIONVAL). +# entry based on option value (ACTIONVAL). # # Copyright (C) 2009, 2010 Alain Reguera Delgado # diff --git a/Scripts/Bash/Functions/Help/help_editEntry.sh b/Scripts/Bash/Functions/Help/help_editEntry.sh index bb894b7..faa3d03 100755 --- a/Scripts/Bash/Functions/Help/help_editEntry.sh +++ b/Scripts/Bash/Functions/Help/help_editEntry.sh @@ -9,7 +9,7 @@ # 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 diff --git a/Scripts/Bash/Functions/Help/help_getActions.sh b/Scripts/Bash/Functions/Help/help_getActions.sh index f93ef0a..d5f8a4f 100755 --- a/Scripts/Bash/Functions/Help/help_getActions.sh +++ b/Scripts/Bash/Functions/Help/help_getActions.sh @@ -28,7 +28,7 @@ function help_getActions { help_checkLanguageLayout - case $OPTIONNAM in + case $ACTIONNAM in --search ) help_searchIndex diff --git a/Scripts/Bash/Functions/Help/help_getEntry.sh b/Scripts/Bash/Functions/Help/help_getEntry.sh index c5b8b52..3a3205b 100755 --- a/Scripts/Bash/Functions/Help/help_getEntry.sh +++ b/Scripts/Bash/Functions/Help/help_getEntry.sh @@ -1,7 +1,7 @@ #!/bin/bash # # help_getEntry.sh -- This function builds a documentation entry based -# on option value (OPTIONVAL) variable. +# on option value (ACTIONVAL) variable. # # Copyright (C) 2009, 2010 Alain Reguera Delgado # @@ -32,12 +32,12 @@ function help_getEntry { local ENTRY='' # Build directory for documenation entry. - DIR=$(echo $OPTIONVAL | sed -r 's!^/home/centos/artwork/!!') + DIR=$(echo $ACTIONVAL | sed -r 's!^/home/centos/artwork/!!') DIR=$(dirname $DIR) DIR=${MANUALS_DIR[2]}/$DIR # Build file for documentation entry. - FILE=$(basename $OPTIONVAL).texi + FILE=$(basename $ACTIONVAL).texi # Combine both directory (DIR) and file (FILE) to build entry's # absolute path. When the entry's absolute path is built for the diff --git a/Scripts/Bash/Functions/Help/help_getNode.sh b/Scripts/Bash/Functions/Help/help_getNode.sh index 14314cc..b816e04 100755 --- a/Scripts/Bash/Functions/Help/help_getNode.sh +++ b/Scripts/Bash/Functions/Help/help_getNode.sh @@ -1,7 +1,7 @@ #!/bin/bash # # help_getNode.sh -- This function cleans up the option value -# (OPTIONVAL) directory to make a node name from it. +# (ACTIONVAL) directory to make a node name from it. # # Copyright (C) 2009, 2010 Alain Reguera Delgado # @@ -26,7 +26,7 @@ function help_getNode { - local NODE=$(echo "$OPTIONVAL" \ + local NODE=$(echo "$ACTIONVAL" \ | sed -r 's!^/home/centos/artwork/!!' \ | sed -r 's!/! !g' | sed -r 's!^[[:space:]]+!!') diff --git a/Scripts/Bash/Functions/Help/help_searchIndex.sh b/Scripts/Bash/Functions/Help/help_searchIndex.sh index 258b735..6fa6ec2 100644 --- a/Scripts/Bash/Functions/Help/help_searchIndex.sh +++ b/Scripts/Bash/Functions/Help/help_searchIndex.sh @@ -26,29 +26,51 @@ function help_searchIndex { - # Define search pattern format + # Define search pattern format. local PATTERN='^[[:alnum:],]+$' - # Re-define default REGEX value. If the regular expression was not - # provided in the third argument its value is set to '.+' which is - # not very useful in info --index-search contest. So, re-define - # this value to an empty value (''). - if [[ ! $REGEX =~ $PATTERN ]];then - cli_printMessage "`gettext "Enter the search pattern:"` " "AsRequestLine" - read REGEX + # Define default search string. + local SEARCH='' + + # Define short options we want to support. + ARGSS="" + + # Define long options we want to support. + ARGSL="filter:" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Define action to take for each option passed. + while true; do + case "$1" in + --filter ) + SEARCH="$2" + shift 2 + ;; + * ) + break + esac + done + + # Re-define default SEARCH value. If the search string is not + # provided as `--filter' argument, ask user to provide one. + if [[ ! $SEARCH =~ $PATTERN ]];then + cli_printMessage "`gettext "Enter the search pattern"`" "AsRequestLine" + read SEARCH fi - # Validate search pattern. In this (help_searchIndex) function - # contest, the REGEX variable is used as info search pattern, not - # a regular expression pattern. - if [[ ! "$REGEX" =~ $PATTERN ]];then - cli_printMessage "`gettext "The search pattern is not valid."`" + # Validate search string using search pattern. + if [[ ! "$SEARCH" =~ $PATTERN ]];then + cli_printMessage "`gettext "The search pattern is not valid."`" 'AsErrorLine' cli_printMessage "$(caller)" "AsToKnowMoreLine" fi - # There is no need to check the entry inside documentation - # structure here. Just provide a word to look if there is any - # index matching in the info document. - /usr/bin/info --index-search="$REGEX" --file=${MANUALS_FILE[4]} + # Perform index search inside documentation info file. + /usr/bin/info --index-search="$SEARCH" --file=${MANUALS_FILE[4]} } diff --git a/Scripts/Bash/Functions/Help/help_updateOutputFiles.sh b/Scripts/Bash/Functions/Help/help_updateOutputFiles.sh index 228b255..c0f26e4 100755 --- a/Scripts/Bash/Functions/Help/help_updateOutputFiles.sh +++ b/Scripts/Bash/Functions/Help/help_updateOutputFiles.sh @@ -41,10 +41,10 @@ function help_updateOutputFiles { # Re-define output variable in order for cli_commitRepoChanges # functionality to receive the correct location to apply # subversion commands. Inside `help' functionality, the correct - # place to commit changes is not the initial value of OPTIONVAL + # place to commit changes is not the initial value of ACTIONVAL # but the directory path where documentation changes take place # under. - OPTIONVAL=${MANUALS_DIR[0]} + ACTIONVAL=${MANUALS_DIR[0]} # Update central repository. Be sure this is the last action # you perform inside centos-art.sh script flow.