diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-02-09 07:53:49 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-02-10 10:26:12 +0000 |
commit | 19d4f52a9e589a8cc524858a2f4d7f887117cdeb (patch) | |
tree | 32368d3d1ad89a49e07bd53b5f9f9a1b30c9b742 /Base/usr | |
parent | 65de0d291094c0a8dfc9267378479041c94b8658 (diff) | |
download | serenity-19d4f52a9e589a8cc524858a2f4d7f887117cdeb.zip |
js: Add a command line argument to evaluate a string as a script
For example:
$ js -c "console.log(42)"
42
Diffstat (limited to 'Base/usr')
-rw-r--r-- | Base/usr/share/man/man1/js.md | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Base/usr/share/man/man1/js.md b/Base/usr/share/man/man1/js.md index 51939d956b..5b8754cd33 100644 --- a/Base/usr/share/man/man1/js.md +++ b/Base/usr/share/man/man1/js.md @@ -28,18 +28,26 @@ Run `help()` in REPL mode to see its available built-in functions. * `-m`, `--as-module`: Treat as module * `-l`, `--print-last-result`: Print the result of the last statement executed. * `-g`, `--gc-on-every-allocation`: Run garbage collection on every allocation. -* `-c`, `--disable-ansi-colors`: Disable ANSI colors +* `-i`, `--disable-ansi-colors`: Disable ANSI colors * `-h`, `--disable-source-location-hints`: Disable source location hints * `-s`, `--no-syntax-highlight`: Disable live syntax highlighting in the REPL +* `-c`, `--evaluate`: Evaluate the argument as a script ## Examples -Here's how you execute a script: +Here's how you execute a script from a file: ```sh $ js ~/Source/js/type-play.js ``` +Here's how you execute a script as a command line argument: + +```sh +$ js -c "console.log(42)" +42 +``` + And here's an example of an interactive REPL session: ```js |