hack/update-generated-completions.sh
f0b7b2a1
 #!/bin/bash
 
 # This script sets up a go workspace locally and builds all go components.
 
 set -o errexit
 set -o nounset
 set -o pipefail
 
 OS_ROOT=$(dirname "${BASH_SOURCE}")/..
 source "${OS_ROOT}/hack/common.sh"
 
50277405
 platform="$(os::build::host_platform)"
 if [[ "${platform}" != "linux/amd64" ]]; then
   echo "WARNING: Completions cannot be updated on non-Linux systems (${platform}) due to static link dependencies"
   exit 1
 fi
 
54fca663
 "${OS_ROOT}/hack/build-go.sh" tools/genbashcomp
f0b7b2a1
 
 # Find binary
749428c4
 genbashcomp="$(os::build::find-binary genbashcomp)"
f0b7b2a1
 
 if [[ ! "$genbashcomp" ]]; then
   {
     echo "It looks as if you don't have a compiled genbashcomp binary"
     echo
     echo "If you are running from a clone of the git repo, please run"
54fca663
     echo "'./hack/build-go.sh tools/genbashcomp'."
f0b7b2a1
   } >&2
   exit 1
 fi
 
43ad12ae
 OUTPUT_REL_DIR=${1:-""}
ce9187ea
 OUTPUT_DIR_ROOT="${OS_ROOT}/${OUTPUT_REL_DIR}/contrib/completions"
43ad12ae
 
 mkdir -p "${OUTPUT_DIR_ROOT}/bash" || echo $? > /dev/null
 
 os::build::gen-docs "${genbashcomp}" "${OUTPUT_DIR_ROOT}/bash"