#!/usr/bin/env bash
#
# Alias shell script for ./bin/sonarqube.

set -e

#######################################
# Prevent Sourcing
#
# Firstly, we need to ensure Localhost
# SonarQube is executed in a new shell
# process.
#######################################

if [[ ${BASH_SOURCE[0]} != "$0" ]]; then
  echo >&2 "ERROR: \`Localhost SonarQube\` cannot be sourced."

  exit 1
fi

#######################################
# Define Global Constant
#
# Secondly, we determine the Localhost
# SonarQube directory.
#######################################

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
readonly CURRENT_DIR

#######################################
# Run The Application
#
# Finally, we execute the Localhost
# SonarQube application.
#######################################

exec "${CURRENT_DIR}/bin/sonarqube" "$@"
