#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/apps/functions"

apps_destroy_cmd() {
  declare desc="destroys an app"
  local cmd="apps:destroy"
  [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
  [[ "$2" == "tls" ]] && dokku_log_fail "Unable to destroy tls directory"
  [[ "$3" == "force" ]] && export DOKKU_APPS_FORCE_DELETE=1
  local APP="$2"
  apps_destroy "$APP"
}

apps_destroy_cmd "$@"
