From 27472cd85230e45893768b37413bdca7f48d9c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Thu, 22 Oct 2026 04:19:56 -0700 Subject: [PATCH] Add `--help` to the Fantom CLI (#59349) Summary: Pull Request resolved: https://github.com/react/react-native/pull/59349 Print usage for the Fantom CLI, including interactive mode, `-e`/`--eval`, script execution, available REPL globals, and `-h`/`--help`. Handle help in the shell entrypoint so it exits successfully before building the native tester or starting Metro. Changelog: [Internal] landed-with-radar-review Differential Revision: D126648592 fbshipit-source-id: 4c61755fadd83340115cbeeed3c0e47d8d9e2fbc --- scripts/fantom-cli.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/fantom-cli.sh b/scripts/fantom-cli.sh index c5422262024..1c630b54ce8 100755 --- a/scripts/fantom-cli.sh +++ b/scripts/fantom-cli.sh @@ -6,6 +6,30 @@ set -e +case "${1:-}" in + -h|--help) + cat <<'EOF' +Usage: yarn fantom-cli [options] [script.js] + +Run JavaScript with Hermes inside the Fantom runtime. +With no arguments, start an interactive REPL. + +Options: + -h, --help Show this help and exit. + -e, --eval Evaluate JavaScript and exit. + +Examples: + yarn fantom-cli + yarn fantom-cli -e 'console.log(1 + 1)' + yarn fantom-cli path/to/script.js + +Script paths must be inside the React Native repository. +The REPL provides React, ReactNative, and Fantom as globals. Use Ctrl-D to exit. +EOF + exit 0 + ;; +esac + if [[ -f "BUCK" && -z "$FANTOM_FORCE_OSS_BUILD" ]]; then export JS_DIR='..' else