#!/bin/bash ## compose: no-hooks if [ -z "$SERVICE_DATASTORE" ]; then echo "This script is meant to be run through 'compose' to work properly." >&2 exit 1 fi version=0.1 usage="$exname [-h|--help]" help=" USAGE: $usage DESCRIPTION: Lists all pads. EXAMPLES: $exname list " while [ "$1" ]; do case "$1" in "--help"|"-h") print_help >&2 exit 0 ;; --*|-*) err "Unexpected optional argument '$1'" print_usage >&2 exit 1 ;; *) err "Unexpected positional argument '$1'" print_usage >&2 exit 1 ;; esac shift done . "$CHARM_PATH"/lib/common set -e etherpad:api:init || exit 1 out=$(etherpad:api listAllPads) || exit 1 if ! pads=$(e "$out" | jq -r ".padIDs[]"); then err "Unexpected format from call to listAllPads API endpoint for ${DARKYELLOW}${SERVICE_NAME}${NORMAL}." # echo "$out" | prefix " | " >&2 exit 1 fi e "$pads" echo