Skip to content

Commit 5fa1a54

Browse files
committed
docs
1 parent 3ea25d2 commit 5fa1a54

2 files changed

Lines changed: 27 additions & 4 deletions

File tree

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,22 @@ underscores.
235235
additional_parameters="$additional_parameters --extension=$BACKUP_EXTENSION"
236236
}
237237

238-
### exists (type path)
238+
### exists ([type] path)
239239

240240
Checks if the file $SODA_USER_HOME/$type/$NAMESPACE/$path exists using the namespace of the invoked
241-
task or imported namespace. The file path will be stored in the $FILE variable.
241+
task or imported namespace. The file path will be stored in the $FILE variable. If the *type* is not
242+
passed then **resources** will be used.
242243

243244
exists config "my-config.conf" && {
244245
source $FILE
245246
}
246247

248+
### resource ([type] path)
249+
250+
Returns the file $SODA_USER_HOME/$type/$NAMESPACE/$path using the namespace of the invoked task or
251+
imported namespace without checking if the file exists. If the *type* is not passed then
252+
**resources** will be used.
253+
247254
### invoke (description, function_name)
248255

249256
Invokes the given function based on user choice.
@@ -291,6 +298,19 @@ is in upper case and is already set, the prompt will be skipped.
291298

292299
echo "$SERVER_TYPE: $SERVER_TYPE_label"
293300

301+
### suggest (suggestion_function tasks...)
302+
303+
Maps the given function as the bash completion function to the given tasks.
304+
305+
### when (event_name subscribers...)
306+
307+
Subscribe the given functions to the specified event name. The subscribers should be notified using
308+
the *broadcast* function.
309+
310+
### broadcast (event_name [args...])
311+
312+
Broadcast the event to the subscribers using the given arguments.
313+
294314
## Examples
295315

296316
Check out the **examples** dir for a simple set of tasks that may help you.

scripts/core.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,13 @@ append_to_var() {
284284
set_var "$1" "${content}"
285285
}
286286

287-
[ -z "$LOG_FILE" ] && LOG_FILE=/dev/null
288-
287+
# Returns all namespaces
289288
namespaces() {
290289
import_all_namespaces
291290
echo "$NAMESPACES"
292291
}
293292

293+
# Returns a resource based on the current namespace.
294294
resource() {
295295
local folder="resources"
296296
local filename=""
@@ -303,6 +303,7 @@ resource() {
303303
echo "$SODA_USER_HOME/$folder/$NAMESPACE/$filename"
304304
}
305305

306+
# Checks if a resource exists based on the current namespace.
306307
exists() {
307308
FILE="$(resource "$@")"
308309
if [[ -f "$FILE" ]]; then
@@ -311,3 +312,5 @@ exists() {
311312
return 1
312313
fi
313314
}
315+
316+
[ -z "$LOG_FILE" ] && LOG_FILE=/dev/null

0 commit comments

Comments
 (0)