Skip to content

Commit dec88cd

Browse files
committed
wpcli.sh only does one thing so it does not need to be a function
1 parent 86a5f04 commit dec88cd

File tree

1 file changed

+22
-31
lines changed

1 file changed

+22
-31
lines changed

wpcli.sh

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,25 @@ source .env
1414
WEB_WP_DIR=/var/www/html
1515
WEB_WP_URL=http://localhost:8080
1616

17-
18-
#### FUNCTIONS ################################################################
19-
20-
21-
wpcli() {
22-
# Call WP-CLI with appropriate site arguments via Docker
23-
#
24-
# docker compose run redirects the stderr of any invoked executables to
25-
# stdout. The only messages that will appear on stderr are issued by
26-
# docker compose run itself. This appears to be an undocumented "feature":
27-
# https://docs.docker.com/engine/reference/commandline/compose_run/
28-
#
29-
# The "2>/dev/null" below silences the messages from docker compose run.
30-
# For example, the output like the following will not be visible:
31-
# [+] Creating 2/0
32-
# ✔ Container cc-wordpress-db Running 0.0s
33-
# ✔ Container cc-web Running 0.0s
34-
docker compose run --rm \
35-
--env WP_ADMIN_USER="${WP_ADMIN_USER}" \
36-
--env WP_ADMIN_PASS="${WP_ADMIN_PASS}" \
37-
--env WP_ADMIN_EMAIL="${WP_ADMIN_EMAIL}" \
38-
index-wpcli \
39-
/usr/local/bin/wp --path="${WEB_WP_DIR}" --url="${WEB_WP_URL}" \
40-
"${@}" 2>/dev/null
41-
}
42-
43-
44-
#### MAIN #####################################################################
45-
46-
47-
wpcli "${@}"
17+
# Call WP-CLI with appropriate site arguments via Docker
18+
#
19+
# docker compose run redirects the stderr of any invoked executables to
20+
# stdout. The only messages that will appear on stderr are issued by
21+
# docker compose run itself. This appears to be an undocumented "feature":
22+
# https://docs.docker.com/engine/reference/commandline/compose_run/
23+
#
24+
# The "2>/dev/null" below silences the messages from docker compose run.
25+
# For example, the output like the following will not be visible:
26+
# [+] Creating 2/0
27+
# ✔ Container cc-wordpress-db Running 0.0s
28+
# ✔ Container cc-web Running 0.0s
29+
docker compose run --rm \
30+
--env WP_ADMIN_USER="${WP_ADMIN_USER}" \
31+
--env WP_ADMIN_PASS="${WP_ADMIN_PASS}" \
32+
--env WP_ADMIN_EMAIL="${WP_ADMIN_EMAIL}" \
33+
index-wpcli \
34+
/usr/local/bin/wp \
35+
--path="${WEB_WP_DIR}" \
36+
--url="${WEB_WP_URL}" \
37+
"${@}" \
38+
2>/dev/null

0 commit comments

Comments
 (0)