box-setup/run

34 lines
756 B
Plaintext
Raw Normal View History

2025-01-11 14:55:08 -06:00
#!/bin/zsh
single_script_filter=""
dry="0"
execute() {
log "execute $@"
2025-01-12 14:30:08 -06:00
[[ $dry != "1" ]] && "$@"
2025-01-11 14:55:08 -06:00
}
log() {
2025-01-12 14:30:08 -06:00
[[ $dry != "1" ]] && echo "$@" || echo "[DRY RUN]: $@"
2025-01-11 14:55:08 -06:00
}
while [[ $# > 0 ]]; do
2025-01-12 14:30:08 -06:00
[[ $1 == "--dry" ]] && dry="1" || single_script_filter="$1"
2025-01-11 14:55:08 -06:00
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