Skip to content

Commit 9bf9dfa

Browse files
authored
feat: Improve error handling in component control (#6)
Improve error handling in component control
1 parent d83cd80 commit 9bf9dfa

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

stack

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,19 @@ if [ "network" = "${1}" ]; then
8585
exit
8686
fi
8787

88-
COMPONENT=$STACK_PATH/$1
88+
COMPONENT="${STACK_PATH}/${1}"
89+
90+
if [ ! -d "${COMPONENT}" ]; then
91+
printf "\033[0;31mWhoops! Component \"%s\" does not exists.\033[0m\\n" "${COMPONENT}" >&2
92+
93+
exit 1
94+
fi
95+
96+
if [ ! -f "${COMPONENT}/docker-compose.yml" ]; then
97+
printf "\033[0;31mWhoops! Component \"%s\" does not define a \"docker-compose.yml\".\033[0m\\n" "${COMPONENT}" >&2
8998

90-
if [ ! -d $COMPONENT ]; then
91-
echo "\033[0;31mWhoops! Component \"$COMPONENT\" does not exists." >&2
9299
exit 1
93100
fi
94101

95102
CMD=${@:2}
96-
$CONTAINER_COMPOSE -f $COMPONENT/docker-compose.yml ${CMD:-up -d}
103+
$CONTAINER_COMPOSE -f "${COMPONENT}/docker-compose.yml" ${CMD:-up -d}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy