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

  1. #!/bin/bash
  2. ## compose: no-hooks
  3. if [ -z "$SERVICE_DATASTORE" ]; then
  4. echo "This script is meant to be run through 'compose' to work properly." >&2
  5. exit 1
  6. fi
  7. version=0.1
  8. usage="$exname [-h|--help]"
  9. help="
  10. USAGE:
  11. $usage
  12. DESCRIPTION:
  13. Lists all pads.
  14. EXAMPLES:
  15. $exname list
  16. "
  17. while [ "$1" ]; do
  18. case "$1" in
  19. "--help"|"-h")
  20. print_help >&2
  21. exit 0
  22. ;;
  23. --*|-*)
  24. err "Unexpected optional argument '$1'"
  25. print_usage >&2
  26. exit 1
  27. ;;
  28. *)
  29. err "Unexpected positional argument '$1'"
  30. print_usage >&2
  31. exit 1
  32. ;;
  33. esac
  34. shift
  35. done
  36. . "$CHARM_PATH"/lib/common
  37. set -e
  38. etherpad:api:init || exit 1
  39. out=$(etherpad:api listAllPads) || exit 1
  40. if ! pads=$(e "$out" | jq -r ".padIDs[]"); then
  41. err "Unexpected format from call to listAllPads API endpoint for ${DARKYELLOW}${SERVICE_NAME}${NORMAL}."
  42. # echo "$out" | prefix " | " >&2
  43. exit 1
  44. fi
  45. e "$pads"
  46. echo