Add flag for launching PHP server.

This commit is contained in:
Nicolás A. Ortega Froysa 2025-03-03 13:30:51 +01:00
parent dceea8511f
commit c6cb5baa54

@ -27,12 +27,14 @@ set -euo pipefail
SOURCE_DIR="src" SOURCE_DIR="src"
OUTPUT_DIR="output" OUTPUT_DIR="output"
JOBS=1 JOBS=1
SERVER_FLAG=0
function print_usage() { function print_usage() {
echo "$0 [-o <output dir>] [-s <source dir>] [-j <num>]" echo "$0 [-o <output dir>] [-s <source dir>] [-j <num>]"
echo "$0 -S [-o <output dir>]"
} }
while getopts "o:s:j:h" opt while getopts "o:s:j:Sh" opt
do do
case "$opt" in case "$opt" in
o) o)
@ -50,6 +52,9 @@ do
exit 1 exit 1
fi fi
;; ;;
S)
SERVER_FLAG=1
;;
h) h)
print_usage print_usage
exit exit
@ -61,6 +66,12 @@ do
esac esac
done done
if [ $SERVER_FLAG -eq 1 ]
then
php -S localhost:8080 -t "$OUTPUT_DIR"
exit
fi
# Make these variables visible within parallel # Make these variables visible within parallel
export OUTPUT_DIR export OUTPUT_DIR
export SOURCE_DIR export SOURCE_DIR