Skip to content

Commit 6cc1cd0

Browse files
committed
Change -c|--clean to -f|--fresh & fixes
1 parent e5a4652 commit 6cc1cd0

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ $ bash benchmark.sh
138138
## Commands
139139

140140
```bash
141+
# some options
142+
# use bash benchmark.sh --help
143+
$ bash benchmark.sh -f -rapache -rnginx -t ...
144+
141145
# run composer update for frameworks
142146
$ bash update.sh
143147

@@ -157,6 +161,7 @@ To specify frameworks, put them with `-t ...` after each command:
157161

158162
```bash
159163
# supported for `setup.sh`, `benchmark.sh`, `update.sh`, `clean.sh`, and `clear-cache.sh`
164+
# not required to put / after the name, just use the tab in your terminal
160165
# bash benchmarks.sh --help -h
161166
$ bash benchmark.sh -t laravel-10.0/ slim-4.11/ ...
162167
...

base/hello_world.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ do
5454
# continue
5555
# fi
5656

57-
if [ "$param_clean" = true ]; then
57+
if [ "$param_fresh" = true ]; then
5858
bash clean.sh
5959
bash setup.sh -t "$fw"
6060
fi

base/option_target.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function showHelp()
99
{
1010
cat << HEREDOC
1111
12-
Usage: bash check.sh [-t pure-php/ slim-*]
12+
Usage: bash check.sh [-t pure-php slim-*]
1313
1414
Optional Arguments:
1515
-h, --help Show this help message and exit
@@ -30,6 +30,7 @@ IFS=';'
3030
params=(`php ./libs/strreplace.php " -" ";-" " ${paramsin}"`)
3131
IFS=$oldIFS
3232

33+
init_benchmark=true
3334
for option in "${params[@]}"
3435
do
3536
case "$option" in
@@ -41,13 +42,19 @@ do
4142
fi
4243
;;
4344
-h|--help)
45+
init_benchmark=false
4446
showHelp;
4547
;;
4648
""|" ")
4749
;;
4850
*)
51+
init_benchmark=false
4952
echo "\"${option}\" not available"
5053
exit 1
5154
;;
5255
esac
53-
done
56+
done
57+
58+
if [ "$init_benchmark" = false ]; then
59+
exit 1
60+
fi

benchmark.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ function showHelp()
2121
{
2222
cat << HEREDOC
2323
24-
Usage: bash benchmark.sh [-c] [-rapache] [-t pure-php slim]
24+
Usage: bash benchmark.sh [-f] [-rapache] [-t pure-php slim]
2525
2626
Optional Arguments:
27-
-c, --clean Clean all frameworks and install the target framework -fresh install- before benchmark.
27+
-f, --fresh Clean all frameworks and install the target framework -fresh install- before benchmark.
2828
-h, --help Show this help message and exit
2929
-rapache, --restart-apache Restart apache "sudo systemctl restart apache2" before each benchmark.
3030
-rnginx, --restart-nginx Restart apache "sudo systemctl restart nginx" before each benchmark.
@@ -35,7 +35,7 @@ HEREDOC
3535
}
3636

3737
export param_targets="$frameworks_list"
38-
export param_clean=false
38+
export param_fresh=false
3939
export param_restart_apache=false
4040
export param_restart_nginx=false
4141

@@ -48,11 +48,12 @@ IFS=';'
4848
params=(`php ./libs/strreplace.php " -" ";-" " ${paramsin}"`)
4949
IFS=$oldIFS
5050

51+
init_benchmark=true
5152
for option in "${params[@]}"
5253
do
5354
case "$option" in
54-
-c|--clean)
55-
param_clean=true
55+
-f|--fresh)
56+
param_fresh=true
5657
;;
5758
-rapache|--restart-apache)
5859
param_restart_apache=true
@@ -68,18 +69,21 @@ do
6869
fi
6970
;;
7071
-h|--help)
72+
init_benchmark=false
7173
showHelp;
7274
;;
7375
""|" ")
7476
;;
7577
*)
78+
init_benchmark=false
7679
echo "\"${option}\" not available"
7780
exit 1
7881
;;
7982
esac
8083
done
8184

82-
sh ./base/hello_world.sh
83-
84-
echo ''
85-
php ./libs/show_results_table.php
85+
if [ "$init_benchmark" = true ]; then
86+
sh ./base/hello_world.sh
87+
echo ''
88+
php ./libs/show_results_table.php
89+
fi

0 commit comments

Comments
 (0)