Skip to content

Commit 72b1dcd

Browse files
authored
Merge pull request #2569 from flatcar/krnowak/bail-out-on-unknown-flags
run_sdk_container: Bail out on unknown flags
2 parents 8357e5c + c526b41 commit 72b1dcd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

run_sdk_container

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mounts=()
2222

2323
usage() {
2424
echo " Usage:"
25-
echo " $0 [-t] [-v <version>] [-V <SDK version>] [-a <amd64|arm64|all>] [-n <name> ] [-x <script>] [-C <custom-container>] [--rm] [-U] [-m <src>:<dest>] [<container-command>]"
25+
echo " $0 [-t] [-v <version>] [-V <SDK version>] [-a <amd64|arm64|all>] [-n <name> ] [-x <script>] [-C <custom-container>] [--rm] [-U] [-m <src>:<dest>] [--] [<container-command>]"
2626
echo " Start an SDK container of a given SDK release version."
2727
echo " This will create the container if it does not exist, otherwise start the existing container."
2828
echo " If the container is already running then it will exec into the container."
@@ -49,6 +49,7 @@ usage() {
4949
echo " -U Do not update the versionfile. Instead, use the version from the versionfile as-is."
5050
echo " -m <src>:<dest> - Mount local file or directory inside the container."
5151
echo " Can be specified multiple times."
52+
echo " -- Stop parsing options at this point, pass the rest as the container command."
5253
echo " -h Print this help."
5354
echo
5455
}
@@ -72,6 +73,8 @@ while [[ $# -gt 0 ]] ; do
7273
update_versionfile=
7374
shift;;
7475
-m) mounts+=( -v "$2" ); shift; shift;;
76+
--) shift; break;;
77+
-*) echo "Unknown flag ${1@Q}, use '-h' or '--help' for usage"; exit 1;;
7578
*) break;;
7679
esac
7780
done

0 commit comments

Comments
 (0)