Switch to bash optarg for cli handling in init-submodules script

This commit is contained in:
Nathan Pemberton
2019-10-04 17:54:33 -04:00
parent e5713a4127
commit 95a44ff6d0

View File

@@ -6,17 +6,24 @@ set -o pipefail
RDIR=$(git rev-parse --show-toplevel) RDIR=$(git rev-parse --show-toplevel)
NO_FIRESIM=false _usage() {
echo "usage: ${0} [--no-firesim]" >&2
exit 1
}
while test $# -gt 0 NO_FIRESIM=false
do while getopts 'h-:' opt ; do
case "$1" in case ${opt} in
--no-firesim) -)
NO_FIRESIM=true; case ${OPTARG} in
;; no-firesim) NO_FIRESIM=true ;;
*) echo "invalid option: --${OPTARG}" >&2 ; _usage ;;
esac ;;
h) _usage ;;
*) echo "invalid option: -${opt}" >&2 ; _usage ;;
esac esac
shift
done done
shift $((OPTIND - 1))
# Ignore toolchain submodules # Ignore toolchain submodules
cd "$RDIR" cd "$RDIR"
@@ -39,6 +46,7 @@ git config --unset submodule.vlsi/hammer-synopsys-plugins.update
git config --unset submodule.vlsi/hammer-mentor-plugins.update git config --unset submodule.vlsi/hammer-mentor-plugins.update
if [ $NO_FIRESIM = false ]; then if [ $NO_FIRESIM = false ]; then
echo "initializing firesim"
# Renable firesim and init only the required submodules to provide # Renable firesim and init only the required submodules to provide
# all required scala deps, without doing a full build-setup # all required scala deps, without doing a full build-setup
git config --unset submodule.sims/firesim.update git config --unset submodule.sims/firesim.update