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

cmd-ps-restart-policy() {
  declare desc="shows the restart-policy for an app"
  declare cmd="ps:restart-policy"
  [[ "$1" == "$cmd" ]] && shift 1
  declare APP="$1"
  local passed_phases="deploy"

  [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
  verify_app_name "$APP"

  dokku_log_info2_quiet "$APP restart-policy:"
  get_restart_policies "$(get_phase_file_path "$passed_phases")"
}

cmd-ps-restart-policy "$@"
