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
This commit is contained in:
Rubén Norte authored and meta-codesync[bot] committed 2026-10-22 04:19:56 -07:00
1 parent a96b0e424c
commit 27472cd852
1 file changed
+24
+24
View File
@@ -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 <code> 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