From 95a44ff6d06186d0bdaa72cb308b0bc37be76d93 Mon Sep 17 00:00:00 2001 From: Nathan Pemberton Date: Fri, 4 Oct 2019 17:54:33 -0400 Subject: [PATCH] Switch to bash optarg for cli handling in init-submodules script --- scripts/init-submodules-no-riscv-tools.sh | 24 +++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/scripts/init-submodules-no-riscv-tools.sh b/scripts/init-submodules-no-riscv-tools.sh index da34adf0..34b9ed8d 100755 --- a/scripts/init-submodules-no-riscv-tools.sh +++ b/scripts/init-submodules-no-riscv-tools.sh @@ -6,17 +6,24 @@ set -o pipefail RDIR=$(git rev-parse --show-toplevel) -NO_FIRESIM=false +_usage() { + echo "usage: ${0} [--no-firesim]" >&2 + exit 1 +} -while test $# -gt 0 -do - case "$1" in - --no-firesim) - NO_FIRESIM=true; - ;; +NO_FIRESIM=false +while getopts 'h-:' opt ; do + case ${opt} in + -) + case ${OPTARG} in + no-firesim) NO_FIRESIM=true ;; + *) echo "invalid option: --${OPTARG}" >&2 ; _usage ;; + esac ;; + h) _usage ;; + *) echo "invalid option: -${opt}" >&2 ; _usage ;; esac - shift done +shift $((OPTIND - 1)) # Ignore toolchain submodules cd "$RDIR" @@ -39,6 +46,7 @@ git config --unset submodule.vlsi/hammer-synopsys-plugins.update git config --unset submodule.vlsi/hammer-mentor-plugins.update if [ $NO_FIRESIM = false ]; then +echo "initializing firesim" # Renable firesim and init only the required submodules to provide # all required scala deps, without doing a full build-setup git config --unset submodule.sims/firesim.update