File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -186,10 +186,15 @@ affects the bash completion
186186usage
187187* ** SODA_DEFAULT_RESOURCE_DIR** - the default directory to search for resources (defaults to
188188* resources* )
189+ * ** SODA_TASK_OPTIONAL_PREFIX** - the optional prefix to map a task function (defaults to * do_ * )
189190
190191Remember that parameters are converted to upper case, so you can call ` soda --log-file=path/to/file `
191192and the * $LOG_FILE* variable will be set to that value.
192193
194+ The parameter ** SODA_TASK_OPTIONAL_PREFIX** is very usefull in case of tasks with a name already
195+ defined by another function or name (* kill* or * status* , for example). To avoid conflicts, prefix
196+ the function with the SODA_TASK_OPTIONAL_PREFIX value (* do_kill* , * do_status* , ...).
197+
193198## Logging
194199
195200To log something, just call the ** log** function passing the category and message (optionally, you
Original file line number Diff line number Diff line change 2424SODA_NAMESPACE_DELIMITER=.
2525SODA_TASK_BASH_COMPLETION_SUFFIX=_bash_completion
2626SODA_DEFAULT_RESOURCE_DIR=resources
27+ SODA_TASK_OPTIONAL_PREFIX=do_
Original file line number Diff line number Diff line change @@ -128,17 +128,21 @@ execute() {
128128}
129129
130130#
131- # Calls the given function . Using this method will broadcast events around the call:
131+ # Calls the given task . Using this method will broadcast events around the call:
132132#
133- # ${FUNCTION_NAME }-start: after call
134- # ${FUNCTION_NAME }-finish: before call
133+ # ${TASK_NAME }-start: after call
134+ # ${TASK_NAME }-finish: before call
135135#
136- # This method is intented to use for task call
136+ # ** This method is intented to use for task call **
137137#
138138call () {
139139 local function_name=" $( build_name $1 ) "
140+ local task_name=" $1 "
140141 shift
141- broadcast " ${function_name} -start"
142+ broadcast " ${task_name} -start"
143+ if [[ $( type -t ${SODA_TASK_OPTIONAL_PREFIX}${function_name} ) ]]; then
144+ function_name=" ${SODA_TASK_OPTIONAL_PREFIX}${function_name} "
145+ fi
142146 $function_name " $@ "
143- broadcast " ${function_name } -finish"
147+ broadcast " ${task_name } -finish"
144148}
You can’t perform that action at this time.
0 commit comments