Skip to content

Commit

Permalink
protect against scripts being sourced (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
twicki authored Oct 23, 2023
1 parent 718d2cf commit cd7d7ae
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tmpl/tools/run-mypy.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
#
# src: https://jaredkhan.com/blog/mypy-pre-commit

if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
echo "Please simply call the script instead of sourcing it!"
return
fi

set -o errexit

VERBOSE=${VERBOSE:-false}
Expand Down
5 changes: 5 additions & 0 deletions tmpl/tools/setup_env.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
# - 2022-09 (S. Ruedisuehli) Refactor; add some options
#

if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
echo "Please simply call the script instead of sourcing it!"
return
fi

# Default env names
DEFAULT_ENV_NAME="{{ project_slug }}"

Expand Down
5 changes: 5 additions & 0 deletions tmpl/tools/setup_miniconda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
# - 2022-09 (S. Ruedisuehli) Refactor
#

if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
echo "Please simply call the script instead of sourcing it!"
return
fi

# Default options
INSTALL_PREFIX=${PWD}
USER_INSTALL=false
Expand Down

0 comments on commit cd7d7ae

Please sign in to comment.