hack/update-generated-completions.sh
f0b7b2a1
 #!/bin/bash
 
a2345030
 # This script sets up a go workspace locally and generates shell auto-completion scripts.
 
614bf6cc
 source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
3976cf48
 
a6739d9a
 # ensure we have the latest compiled binaries
f0eadcca
 "${OS_ROOT}/hack/build-go.sh"
a6739d9a
 
50277405
 platform="$(os::build::host_platform)"
 if [[ "${platform}" != "linux/amd64" ]]; then
91b7dac9
   os::log::warn "Generating completions on ${platform} may not be identical to running on linux/amd64 due to conditional compilation."
50277405
 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
4432b5c0
 mkdir -p "${OUTPUT_DIR_ROOT}/zsh" || echo $? > /dev/null
43ad12ae
 
4432b5c0
 os::build::gen-completions "${OUTPUT_DIR_ROOT}/bash" "bash"
 os::build::gen-completions "${OUTPUT_DIR_ROOT}/zsh" "zsh"