From 47a49800cc2560efe1fe0e19018ad629054ac910 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 16 Nov 2017 11:46:13 -0800 Subject: [PATCH] Add simple usage text for "update.sh" and add optional "--namespace" flag to force a namespace (especially for updating all image docs with a particular namespace applied) --- update.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/update.sh b/update.sh index c50ac6224..a29d6a3e8 100755 --- a/update.sh +++ b/update.sh @@ -4,12 +4,30 @@ set -Eeuo pipefail cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" helperDir='.template-helpers' +# usage: ./update.sh [--namespace NAMESPACE] [[NAMESPACE/]IMAGE ...] +# ie: ./update.sh +# ./update.sh debian golang +# ./update.sh --namespace tianontesting debian golang +# ./update.sh tianontesting/debian tianontestingmore/golang +# BASHBREW_ARCH=windows-amd64 BASHBREW_ARCH_NAMESPACES='...' ./update.sh --namespace winamd64 + +forceNamespace= +if [ "${1:-}" = '--namespace' ]; then + shift + forceNamespace="$1" + shift +fi + images=( "$@" ) if [ ${#images[@]} -eq 0 ]; then images=( */ ) fi images=( "${images[@]%/}" ) +if [ -n "$forceNamespace" ]; then + images=( "${images[@]/#/"$forceNamespace/"}" ) +fi + replace_field() { targetFile="$1" field="$2"