-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun
More file actions
executable file
·48 lines (38 loc) · 913 Bytes
/
run
File metadata and controls
executable file
·48 lines (38 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
if [ -z "$DEV_ENV" ]; then
echo "env var DEV_ENV needs to be present"
exit 1
fi
# If I just did DEV_ENV=$(pwd) ./run then this is needed for the rest of the scripts
export DEV_ENV="$DEV_ENV"
grep=""
dry_run="0"
while [[ $# -gt 0 ]]; do
echo "ARG: \"$1\""
if [[ "$1" == "--dry" ]]; then
dry_run="1"
else
grep="$1"
fi
shift
done
log() {
if [[ $dry_run == "1" ]]; then
echo "[DRY_RUN]: $1"
else
echo "$1"
fi
}
log "RUN: env: $env -- grep: $grep"
runs_dir=`find $script_dir/runs -mindepth 1 -maxdepth 1 -executable`
for s in $runs_dir; do
if basename $s | grep -vq "$grep"; then
log "grep \"$grep\" filtered out $s"
continue
fi
log "running script: $s"
if [[ $dry_run == "0" ]]; then
$s
fi
done