| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function cli_exportFunctions { |
| |
| |
| if [[ $# -lt 1 ]];then |
| cli_printMessage "${FUNCNAME}: `gettext "At least one argument must be passed."`" |
| fi |
| |
| |
| local EXPORTID=$1 |
| |
| |
| local LOCATION=${CLI_BASEDIR}/Functions/$(dirname ${EXPORTID}) |
| |
| |
| local SUFFIX=$(basename "$EXPORTID") |
| |
| |
| |
| |
| |
| if [[ $SUFFIX == '' ]];then |
| SUFFIX="${CLI_FUNCNAME}" |
| fi |
| |
| |
| |
| SUFFIX=${SUFFIX}'[[:alpha:]_]*' |
| |
| |
| |
| local PATTERN="^function[[:space:]]+${SUFFIX}[[:space:]]+{$" |
| |
| |
| local FUNCFILE='' |
| local FUNCFILES=$(cli_getFilesList ${LOCATION} --pattern="${SUFFIX}\.sh$" \ |
| --maxdepth='1' --mindepth='1' --type='f') |
| |
| |
| |
| |
| |
| if [[ $FUNCFILES == '' ]];then |
| cli_printMessage "${FUNCNAME}: `gettext "No function file was found."`" --as-error-line |
| fi |
| |
| |
| for FUNCFILE in $FUNCFILES;do |
| |
| |
| cli_checkFiles $FUNCFILE --execution |
| |
| |
| . $FUNCFILE |
| |
| |
| |
| export -f $(egrep "${PATTERN}" ${FUNCFILE} | gawk '{ print $2 }') |
| |
| done |
| |
| } |