@@ -22,12 +22,13 @@ runAsRoot() {
2222
2323# help provides possible cli arguments
2424help () {
25- echo -e " \nUsage: ee4 [Global Options]"
25+ echo -e " \nUsage: ee4 [Global Options|Commands ]"
2626 echo -e " \nGlobal Options:"
2727 echo -e " \t[--help|-h ]\t\tprints this help"
2828
2929 echo -e " \nCommands: "
3030 echo -e " \tcreate\t\t\tCreate new site"
31+ echo -e " \tdb\t\t\tEnter mysql shell"
3132 echo -e " \tdelete\t\t\tDelete existing site"
3233 echo -e " \trestart\t\t\tReload configuration for existing site"
3334 echo -e " \twp\t\t\tUse wp-cli with a site"
@@ -82,6 +83,7 @@ singleWordPress() {
8283 read -p " Would you like to add domain to /etc/host?(y/N) " -n 1 -r
8384 if [[ $REPLY =~ ^[Yy]$ ]]; then
8485 addHost " $SITE_NAME "
86+ addHost " mail.$SITE_NAME "
8587 fi
8688}
8789
@@ -120,6 +122,7 @@ singleWordPressLetsEncrypt() {
120122 read -p " Would you like to add domain to /etc/host?(y/N) " -n 1 -r
121123 if [[ $REPLY =~ ^[Yy]$ ]]; then
122124 addHost " $SITE_NAME "
125+ addHost " mail.$SITE_NAME "
123126 fi
124127}
125128
@@ -160,6 +163,12 @@ runWpCliCommand() {
160163 popd > /dev/null 2>&1
161164}
162165
166+ useDbShell () {
167+ pushd " $WEBROOT /$SITE_NAME " > /dev/null 2>&1
168+ docker-compose exec db sh -c ' mysql -p$MYSQL_ROOT_PASSWORD'
169+ popd > /dev/null 2>&1
170+ }
171+ 163172removeHost () {
164173 HOSTNAME=1ドル
165174 if [ -n " $( grep $HOSTNAME /etc/hosts) " ]
@@ -376,6 +385,17 @@ while [[ $# -gt 0 ]]; do
376385 exit 0
377386 fi
378387 ;;
388+ ' db' )
389+ shift
390+ if [[ $# -ne 0 ]]; then
391+ export SITE_NAME=" ${1} "
392+ useDbShell
393+ else
394+ echo -e " Please provide name of site."
395+ exit 0
396+ fi
397+ ;;
398+ 379399 ' init' )
380400 shift
381401 if [[ $# -ne 0 ]]; then
0 commit comments