Add `--zap ZAP` to `run_zaptool.sh` to specify an arbitrary location to `zap` (#35549). (#35582)

* scripts/tools/zap/run_zaptool.sh

      * Display the value of 'ZAP_CMD' to standard output.

      * Add support for the `--zap` command line option to specify the `zap` executable to run.

      * Added usage documentation about `ZAP_DEVELOPMENT_PATH` and `ZAP_INSTALL_PATH`.

    * docs/code_generation.md: Added documentation about the `--zap ZAP` option to `run_zaptool.sh`.
diff --git a/docs/code_generation.md b/docs/code_generation.md
index e12bf40..bf5b6f3 100644
--- a/docs/code_generation.md
+++ b/docs/code_generation.md
@@ -66,7 +66,7 @@
 `scripts/tools/zap/run_zaptool.sh` script to automate this:
 
 ```bash
-# Ensure zap is in $PATH or set $ZAP_INSTALL_PATH or $ZAP_DEVELOPMENT_PATH
+# Ensure `zap` is in $PATH, specify the `--zap ZAP` option to `run_zaptool.sh` to specify the path to `zap`, set $ZAP_INSTALL_PATH, or set $ZAP_DEVELOPMENT_PATH
 ./scripts/tools/zap/run_zaptool.sh examples/lighting-app/lighting-common/lighting-app.zap
 ```
 
diff --git a/scripts/tools/zap/run_zaptool.sh b/scripts/tools/zap/run_zaptool.sh
index 4caf9d5..52efc26 100755
--- a/scripts/tools/zap/run_zaptool.sh
+++ b/scripts/tools/zap/run_zaptool.sh
@@ -16,6 +16,9 @@
 # limitations under the License.
 #
 
+readonly ZAP_CMD_DEFAULT="zap"
+
+ZAP_CMD="$ZAP_CMD_DEFAULT"
 ZAP_FILE=""
 
 function _get_fullpath() {
@@ -39,6 +42,22 @@
         echo " General Options:"
         echo ""
         echo "  -h, --help                  Display this help, then exit."
+        echo "  --zap ZAP                   Use the zap program ZAP as the zap executable "
+        echo "                              to run (default: $ZAP_CMD_DEFAULT)."
+        echo ""
+        echo " Some influential environment variables:"
+        echo ""
+        echo "  ZAP_DEVELOPMENT_PATH        The path to a zap development environment. This "
+        echo "                              is likely a zap checkout, used for local "
+        echo "                              development (current: \"${ZAP_DEVELOPMENT_PATH:-<null>}\")."
+        echo ""
+        echo "                              If set, this overrides both the '--zap' option "
+        echo "                              and the 'ZAP_INTALL_PATH' environment variable."
+        echo "  ZAP_INSTALL_PATH            The path where the 'zap' executable exists. "
+        echo "                              This may be used if 'zap' is NOT in the current "
+        echo "                              PATH (current: \"${ZAP_INSTALL_PATH:-<null>}\")."
+        echo ""
+        echo "                              If set, this overrides the '--zap' option."
         echo ""
     fi
 
@@ -59,6 +78,11 @@
             _print_usage 0
             ;;
 
+        --zap)
+            ZAP_CMD="${2}"
+            shift 2
+            ;;
+
         -*)
             echo "ERROR: Unknown or invalid option: '${1}'" >&2
             _print_usage 1
@@ -101,13 +125,14 @@
     fi
     WORKING_DIR="$CHIP_ROOT"
 else
-    ZAP_CMD="zap"
+    [ -z "$ZAP_CMD" ] && ZAP_CMD="$ZAP_CMD_DEFAULT"
     WORKING_DIR="$CHIP_ROOT"
 fi
 
 (
     cd "$WORKING_DIR"
 
+    echo "CMD: $ZAP_CMD"
     echo "ARGS: $ZAP_ARGS"
 
     if [[ "${ZAP_ARGS[*]}" == *"/all-clusters-app.zap"* ]]; then