Skip to content

Commit 990c584

Browse files
committed
add wpcli helper script
1 parent 6fcd921 commit 990c584

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

wpcli.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
set -o errexit
3+
set -o errtrace
4+
set -o nounset
5+
6+
trap '_es=${?};
7+
printf "${0}: line ${LINENO}: \"${BASH_COMMAND}\"";
8+
printf " exited with a status of ${_es}\n";
9+
exit ${_es}' ERR
10+
11+
source .env
12+
WEB_WP_DIR=/var/www/html
13+
WEB_WP_URL=http://127.0.0.1:8000
14+
15+
16+
#### FUNCTIONS ################################################################
17+
18+
19+
wpcli() {
20+
docker compose run --rm \
21+
--env WP_ADMIN_USER=${WP_ADMIN_USER} \
22+
--env WP_ADMIN_PASS=${WP_ADMIN_PASS} \
23+
--env WP_ADMIN_EMAIL=${WP_ADMIN_EMAIL} \
24+
wordpress-cli \
25+
/usr/local/bin/wp --path=${WEB_WP_DIR} --url=${WEB_WP_URL} "${@}"
26+
}
27+
28+
29+
#### MAIN #####################################################################
30+
31+
32+
wpcli "${@}"

0 commit comments

Comments
 (0)