/usr/bin/pkgos-gen-completion is in openstack-pkg-tools 75.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #!/bin/sh
# -*- mode: shell-script -*-
set -x
# Default use python3
PKGOS_PY_VER=python3
for i in $@ ; do
case "${1}" in
"--py3")
PKGOS_PY_VER=python3
shift
;;
"--py2")
PKGOS_PY_VER=python
shift
;;
*)
;;
esac
done
BINARY=$1
CLIENT="${BINARY}client"
PYTHON_SHELL_MODULE="${CLIENT}.shell"
COMPLETION_INSTALL_PATH="$(pwd)/debian/${PKGOS_PY_VER}-$CLIENT/usr/share/bash-completion/completions"
TEMP_FILE=$(mktemp)
${PKGOS_PY_VER} -m ${PYTHON_SHELL_MODULE} complete > ${TEMP_FILE}
if grep "_shell()" ${TEMP_FILE} > /dev/null ; then
mkdir -p ${COMPLETION_INSTALL_PATH}
cat ${TEMP_FILE} | sed -r "s/shell/${BINARY}/g" > ${COMPLETION_INSTALL_PATH}/${BINARY}
fi
# Delete temp file
rm -f ${TEMP_FILE}
|