From 7448103630061545903d009b4e00c9904feb80a0 Mon Sep 17 00:00:00 2001 From: Chris Olstrom Date: Thu, 29 Aug 2024 20:57:45 -0700 Subject: [PATCH] add support for non-interactive usage a small change to allow the script to work in non-interactive contexts by allowing the values that would be read from STDIN to be provided by environment, and falling back to the previous behaviour when undefined. Signed-off-by: Chris Olstrom --- hack/prepare.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hack/prepare.sh b/hack/prepare.sh index 6922354..e50e627 100755 --- a/hack/prepare.sh +++ b/hack/prepare.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash set -euox pipefail -read -r -p "Lower case provider name (ex. github): " PROVIDER_NAME_LOWER -read -r -p "Normal case provider name (ex. GitHub): " PROVIDER_NAME_NORMAL -read -r -p "Organization (ex. upbound, my-org-name): " ORGANIZATION_NAME -read -r -p "CRD rootGroup (ex. upbound.io, crossplane.io): " CRD_ROOT_GROUP +: ${PROVIDER_NAME_LOWER:=$(read -r -p "Lower case provider name (ex. github): " PROVIDER_NAME_LOWER; echo -n "${PROVIDER_NAME_LOWER}")} +: ${PROVIDER_NAME_NORMAL:=$(read -r -p "Normal case provider name (ex. GitHub): " PROVIDER_NAME_NORMAL; echo -n "${PROVIDER_NAME_NORMAL}")} +: ${ORGANIZATION_NAME:=$(read -r -p "Organization (ex. upbound, my-org-name): " ORGANIZATION_NAME; echo -n "${ORGANIZATION_NAME}")} +: ${CRD_ROOT_GROUP:=$(read -r -p "CRD rootGroup (ex. upbound.io, crossplane.io): " CRD_ROOT_GROUP; echo -n "${CRD_ROOT_GROUP}")} REPLACE_FILES='./* ./.github :!build/** :!go.* :!hack/prepare.sh' # shellcheck disable=SC2086 @@ -37,4 +37,4 @@ git mv "cluster/images/upjet-provider-template" "cluster/images/provider-${PROVI # generate: open /Users/hasanturken/Workspace/crossplane-contrib/upjet-provider-template/apis/null/v1alpha1/zz_generated.deepcopy.go: no such file or directory rm -rf apis/null # remove the sample directory which was a configuration in the template -rm -rf config/null \ No newline at end of file +rm -rf config/null