fork 0k-charms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

64 lines
1.0 KiB

#!/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