diff --git a/headstart-core.bash b/headstart-core.bash index 8bb6be55496a8e65f3f19d69509542ab15fcfd64..796175179ca1c42ce4a517cc5e56ceb0e9093e4f 100644 --- a/headstart-core.bash +++ b/headstart-core.bash @@ -1,8 +1,11 @@ #!/usr/bin/env bash # TODO add set -ueo pipefail until stack trace kicks in -# Path to the project's root directory +# The code below is not in a function as variables, functions, etc defined here +# and in the sourced files need to be accessible in the global scope. + +# Path to the project's root directory declare -gx PROJECT_DIR # Used for testing @@ -63,12 +66,7 @@ declare -x GO_TAB_COMPLETIONS_PATTERN='' . "$_GO_USE_MODULES" 'core' core_get_installed_version - -if ! [[ "${1-}" == 'core' && "${2-}" == 'bootstrap' ]]; then - core_parse_project_config - # When bootstrapping, the project config does not need to be read, since it is - # create by bootstrap itself. -fi +core_parse_project_config function headstart() { local debug=false diff --git a/lib/core b/lib/core index 4beadfa3569474fcfea518a27eadccb4adee2572..a9ee2873c7c9044aa807d9393e330ddbd7d06ab6 100644 --- a/lib/core +++ b/lib/core @@ -61,6 +61,11 @@ function core_check_upgrades() { } function core_parse_project_config() { + if [[ ! -r "$_HEADSTART_PROJECT_CONFIG" ]]; then + # This will happen if we run 'core bootstrap' and this function gets called. + return + fi + local conf local value