Files
dotwryn/scwrypts/media/cloud/synchronize.module.zsh
T

44 lines
1.0 KiB
Bash
Raw Normal View History

2025-02-19 21:58:15 -07:00
#####################################################################
REQUIRED_ENV+=(MEDIA_SYNC__TARGETS)
2026-05-05 14:17:43 -06:00
use --group media cloud/synchronize-target
use --group media cloud/zshparse/actions
2025-02-19 21:58:15 -07:00
#####################################################################
${scwryptsmodule}() {
eval "$(USAGE.reset)"
local \
ACTION \
PARSERS=(
media.cloud.zshparse.actions
)
eval "$ZSHPARSEARGS"
##########################################
local TARGET_COUNT=${#MEDIA_SYNC__TARGETS[@]}
local FAILED_COUNT=0
echo.status "starting media ${ACTION}"
local TARGET
for TARGET in ${MEDIA_SYNC__TARGETS[@]}
do
media.cloud.synchronize-target \
--action "${ACTION}" \
--target "${TARGET}" \
|| ((FAILED_COUNT+=1))
done
[[ $FAILED_COUNT -eq 0 ]] \
&& echo.success "successfully completed ${ACTION} for ${TARGET_COUNT} / ${TARGET_COUNT} target(s)" \
|| ERROR "failed ${ACTION} for ${FAILED_COUNT} / ${TARGET_COUNT} target(s)" \
;
}
#####################################################################