From 40e4a4fc20f1f3865b908751b1a708df04e6f8c9 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: May 30 2011 02:52:55 +0000 Subject: Update `help' functionality: Help/help.sh: - Move execution of reading action (texinfo_searchNode) to actions that might need or not action values to do their work. Help/Backends/Texinfo/texinfo_searchNode.sh: - Now that reading action is under actions that might need or not action values, start using function positional parameters to retrive action values and convert them to documentation entries, which are used to build the node string that we pass to info reader. - More thatn one action value can be passed to this function. There is loop here through manual entries to support reading of more than one action value. - When the action value doesn't exist, keep asking the user to create it. - There is no need of adding Directory to node definition. This construction is alredy done by `texinfo_getNode' function. Help/Backends/Texinfo/texinfo_getNode.sh: - Stop using ACTIONVAL variable as source for NODE building. The MANUAL_ENTRY variable is used instead. - In order for this function to work, it must be invoked in a context where the MANUAL_ENTRY variable be already defined. --- diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_getEntry.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_getEntry.sh index 565a164..938aa4f 100755 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_getEntry.sh +++ b/Scripts/Functions/Help/Backends/Texinfo/texinfo_getEntry.sh @@ -35,8 +35,8 @@ function texinfo_getEntry { # Redefine locations in order to make this function reusable not # just for action value variable but whatever value passed as # first possitional argument. - if [[ "$1" != '' ]];then - LOCATIONS="$1" + if [[ "$@" != '' ]];then + LOCATIONS="$@" else LOCATIONS="$ACTIONVAL" fi diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_getNode.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_getNode.sh index 6773769..1aa406e 100755 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_getNode.sh +++ b/Scripts/Functions/Help/Backends/Texinfo/texinfo_getNode.sh @@ -25,10 +25,12 @@ function texinfo_getNode { - local NODE=$(echo "$ACTIONVAL" \ - | sed -r "s!^${HOME}/artwork/!!" \ - | sed -r 's!/! !g' | sed -r 's!^[[:space:]]+!!') + local NODE=$(echo "$MANUAL_ENTRY" \ + | sed -r "s!^${MANUAL_BASEDIR}!!" \ + | sed -r 's!/! !g' | sed -r 's!^[[:space:]]+!!' \ + | sed -r "s/\.${FLAG_BACKEND}$//") echo "$NODE" + } diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_searchNode.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_searchNode.sh index 632f696..3302db3 100755 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_searchNode.sh +++ b/Scripts/Functions/Help/Backends/Texinfo/texinfo_searchNode.sh @@ -25,16 +25,29 @@ function texinfo_searchNode { - # Print action message. - cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-reading-line - - # Check entry inside documentation structure. If the entry - # exits use the info reader to open the info file at the - # specified node. Otherwise, ask the user for create it. - if [[ -f "$MANUAL_ENTRY" ]];then - /usr/bin/info --node="Directories $(texinfo_getNode)" --file=${MANUAL_BASEFILE}.info.bz2 - else - ${FLAG_BACKEND}_editEntry - fi + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Define list of documentation entries. + local MANUAL_ENTRY='' + local MANUAL_ENTRIES=$(${FLAG_BACKEND}_getEntry "$@") + + # Loop through manual entries and read related node. + for MANUAL_ENTRY in $MANUAL_ENTRIES;do + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-reading-line + + # Check documentation entry inside documentation structure. If + # the documentation entry exits use the info reader to open + # the info file at the specified node for reading it on the + # terminal. Otherwise, ask the user to create it. + if [[ -f "$MANUAL_ENTRY" ]];then + /usr/bin/info --node="$(${FLAG_BACKEND}_getNode)" --file=${MANUAL_BASEFILE}.info.bz2 + else + ${FLAG_BACKEND}_editEntry + fi + + done } diff --git a/Scripts/Functions/Help/help.sh b/Scripts/Functions/Help/help.sh index c7155b8..d7f32d0 100755 --- a/Scripts/Functions/Help/help.sh +++ b/Scripts/Functions/Help/help.sh @@ -82,8 +82,8 @@ function help { # be executed (e.g., copying, and renaming), functionalities # that need just one action value to be executed (e.g., # documentation reading and edition) and functionalities that - # don't need action value at all (e.g., searching and updating - # output files). This way, the execution of backend + # don't need action value at all (e.g., searching, reading and + # updating output files). This way, the execution of backend # functionalities is splitted here. if [[ $ACTIONNAM =~ "${FLAG_BACKEND}_(copy|rename|delete)Entry" ]];then @@ -109,14 +109,14 @@ function help { # committed up to repository. cli_commitRepoChanges ${MANUAL_CHAPTER_DIR} - elif [[ $ACTIONNAM =~ "${FLAG_BACKEND}_(searchIndex|updateOutputFiles)" ]];then + elif [[ $ACTIONNAM =~ "${FLAG_BACKEND}_(search(Index|Node)|updateOutputFiles)" ]];then # Bring changes from the repository to the working copy. cli_updateRepoChanges ${MANUAL_BASEDIR} - # Execute backend action names that don't need to use any - # action value as reference to do their work. - $ACTIONNAM + # Execute backend action names that might not need any action + # value as reference to do their work. + $ACTIONNAM $@ # Backend action names that don't need to use any action value # as reference to do their work are of one-pass only. They are @@ -138,7 +138,7 @@ function help { MANUAL_CHAPTER_NAME=$(basename "$MANUAL_CHAPTER_DIR") # Define documentation entry. - ENTRY=$(${FLAG_BACKEND}_getEntry $ACTIONVAL) + MANUAL_ENTRY=$(${FLAG_BACKEND}_getEntry $ACTIONVAL) # Syncronize changes between repository and working copy. # At this point, changes in the repository are merged in