forked from ThePrimeagen/dev-prod-2-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·89 lines (77 loc) · 1.78 KB
/
run
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bash
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
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 echo "$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
#remove_files() {
# pushd $1
# (
# configs=`find . -mindepth 1 -maxdepth 1 -type d`
# if [[ $dry_run == "1" ]]; then
# echo "[DRY_RUN]: removing: $configs"
# else
# echo "removing: $configs"
# fi
#
# for c in $configs; do
# directory=${2%/}/${c}
# if [[ $dry_run == "1" ]]; then
# echo "[DRY_RUN]: removing: $directory"
# else
# echo " removing: $directory"
# rm -rf $directory
# fi
# done
#
# if [[ $dry_run == "1" ]]; then
# echo "copying env: $2"
# else
# echo "copying env: $2"
# cp -r ./* $2
# fi
# )
# popd
#}
#run_env() {
# pushd $script_dir
# echo "removing ~config"
# remove_files env/.config $XDG_CONFIG_HOME
#
# echo "removing ~local"
# remove_files env/.local $HOME/.local
#
# echo "copying zsh"
# if [[ $dry_run == "0" ]]; then
# cp $script_dir/env/.zshrc ~/.zshrc
# cp $script_dir/env/.zsh_profile ~/.zsh_profile
# fi
#
# popd
#}