chore: move fn-in-array to common-functions
This is used by all generic `set` commands, so we should just make it globally available.
This commit is contained in:
@@ -957,6 +957,16 @@ is_val_in_list() {
|
||||
echo "$val_in_list"
|
||||
}
|
||||
|
||||
fn-in-array() {
|
||||
declare desc="return true if value ($1) is in list (all other arguments)"
|
||||
|
||||
local e
|
||||
for e in "${@:2}"; do
|
||||
[[ "$e" == "$1" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
remove_val_from_list() {
|
||||
declare desc="remove value ($1) from list ($2) separated by delimiter ($3) (delimiter defaults to comma) and return list"
|
||||
local value="$1" list="$2" delimiter="${3:-,}"
|
||||
|
||||
@@ -4,16 +4,6 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
fn-in-array() {
|
||||
declare desc="return true if value ($1) is in list (all other arguments)"
|
||||
|
||||
local e
|
||||
for e in "${@:2}"; do
|
||||
[[ "$e" == "$1" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
git-set-cmd() {
|
||||
declare desc="set or clear a git property for an app"
|
||||
local cmd="git:set" argv=("$@")
|
||||
|
||||
@@ -4,16 +4,6 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
fn-in-array() {
|
||||
declare desc="return true if value ($1) is in list (all other arguments)"
|
||||
|
||||
local e
|
||||
for e in "${@:2}"; do
|
||||
[[ "$e" == "$1" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
scheduler-docker-local-set-cmd() {
|
||||
declare desc="set or clear a scheduler-docker-local property for an app"
|
||||
local cmd="scheduler-docker-local:set" argv=("$@")
|
||||
|
||||
Reference in New Issue
Block a user