diff --git a/Automation/Modules/Locale/locale.sh b/Automation/Modules/Locale/locale.sh index ddf4d91..bd1819a 100755 --- a/Automation/Modules/Locale/locale.sh +++ b/Automation/Modules/Locale/locale.sh @@ -29,11 +29,16 @@ function locale { local ACTIONS='' - # Define the type of file processing the locale module will do. - # The locale module can perform process just one file (self), all - # the siblings files in the current location (siblings) only, or - # all files in the current location recursively (all). - local LOCALE_FLAG_TYPE='self' + # Define flags controlling locale module's file processing. There + # are three possible values here. Produce localization files for + # the file you provided in the command-line only (default + # behavior). --siblings, to produce localization files for all the + # siblings of the files you provided in the command-line, + # inclusively. --all, this option makes a recursive inside the + # directory of the file you provided as argument to the + # command-line and produces localization files for all files found. + LOCALE_FLAG_SIBLINGS="false" + LOCALE_FLAG_ALL="false" # Interpret arguments and options passed through command-line. locale_getOptions diff --git a/Automation/Modules/Locale/locale_getFilesList.sh b/Automation/Modules/Locale/locale_getFilesList.sh index 62016c1..13fa773 100755 --- a/Automation/Modules/Locale/locale_getFilesList.sh +++ b/Automation/Modules/Locale/locale_getFilesList.sh @@ -31,26 +31,24 @@ function locale_getFilesList { - case ${LOCALE_FLAG_TYPE} in - - 'all' ) - # Process all files in the current location recursively. - tcar_getFilesList ${DIRECTORY} --type="f" \ - --pattern="^.+/.+\.${FILE_EXTENSION}$" - ;; - - 'siblings' ) - # Process all files in the current location only. - tcar_getFilesList ${DIRECTORY} --maxdepth=1 --mindepth=1 \ - --type="f" --pattern="^.+/.+\.${FILE_EXTENSION}$" - ;; - - 'self' | * ) - # Process the file provided only. - tcar_getFilesList ${DIRECTORY} --maxdepth=1 --mindepth=1 \ - --type="f" --pattern="^.+/${FILE_NAME}$" - ;; - - esac + if [[ ${LOCALE_FLAG_SIBLINGS} == 'true' ]];then + + # Process all files in the current location only. + tcar_getFilesList ${DIRECTORY} --maxdepth=1 --mindepth=1 \ + --type="f" --pattern="^.+/.+\.${FILE_EXTENSION}$" + + elif [[ ${LOCALE_FLAG_ALL} == 'true' ]];then + + # Process all files in the current location recursively. + tcar_getFilesList ${DIRECTORY} --type="f" --pattern="^.+/.+\.${FILE_EXTENSION}$" + + + else + + # Process the file provided only. + tcar_getFilesList ${DIRECTORY} --maxdepth=1 --mindepth=1 \ + --type="f" --pattern="^.+/${FILE_NAME}$" + + fi } diff --git a/Automation/Modules/Locale/locale_getOptions.sh b/Automation/Modules/Locale/locale_getOptions.sh index 0da249d..27a1b32 100755 --- a/Automation/Modules/Locale/locale_getOptions.sh +++ b/Automation/Modules/Locale/locale_getOptions.sh @@ -28,10 +28,10 @@ function locale_getOptions { # Define short options we want to support. - local ARGSS="h::,v,f:,t:" + local ARGSS="h::,v,f:,u,e,d,s,a" # Define long options we want to support. - local ARGSL="help::,version,filter:,update,edit,delete,type:" + local ARGSL="help::,version,filter:,update,edit,delete,siblings,all" # Redefine arguments using getopt(1) command parser. tcar_setModuleArguments @@ -57,27 +57,32 @@ function locale_getOptions { shift 2 ;; - --update ) + -u | --update ) ACTIONS="${ACTIONS} update" shift 1 ;; - --edit ) + -e | --edit ) ACTIONS="${ACTIONS} edit" shift 1 ;; - --delete ) + -d | --delete ) ACTIONS="${ACTIONS} delete" shift 1 ;; - -t | --type ) - LOCALE_FLAG_TYPE="${2:-self}" - tcar_checkFiles -m '^(self|siblings|all)$' "${LOCALE_FLAG_TYPE}" - shift 2 + -s | --siblings ) + LOCALE_FLAG_SIBLINGS="true" + LOCALE_FLAG_ALL="false" + shift 1 ;; + -a | --all ) + LOCALE_FLAG_SIBLINGS="false" + LOCALE_FLAG_ALL="true" + shift 1 + ;; -- ) shift 1