diff --git a/Scripts/Bash/Functions/Help/help_getEntries.sh b/Scripts/Bash/Functions/Help/help_getEntries.sh index 8b17f48..1d24a7c 100755 --- a/Scripts/Bash/Functions/Help/help_getEntries.sh +++ b/Scripts/Bash/Functions/Help/help_getEntries.sh @@ -35,92 +35,77 @@ function help_getEntries { # only non-option arguments remain in it. eval set -- "$ARGUMENTS" - if [[ $@ == '' ]];then - - # Define default documentation entry. This happens when - # non-option arguments aren't provided to centos-art.sh - # script. Default documentation entry defined here points to - # manual's main definition file, so only the manual's self - # name and manual's directory name need to be defined here. - MANUAL_SLFN[${MANUAL_DOCENTRY_COUNT}]='tcar-fs' - MANUAL_DIRN[${MANUAL_DOCENTRY_COUNT}]='Tcar-fs' - MANUAL_DOCENTRY_COUNT=$(($MANUAL_DOCENTRY_COUNT + 1)) - - else + # Retrive documentation entries passed to `centos-art.sh' script + # as non-option arguments and store them in array variables in + # order to describe their parts (e.g., manual name, chapter name + # and section name) that way. Documentation entries passed as + # non-opiton arguments must be written either in + # `MANUAL:PART:CHAPTER:SECTION' or `path/to/dir' formats in order + # to be processed correctly here. Empty spaces are not permitted. + # To separate words, use the minus sign (e.g., hello-world) or + # cammel case (e.g., HelloWorld). + for MANUAL_DOCENTRY in $@;do - # Retrive documentation entries passed to `centos-art.sh' - # script as non-option arguments and store them in array - # variables in order to describe their parts (e.g., manual - # name, chapter name and section name) that way. - # Documentation entries passed as non-opiton arguments must be - # written either in `MANUAL:PART:CHAPTER:SECTION' or - # `path/to/dir' formats in order to be processed correctly - # here. Empty spaces are not permitted. To separate words, use - # the minus sign (e.g., hello-world) or cammel case (e.g., - # HelloWorld). - for MANUAL_DOCENTRY in $@;do + if [[ ${MANUAL_DOCENTRY} =~ '^[[:alpha:]][[:alnum:]-]+:([[:alnum:]-]*:){2}[[:alnum:]/]*' ]];then - if [[ ${MANUAL_DOCENTRY} =~ '^([A-Za-z0-9-]+)(:[A-Za-z0-9-]*){0,3}$' ]];then + # When `MANUAL:PART:CHAPTER:SECTION' is used as format to + # documentation entry, you can specify the manual, chapter + # and section where documentation actions will take place + # on. - # When `MANUAL:PART:CHAPTER:SECTION' is used as format - # to documentation entry, you can specify the manual, - # chapter and section where documentation actions will - # take place on. + # Manual self name. + MANUAL_SLFN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $1 }') -f \ + | tr '[:upper:]' '[:lower:]') - # Manual self name. - MANUAL_SLFN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ - $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $1 }') -f \ - | tr '[:upper:]' '[:lower:]') + # Manual self directory name. + MANUAL_DIRN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $1 }') -d ) - # Manual self directory name. - MANUAL_DIRN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ - $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $1 }') -d ) + # Manual part name. + MANUAL_PART[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $2 }') -d ) - # Manual part name. - MANUAL_PART[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ - $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $2 }') -d ) + # Manual chapter name. + MANUAL_CHAP[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $3 }') -d ) - # Manual chapter name. - MANUAL_CHAP[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ - $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $3 }') -d ) + # Manual section name. + MANUAL_SECT[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $4 }') -f ) - # Manual section name. - MANUAL_SECT[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ - $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN{ FS=":" } { print $4 }') -f ) + elif [[ ${MANUAL_DOCENTRY} =~ '^(trunk|branches|tags)' ]];then - elif [[ ${MANUAL_DOCENTRY} =~ '^(trunk|branches|tags)' ]];then + # When `path/to/dir' is used as format to documentation + # entry, you cannot specify the manual chapter or section + # where documentation actions will take place on. Instead, + # they are predefined for you here. Use this format to + # document directories inside your working copy. - # When `path/to/dir' is used as format to - # documentation entry, you cannot specify the manual - # chapter or section where documentation actions will - # take place on. Instead, they are predefined for you - # here. Use this format to document directories inside - # your working copy. + # Manual's self name. + MANUAL_SLFN[${MANUAL_DOCENTRY_COUNT}]='tcar-fs' - # Manual's self name. - MANUAL_SLFN[${MANUAL_DOCENTRY_COUNT}]='tcar-fs' + # Manual's self directory name. + MANUAL_DIRN[${MANUAL_DOCENTRY_COUNT}]='Tcar-fs' - # Manual's self directory name. - MANUAL_DIRN[${MANUAL_DOCENTRY_COUNT}]='Tcar-fs' + # Manual's chapter name. + MANUAL_CHAP[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN { FS="/" }; { if ( NF >= 1 ) print $1 }' ) -d ) - # Manual's chapter name. - MANUAL_CHAP[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ - $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN { FS="/" }; { if ( NF >= 1 ) print $1 }' ) -d ) + # Manual's section name. + MANUAL_SECT[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN { FS="/" }; { if ( NF >= 2 ) print $0 }' \ + | cut -d/ -f2- | tr '/' '-') -f ) - # Manual's section name. - MANUAL_SECT[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ - $(echo "${MANUAL_DOCENTRY}" | gawk 'BEGIN { FS="/" }; { if ( NF >= 2 ) print $0 }' \ - | cut -d/ -f2- | tr '/' '-') -f ) + else - else - cli_printMessage "`gettext "The documentation entry provided isn't supported."`" --as-error-line - fi + cli_printMessage "`gettext "The documentation entry provided isn't supported."`" --as-error-line - # Increment counting of non-option arguments. - MANUAL_DOCENTRY_COUNT=$(($MANUAL_DOCENTRY_COUNT + 1)) + fi - done + # Increment counting of non-option arguments. + MANUAL_DOCENTRY_COUNT=$(($MANUAL_DOCENTRY_COUNT + 1)) - fi + done }