github.com/panekj/cli@v0.0.0-20230304125325-467dd2f3797e/scripts/warn-outside-container (about)

     1  #!/usr/bin/env sh
     2  set -eu
     3  
     4  target="${1:-}"
     5  
     6  if [ -z "${DISABLE_WARN_OUTSIDE_CONTAINER:-}" ]; then
     7  		case $target in
     8  			clean|dev|help|shell)
     9  				# no warning needed for these targets
    10  				;;
    11  			*)
    12  				(
    13  						echo
    14  						echo "\033[1mWARNING\033[0m: you are not in a container."
    15  						echo
    16  						echo 'Use "\033[1mmake dev\033[0m" to start an interactive development container,'
    17  						echo "use \"\033[1mmake -f docker.Makefile $target\033[0m\" to execute this target"
    18  						echo "in a container, or set \033[1mDISABLE_WARN_OUTSIDE_CONTAINER=1\033[0m to"
    19  						echo "disable this warning."
    20  						echo
    21  						echo "Press \033[1mCtrl+C\033[0m now to abort, or wait for the script to continue.."
    22  						echo
    23  				) >&2
    24  				sleep 5
    25  				;;
    26  		esac
    27  fi