Add --copy-demo option to GDExtension setup script

This commit is contained in:
Serhii Snitsaruk 2024-01-16 10:21:51 +01:00
parent aca9784c95
commit 3b82946444
1 changed files with 25 additions and 2 deletions

View File

@ -28,6 +28,8 @@ HIGHLIGHT_COLOR='\033[1;36m' # Light Cyan
NC='\033[0m' # No Color NC='\033[0m' # No Color
ERROR_COLOR="\033[0;31m" # Red ERROR_COLOR="\033[0;31m" # Red
usage() { echo "Usage: $0 [--copy-demo]"; }
msg () { echo -e "$@"; } msg () { echo -e "$@"; }
highlight() { echo -e "${HIGHLIGHT_COLOR}$@${NC}"; } highlight() { echo -e "${HIGHLIGHT_COLOR}$@${NC}"; }
error () { echo -e "${ERROR_COLOR}$@${NC}" >&2; } error () { echo -e "${ERROR_COLOR}$@${NC}" >&2; }
@ -44,6 +46,22 @@ trap exit SIGINT
set -e set -e
copy_demo=0
# Parsing arguments
for i in "$@"
do
case "${i}" in
--copy-demo)
copy_demo=1
shift
;;
*)
usage
;;
esac
done
highlight Setup started. highlight Setup started.
if [ ! -d "${PWD}/godot-cpp/" ]; then if [ ! -d "${PWD}/godot-cpp/" ]; then
@ -62,8 +80,13 @@ else
fi fi
if [ ! -e "${PWD}/demo" ]; then if [ ! -e "${PWD}/demo" ]; then
if [ ${copy_demo} == 1 ]; then
cp -r limboai/demo demo
highlight -- Copied demo.
else
ln -s limboai/demo demo ln -s limboai/demo demo
highlight -- Linked demo project. highlight -- Linked demo project.
fi
else else
highlight -- Skipping \"demo\". File already exists! highlight -- Skipping \"demo\". File already exists!
fi fi