From a317149daea02107d2026c333b178fc44c4d7438 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Nov 04 2010 13:18:31 +0000 Subject: Update cli_getRepoName function for consistency with cli_checkFiles function. --- diff --git a/Scripts/Bash/Functions/Render/render_checkConfig.sh b/Scripts/Bash/Functions/Render/render_checkConfig.sh index d3dab89..3d58f3b 100755 --- a/Scripts/Bash/Functions/Render/render_checkConfig.sh +++ b/Scripts/Bash/Functions/Render/render_checkConfig.sh @@ -81,7 +81,7 @@ function render_checkConfig { # Re-define theme model value using repository directory name # convenction. - THEMEMODEL=$(cli_getRepoName 'd' "$THEMEMODEL") + THEMEMODEL=$(cli_getRepoName "$THEMEMODEL" 'd') # Check theme model name. if [[ $THEMEMODEL == '' ]] \ diff --git a/Scripts/Bash/Functions/Render/render_doIdentityGroupByType.sh b/Scripts/Bash/Functions/Render/render_doIdentityGroupByType.sh index 4c56666..5c33b4f 100755 --- a/Scripts/Bash/Functions/Render/render_doIdentityGroupByType.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentityGroupByType.sh @@ -102,7 +102,7 @@ function render_doIdentityGroupByType { PATTERNS[0]=$(echo "$FORMATS" | sed 's! !|!g') # Define pattern for directories. - PATTERNS[1]=$(echo $(for i in $FORMATS; do cli_getRepoName 'd' $i; done) | sed 's! !|!g') + PATTERNS[1]=$(echo $(for i in $FORMATS; do cli_getRepoName $i 'd'; done) | sed 's! !|!g') # Define pattern for path. The path pattern combines both file # extension and directories patterns. This pattern is what we @@ -136,7 +136,7 @@ function render_doIdentityGroupByType { # Redifine file path to add file type directory SOURCE=${FILE}.${FORMAT} - TARGET=$(dirname $FILE)/$(cli_getRepoName 'd' "$FORMAT") + TARGET=$(dirname $FILE)/$(cli_getRepoName "$FORMAT" 'd') # Check existence of source file. cli_checkFiles $SOURCE 'f' '' '--quiet' diff --git a/Scripts/Bash/Functions/cli.sh b/Scripts/Bash/Functions/cli.sh index 4869d72..9a761e5 100644 --- a/Scripts/Bash/Functions/cli.sh +++ b/Scripts/Bash/Functions/cli.sh @@ -29,7 +29,7 @@ function cli { # Define action variable using first argument (lowercase) value. - ACTION=$(cli_getRepoName 'f' "$1") + ACTION=$(cli_getRepoName "$1" 'f') # Define option name (OPTIONNAM) and option value (OPTIONVAL) # variables passed as second argument to the command line diff --git a/Scripts/Bash/Functions/cli_getActions.sh b/Scripts/Bash/Functions/cli_getActions.sh index 3eb311d..c02f16a 100644 --- a/Scripts/Bash/Functions/cli_getActions.sh +++ b/Scripts/Bash/Functions/cli_getActions.sh @@ -38,7 +38,7 @@ function cli_getActions { REPOFUNDIR=/home/centos/artwork/trunk/Scripts/Bash/Functions # Define action directory. - ACTIONDIR=$(cli_getRepoName 'd' $ACTION) + ACTIONDIR=$(cli_getRepoName $ACTION 'd') # Define action file name. ACTIONSCRIPT=${REPOFUNDIR}/${ACTIONDIR}/${ACTION}.sh diff --git a/Scripts/Bash/Functions/cli_getRepoName.sh b/Scripts/Bash/Functions/cli_getRepoName.sh index 92af242..312584b 100755 --- a/Scripts/Bash/Functions/cli_getRepoName.sh +++ b/Scripts/Bash/Functions/cli_getRepoName.sh @@ -29,18 +29,18 @@ function cli_getRepoName { - local ID="$1" - local NAME="$2" + local NAME="$1" + local TYPE="$2" - case $ID in + case $TYPE in - F | f | File | file ) + f | regular-file ) NAME=$(echo $NAME \ | tr -s ' ' '_' \ | tr '[:upper:]' '[:lower:]') ;; - D | d | Dir | dir | Directory | directory ) + d | directory ) NAME=$(echo $NAME \ | tr -s ' ' '_' \ | tr '[:upper:]' '[:lower:]' \