From e1d1685f4fd0538455c9f81efdcc5014e498e462 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Dec 13 2013 16:55:19 +0000 Subject: Change tcar_getPathComponent option parsing, from getopt to getopts. - Previously, tcar_getPathComponent was using getopt to parse options passed through positional parameters. This required to call the tcar_setModuleArguments function which has been modified for module-specific environment contexts and cannot process options passed to functions. In order to interpret options passed to tcar_getPathComponent, this update changes tcar_getPathComponent option parsing from getopt to getopts. --- diff --git a/tcar-scripts/tcar_getPathComponent.sh b/tcar-scripts/tcar_getPathComponent.sh index d006768..a87dbf8 100755 --- a/tcar-scripts/tcar_getPathComponent.sh +++ b/tcar-scripts/tcar_getPathComponent.sh @@ -30,12 +30,6 @@ function tcar_getPathComponent { - # Define short options. - local ARGSS='' - - # Define long options. - local ARGSL='release,release-major,release-minor,release-pattern,architecture,architecture-pattern,motif,motif-name,motif-version,motif-pattern,repo-dir' - # Define release pattern. local VERSION="(([[:digit:]]+)(\.([[:digit:]]+))?)" @@ -47,21 +41,12 @@ function tcar_getPathComponent { # motif component inside the path strings. local THEME_MOTIF="Themes/Motifs/(([[:alnum:]]+)/(${VERSION}))" - # Initialize arguments with an empty value and set it as local - # variable to this function scope. Doing this is very important to - # avoid any clash with higher execution environments. - local TCAR_MODULE_ARGUMENT='' - - # Process all arguments currently available in this function - # environment. If either ARGSS or ARGSL local variables have been - # defined, argument processing goes through getopt for validation. - tcar_setModuleArguments "${@}" - - # Redefine positional parameters using TCAR_MODULE_ARGUMENT variable. - eval set -- "${TCAR_MODULE_ARGUMENT}" - # Define location we want to apply verifications to. - local LOCATION=$(echo ${@} | sed -r 's!^.*--[[:space:]](.+)$!\1!') + local LOCATION=${1} + + # Remove location from positional parameters, so only the option + # remain. + shift 1 # Look for options passed through positional parameters. while true;do