1
1
#! /bin/bash
2
+ #
3
+ # Notes:
4
+ # - docker compose run redirects the stderr of any invoked executables to
5
+ # stdout. The only messages that will appear on stderr are issued by docker
6
+ # compose run itself. This appears to be an undocumented "feature":
7
+ # https://docs.docker.com/engine/reference/commandline/compose_run/
8
+ #
9
+ # The "2>/dev/null" below silences the messages from docker compose run.
10
+ # For example, the output like the following will not be visible:
11
+ # [+] Creating 2/0
12
+ # ✔ Container cc-wordpress-db Running 0.0s
13
+ # ✔ Container cc-web Running 0.0s
14
+ #
2
15
set -o errexit
3
16
set -o errtrace
4
17
set -o nounset
5
18
19
+ # shellcheck disable=SC2154
6
20
trap ' _es=${?};
7
21
printf "${0}: line ${LINENO}: \"${BASH_COMMAND}\"";
8
22
printf " exited with a status of ${_es}\n";
9
23
exit ${_es}' ERR
10
24
25
+ # shellcheck disable=SC1091
11
26
source .env
12
27
ACTIVATE_PLUGINS='
13
28
acf-menu-chooser
@@ -61,7 +76,7 @@ activate_themes() {
61
76
62
77
composer_install () {
63
78
header ' Composer install'
64
- docker compose run --rm composer install
79
+ docker compose run --rm composer install 2> /dev/null
65
80
echo
66
81
}
67
82
@@ -80,7 +95,7 @@ enable_permalinks() {
80
95
81
96
error_exit () {
82
97
# Echo error message and exit with error
83
- echo -e " \033[31mERROR:\033[0m ${@ } " 1>&2
98
+ echo -e " \033[31mERROR:\033[0m ${* } " 1>&2
84
99
exit 1
85
100
}
86
101
@@ -123,7 +138,7 @@ install_wordpress() {
123
138
124
139
utils_info () {
125
140
header ' Utilities info'
126
- docker compose run --rm composer --version
141
+ docker compose run --rm composer --version 2> /dev/null
127
142
wpcli --info
128
143
echo
129
144
}
@@ -150,12 +165,14 @@ wordpress_status() {
150
165
151
166
152
167
wpcli () {
168
+ # Call WP-CLI with appropriate site arguments via Docker
153
169
docker compose run --rm \
154
- --env WP_ADMIN_USER=${WP_ADMIN_USER} \
155
- --env WP_ADMIN_PASS=${WP_ADMIN_PASS} \
156
- --env WP_ADMIN_EMAIL=${WP_ADMIN_EMAIL} \
170
+ --env WP_ADMIN_USER=" ${WP_ADMIN_USER} " \
171
+ --env WP_ADMIN_PASS=" ${WP_ADMIN_PASS} " \
172
+ --env WP_ADMIN_EMAIL=" ${WP_ADMIN_EMAIL} " \
157
173
wordpress-cli \
158
- /usr/local/bin/wp --path=${WEB_WP_DIR} --url=${WEB_WP_URL} " ${@ } "
174
+ /usr/local/bin/wp --path=" ${WEB_WP_DIR} " --url=" ${WEB_WP_URL} " \
175
+ " ${@ } " 2> /dev/null
159
176
}
160
177
161
178
0 commit comments