Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit 4586faa

Browse files
committed
Reduced output.
1 parent 402f855 commit 4586faa

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

cli/commands/container

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ error_cai()
114114
error_car()
115115
{
116116
RETURN="$?"
117-
echo "$ECHO_PREFIX ${YELLOW}Warning ${CYAN}${IMAGE}${YELLOW} container already running.${RESET}"
118-
echo "Look for possible fixes here: ${CYAN}http://wplib.github.io/wplib-box/errors/W017/${RESET}"
117+
echo "$ECHO_PREFIX ${GREEN}Container already running: ${CYAN}${IMAGE}${RESET}"
118+
# echo "Look for possible fixes here: ${CYAN}http://wplib.github.io/wplib-box/errors/W017/${RESET}"
119119
return $RETURN
120120
}
121121

122122
error_cas()
123123
{
124124
RETURN="$?"
125-
echo "$ECHO_PREFIX ${CYAN}${IMAGE}${GREEN} container already stopped.${RESET}"
125+
echo "$ECHO_PREFIX ${GREEN}Container already stopped: ${CYAN}${IMAGE}${RESET}"
126126
# echo "Look for possible fixes here: ${CYAN}http://wplib.github.io/wplib-box/errors/W018/${RESET}"
127127
return $RETURN
128128
}
@@ -452,15 +452,20 @@ d_start()
452452
then
453453
error_car
454454
else
455-
echo "$ECHO_PREFIX ${GREEN}Starting container: ${CYAN}${IMAGE}${RESET}"
456-
docker start ${CONTAINER_NAME}
455+
echo -n "$ECHO_PREFIX ${GREEN}Starting container: ${CYAN}${IMAGE}${RESET} ... "
456+
TEMPFILE="`mktemp /tmp/box-container.XXX`"
457+
docker start ${CONTAINER_NAME} >& $TEMPFILE
458+
457459
if [ "$?" == "1" ]
458460
then
459461
echo "${RED}NOT OK${RESET}"
460462
error_ccbs
463+
cat $TEMPFILE
461464
else
462465
echo "${GREEN}OK${RESET}"
463466
fi
467+
468+
rm -f $TEMPFILE
464469
fi
465470
;;
466471

@@ -476,7 +481,6 @@ d_start()
476481
error_pns
477482
;;
478483
esac
479-
echo ""
480484

481485
return $RETURN
482486
}
@@ -492,15 +496,20 @@ d_stop()
492496
then
493497
error_cas
494498
else
495-
echo "$ECHO_PREFIX ${GREEN}Stopping container: ${CYAN}${IMAGE}${RESET}"
496-
docker stop ${CONTAINER_NAME}
499+
echo -n "$ECHO_PREFIX ${GREEN}Stopping container: ${CYAN}${IMAGE}${RESET} ... "
500+
TEMPFILE="`mktemp /tmp/box-container.XXX`"
501+
docker stop ${CONTAINER_NAME} >& $TEMPFILE
502+
497503
if [ "$?" == "1" ]
498504
then
499505
echo "${RED}NOT OK${RESET}"
500506
error_ccbd
507+
cat $TEMPFILE
501508
else
502509
echo "${GREEN}OK${RESET}"
503510
fi
511+
512+
rm -f $TEMPFILE
504513
fi
505514
;;
506515

@@ -516,22 +525,26 @@ d_stop()
516525
error_pns
517526
;;
518527
esac
519-
echo ""
520528

521529
return $RETURN
522530
}
523531

524532

525533
d_shutdown()
526534
{
527-
echo "$ECHO_PREFIX ${GREEN}Stopping all WPLLib containers${RESET}"
528-
docker container ls -qaf "label=container.project=${DEFAULT_PROJECT}" | xargs docker stop
535+
echo "$ECHO_PREFIX ${GREEN}Stopping all WPLLib containers${RESET} ... "
536+
TEMPFILE="`mktemp /tmp/box-container.XXX`"
537+
docker container ls -qaf "label=container.project=${DEFAULT_PROJECT}" | xargs docker stop >& $TEMPFILE
529538
if [ "$?" == "1" ]
530539
then
540+
echo "${RED}NOT OK${RESET}"
531541
error_csac
542+
cat $TEMPFILE
532543
return 1
533544
fi
534545

546+
rm -f $TEMPFILE
547+
535548
return $RETURN_OK
536549
}
537550

0 commit comments

Comments
 (0)