box-setup/run

44 lines
847 B
Plaintext
Raw Normal View History

2025-01-11 14:55:08 -06:00
#!/bin/zsh
single_script_filter=""
dry="0"
execute() {
log "execute $@"
if [[ $dry != "1" ]]; then
"$@"
fi
}
log() {
if [[ $dry != "1" ]]; then
echo "$@"
else
echo "[DRY RUN]: $@"
fi
}
while [[ $# > 0 ]]; do
if [[ $1 == "--dry" ]]; then
dry="1"
else
single_script_filter="$1"
fi
shift
done
script_dir=$(cd $(dirname "${ZSH_SOURCE[0]}") &> /dev/null && pwd)
log "run // script_dir: $script_dir -- args: $single_script_filter"
cd $script_dir
scripts=(`find ./runs -maxdepth 1 -mindepth 1 -type f`)
2025-01-11 14:55:08 -06:00
for script in $scripts; do
if [[ -x $script ]]; then
if echo "$script" | grep -qv "$single_script_filter"; then
log "filter is $single_script_filter // ignoring: $script"
continue
fi
execute ./$script
fi
done