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.

63 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] PAD_ID"
  9. help="
  10. USAGE:
  11. $usage
  12. DESCRIPTION:
  13. Delete pad identified by PAD_ID
  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. [ -z "$PAD_ID" ] && { PAD_ID="$1" ; shift ; continue ; }
  30. err "Unexpected positional argument '$1'"
  31. print_usage >&2
  32. exit 1
  33. ;;
  34. esac
  35. shift
  36. done
  37. . "$CHARM_PATH"/lib/common
  38. set -e
  39. if [ -z "$PAD_ID" ]; then
  40. err "Missing first positional argument PAD_ID to specify which pad to drop."
  41. print_usage
  42. exit 1
  43. fi
  44. etherpad:api:init || exit 1
  45. etherpad:api deletePad --data-urlencode "padID=${PAD_ID}" >/dev/null || exit 1