#!/data/data/com.termux/files/usr/bin/bash set -e ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" source "$ROOT_DIR/lib/common.sh" NAME="" TEMPLATE="hello" while [ $# -gt 0 ]; do case "$1" in --template|-t) if [ $# -lt 2 ] || [ -z "${2:-}" ] || [ "${2#-}" != "$2" ]; then echo "Error: --template requires a value" exit 1 fi TEMPLATE="$2" shift 2 ;; --template=*) TEMPLATE="${1#*=}" shift ;; -*) echo "Unknown option: $1" exit 1 ;; *) if [ -z "$NAME" ]; then NAME="$1" else echo "Unknown argument: $1" exit 1 fi shift ;; esac done if [ -z "$NAME" ]; then echo "Usage: android-builder new MyApp [--template hello|empty]" exit 1 fi case "$TEMPLATE" in hello) create_base_project "$NAME" "Hello, World!" ;; empty) create_base_project "$NAME" "" ;; *) echo "Unknown template: $TEMPLATE" echo "Available templates: hello, empty" exit 1 ;; esac