From b213814ef08a4faa763d709c1dafe987196b4b03 Mon Sep 17 00:00:00 2001 From: Nikolaos Kakouros <nkak@kth.se> Date: Thu, 28 Jan 2021 20:40:53 +0100 Subject: [PATCH] wip --- headstart-core.bash | 12 +++++------- lib/core | 5 +++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/headstart-core.bash b/headstart-core.bash index 8bb6be5..7961751 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 4beadfa..a9ee287 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 -- GitLab