From 7b16300c8f1af73809f2d18cd75a172c562ad4d1 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Tue, 7 Sep 2021 08:44:35 +0100
Subject: [PATCH] Allow passing arguments to dev/environment-setup.sh

Arguments are passed through to kayobe-env in kayobe-config, which
allows to set the Kayobe environment.

Change-Id: I4c72e32e5379237340284a09874b0c500e41ad0f
---
 dev/environment-setup.sh | 7 +++++--
 dev/functions            | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dev/environment-setup.sh b/dev/environment-setup.sh
index e639d5ee..aded2020 100755
--- a/dev/environment-setup.sh
+++ b/dev/environment-setup.sh
@@ -11,6 +11,9 @@ set -o pipefail
 # environment. This script should be sourced rather than executed in a
 # subprocess. e.g. source dev/environment-setup.sh
 
+# Arguments passed to this script are passed through to the kayobe-env script
+# in kayobe-config. This can be used to set the Kayobe environment.
+
 PARENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
 
 source "${PARENT}/functions"
@@ -18,10 +21,10 @@ source "${PARENT}/functions"
 
 function main {
     config_init
-    environment_setup
+    environment_setup "$@"
 }
 
-main
+main "$@"
 
 # Restore previous shell options.
 eval "$oldstate"
diff --git a/dev/functions b/dev/functions
index 147477a1..65723c89 100644
--- a/dev/functions
+++ b/dev/functions
@@ -215,7 +215,7 @@ function environment_setup {
     set +u
     source "${KAYOBE_VENV_PATH}/bin/activate"
     set -u
-    source "${KAYOBE_CONFIG_SOURCE_PATH}/kayobe-env"
+    source "${KAYOBE_CONFIG_SOURCE_PATH}/kayobe-env" "$@"
 }
 
 function run_kayobe {
-- 
GitLab