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

domains_add_cmd() {
  declare desc="adds domain to app via command line"
  local cmd="domains:add"
  [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"

  if [[ -z "${*:3}" ]]; then
    echo "Usage: dokku $1 $2 DOMAIN [DOMAIN ...]"
    echo "Must specify DOMAIN."
    exit 1
  fi
  shift 1
  domains_add "$@"
}

domains_add_cmd "$@"
