Skip to content
This repository was archived by the owner on Aug 10, 2020. It is now read-only.

Commit df3d16c

Browse files
dharminmbtamuli
authored andcommitted
Add 'ee4 list' command (#35)
`ee4 list` will display all sites created using ee4.
1 parent 8b84788 commit df3d16c

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

scripts/ee4

+19-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ help () {
2828

2929
echo -e "\nCommands: "
3030
echo -e "\tcreate\t\t\tCreate new site"
31-
echo -e "\tdb\t\t\tEnter mysql shell"
31+
echo -e "\tlist\t\t\tShow the list of created sites"
32+
echo -e "\tdb\t\t\tEnter mysql shell"
3233
echo -e "\tdelete\t\t\tDelete existing site"
3334
echo -e "\trestart\t\t\tReload configuration for existing site"
3435
echo -e "\twp\t\t\tUse wp-cli with a site"
@@ -59,6 +60,20 @@ createWebroot()
5960
fi
6061
}
6162

63+
# show the list of sites
64+
listSites() {
65+
pushd $WEBROOT > /dev/null 2>&1
66+
SITE_LIST=$(find . -mindepth 2 -maxdepth 2 -name docker-compose.yml | xargs -I{} dirname {} | cut -c3-)
67+
popd > /dev/null 2>&1
68+
if [[ ${#SITE_LIST} -eq 0 ]]; then
69+
echo -e "No sites have been created."
70+
else
71+
echo -e "List of Sites:\n\n$SITE_LIST"
72+
fi
73+
}
74+
75+
76+
6277
singleWordPress() {
6378
createWebroot
6479

@@ -366,6 +381,9 @@ while [[ $# -gt 0 ]]; do
366381
exit 0
367382
fi
368383
;;
384+
'list')
385+
listSites
386+
;;
369387
'delete')
370388
shift
371389
if [[ $# -ne 0 ]]; then

0 commit comments

Comments
 (0)