Skip to content

Commit 6500d04

Browse files
authored
Merge pull request #18 from SimplyEdit/feature/show-assets-contents
Add logic to entrypoint to show `assets/` content when mounted.
2 parents 6c757ec + 7946a9c commit 6500d04

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

entrypoint.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,25 @@ defaultCommand() {
5757
}
5858

5959
entrypoint() {
60-
local -r subject="${1-}"
60+
local url subject
61+
readonly subject="${1-}"
6162

6263
# If the first argument is a command that exists, run it
6364
if [ -n "${subject}" ] && [ -n "$(command -v "${subject}" 2> /dev/null)" ]; then
6465
exec "${@}"
6566
else
6667
runChecks
68+
69+
if [ -d /var/www/html/assets ]; then
70+
url="$(guessUrl)"
71+
readonly url
72+
73+
printf "An assets folder has been found and is available at %s\nAvailable assets:\n%s\n%s\n\n" \
74+
"$(tput setaf 7)${url}/assets/$(tput sgr 0)" \
75+
"$(find /var/www/html/assets -maxdepth 1 -type d -exec echo -e "\t{}/" \; | sort)" \
76+
"$(find /var/www/html/assets -maxdepth 1 -type f -exec echo -e "\t{}" \; | sort)"
77+
fi
78+
6779
defaultCommand "${@}"
6880
fi
6981
}

0 commit comments

Comments
 (0)