Răsfoiți Sursa

ensure_bootstrap: basic argument processing

Running with --help shouldn't actually do the bootstrap.

Change-Id: Id481432cdfc23121e5b71cbe64ffb2068fea8e23
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6165754
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Mike Frysinger 7 luni în urmă
părinte
comite
792831e176
1 a modificat fișierele cu 25 adăugiri și 6 ștergeri
  1. 25 6
      ensure_bootstrap

+ 25 - 6
ensure_bootstrap

@@ -4,16 +4,35 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-# This is a shell script to ensure that all of the "depot_tools" bootstrap
-# programs are locally downloaded and ready for execution.
-#
-# Unlike "update_depot_tools", this script works with the current
-# checkout, and will not update/sync the "depot_tools" repository.
-#
 # TODO: This duplicates logic in "update_depot_tools". Update that script to
 # invoke this script instead of manually calling "cipd_bin_setup" and other
 # operations.
 
+usage() {
+  cat <<EOF
+Usage: $0
+
+This is a shell script to ensure that all of the "depot_tools" bootstrap
+programs are locally downloaded and ready for execution.
+
+Unlike "update_depot_tools", this script works with the current
+checkout, and will not update/sync the "depot_tools" repository.
+EOF
+}
+
+if [ $# -ne 0 ]; then
+  case $1 in
+  -h|--help)
+    usage
+    exit 0
+    ;;
+  *)
+    echo "$0: ERROR: script takes no arguments: $*" >&2
+    exit 1
+    ;;
+  esac
+fi
+
 # Export for other depot_tools scripts to re-use.
 export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "${BASH_SOURCE[0]}")}"