#!/usr/bin/env bash EXISTING=$(ls -1) if [[ -n "$EXISTING" ]]; then exit fi echo "Lets start a new project here ..." echo "" echo "Options to start:" echo " 1 LakeDrops Drupal 8 project template" echo " 2 Drupal's community project template" echo " 3 Existing git repository" echo "" echo "" function truncateCurrentDirectory { if [[ -f ".env" ]]; then export $(cat .env | xargs) > /dev/null 2>&1 fi rm .* > /dev/null 2>&1 } function create { truncateCurrentDirectory composer create-project ${PROJECT} . --no-interaction } while true; do read -p "Choose an option: " OPTION case ${OPTION} in 1 ) PROJECT="lakedrops/d8-project" create break ;; 2 ) PROJECT="drupal-composer/drupal-project:8.x-dev" create break ;; 3 ) read -p "Repository URL: " REPOSITORY if [[ -n "${REPOSITORY}" ]]; then truncateCurrentDirectory git clone ${REPOSITORY} . composer update break fi ;; * ) echo "Please try again." ;; esac done /usr/bin/fish