Move info and list commands into shared functions

Also add better output formatting for both commands
This commit is contained in:
Jose Diaz-Gonzalez
2015-08-29 02:53:06 -04:00
parent cfb31adaa7
commit e90217c9cd
2 changed files with 49 additions and 14 deletions

View File

@@ -177,23 +177,11 @@ case "$1" in
;;
$PLUGIN_COMMAND_PREFIX:info)
[[ -z $2 ]] && dokku_log_fail "Please specify a name for the service"
verify_service_name "$2"
SERVICE="$2"; SERVICE_URL=$(service_url "$SERVICE")
echo " DSN: $SERVICE_URL"
service_info $2
;;
$PLUGIN_COMMAND_PREFIX:list)
CONTAINERS=$(ls $PLUGIN_DATA_ROOT 2> /dev/null)
if [[ -z $CONTAINERS ]]; then
echo "There are no $PLUGIN_SERVICE services"
else
echo "$PLUGIN_SERVICE services:"
for CONTAINER in $CONTAINERS; do
echo " - $CONTAINER"
done
fi
service_list
;;
$PLUGIN_COMMAND_PREFIX:clone)