Skip to content

Commit

Permalink
v1.1.1 (#7)
Browse files Browse the repository at this point in the history
- fix: variuos fixes on gdrcd-stack control methods;

Co-authored-by: Kasui92 <Rododendro92>
  • Loading branch information
Kasui92 authored Aug 2, 2022
1 parent 20d0a0d commit bf4ff71
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions gdrcd-stack
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ fi
# Environment
# ---------------------------------------------------------------------

# environment variables
set -o allexport
# shellcheck disable=SC1090
source "$_PATH_ENV";
set +o allexport
# import env file
if [[ -f "${_PATH_ENV}" ]]; then
# shellcheck source=.env
source "${_PATH_ENV}"
else
echo "Warning! No .env file found, please create one."
fi

# -----------------------------------------------------------------------------
# Helper functions start with _ and aren't listed in this script's help menu.
Expand All @@ -39,29 +41,29 @@ function _dc {
}

# Check non-existent arguments
function _isCommand {
_isCommand() {
if ! type "$1" >/dev/null 2>&1; then
echo "Command not found: $1"
echo "Warning! Command not found: $1"
exit 1;
fi;
}

# Check if docker is installed
_checkDocker() {
if ! type "docker" >/dev/null 2>&1; then
echo "Docker not found"
echo "Error: Docker not found"
exit 1;
fi;
}

# Check if environment is set
_checkEnvironment() {
if [[ -z ${ENV+x} ]]; then
echo "Environment not set"
echo "Error: ENV variable not set"
exit 1;
else
return 0;
fi
fi;
}

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -111,4 +113,4 @@ _checkEnvironment; \
_isCommand "${1:-help}"; \
# This idea is heavily inspired by: https://github.com/adriancooney/Taskfile
TIMEFORMAT=$'\nProcess completed in %3lR'; \
time "${@:-help}";
time "${@:-help}";

0 comments on commit bf4ff71

Please sign in to comment.